aboutsummaryrefslogtreecommitdiff
path: root/tests/lang.sh
AgeCommit message (Collapse)Author
2023-12-01Put functional tests in `tests/functional`John Ericson
I think it is bad for these reasons when `tests/` contains a mix of functional and integration tests - Concepts is harder to understand, the documentation makes a good unit vs functional vs integration distinction, but when the integration tests are just two subdirs within `tests/` this is not clear. - Source filtering in the `flake.nix` is more complex. We need to filter out some of the dirs from `tests/`, rather than simply pick the dirs we want and take all of them. This is a good sign the structure of what we are trying to do is not matching the structure of the files. With this change we have a clean: ```shell-session $ git show 'HEAD:tests' tree HEAD:tests functional/ installer/ nixos/ ``` (cherry picked from commit 68c81c737571794f7246db53fb4774e94fcf4b7e)
2023-07-13Fix race condition in the language testsJohn Ericson
When we pipe to `>(...)` like that, we unfortunately don't wait for the process to finish. Better to just substitute the file. Also, use the "unified" diff output that people (including myself) are more familiar with, thanks to Git.
2023-07-11Expanded test suiteMathnerd314
* Lang now verifies errors and parse output * Some new miscellaneous tests * Easy way to update the tests * Document workflow in manual * Use `!` not `~` as separater char for sed It is confusing to use `~` when we are talking about paths and home directories! * Test test suite itself (`test/lang-test/infra.sh`) Additionally, run shellcheck on `tests/lang.sh` to help ensure it is correct, now that is is more complex. Co-authored-by: Robert Hensing <roberth@users.noreply.github.com> Co-authored-by: Valentin Gagarin <valentin.gagarin@tweag.io>
2023-04-03eval: Fix crash on missing printValue tBlackhole caseRobert Hensing
Fixes #8119
2023-03-08Harden tests' bashJohn Ericson
Use `set -u` and `set -o pipefail` to catch accidental mistakes and failures more strongly. - `set -u` catches the use of undefined variables - `set -o pipefail` catches failures (like `set -e`) earlier in the pipeline. This makes the tests a bit more robust. It is nice to read code not worrying about these spurious success paths (via uncaught) errors undermining the tests. Indeed, I caught some bugs doing this. There are a few tests where we run a command that should fail, and then search its output to make sure the failure message is one that we expect. Before, since the `grep` was the last command in the pipeline the exit code of those failing programs was silently ignored. Now with `set -o pipefail` it won't be, and we have to do something so the expected failure doesn't accidentally fail the test. To do that we use `expect` and a new `expectStderr` to check for the exact failing exit code. See the comments on each for why. `grep -q` is replaced with `grepQuiet`, see the comments on that function for why. `grep -v` when we just want the exit code is replaced with `grepInverse, see the comments on that function for why. `grep -q -v` together is, surprise surprise, replaced with `grepQuietInverse`, which is both combined. Co-authored-by: Robert Hensing <roberth@users.noreply.github.com>
2022-12-12Fix reference to test directory pathEelco Dolstra
2022-12-12Enable some language tests that were accidentally disabledEelco Dolstra
This didn't run because the corresponding .exp file didn't exist.
2022-07-05Add builtins.traceVerboseGytis Ivaskevicius
Co-Authored-By: Silvan Mosberger <contact@infinisil.com> Add builtins.traceVerbose tests
2022-05-02tests/lang: Distinguish crashes from expected failuresGuillaume Maudoux
2022-05-02Revert "tests: Distinguish crashes from expected failures"Guillaume Maudoux
This reverts commit 143b73f52dabb35cd56551c24caef95466bce488.
2022-04-29tests: Distinguish crashes from expected failuresGuillaume Maudoux
2020-08-24Add DummyStore (dummy://)Eelco Dolstra
DummyStore does not allow building or adding paths. This is useful for evaluation tests when you don't want to initialize a "proper" store.
2014-08-21Fix testsEelco Dolstra
So all these years I was totally deluded about the meaning of "set -e". You might think that it causes statements like "false && true" or "! true" to fail, but it doesn't...
2014-05-26Add constant ‘nixPath’Eelco Dolstra
It contains the Nix expression search path as a list of { prefix, path } sets, e.g. [ { path = "/nix/var/nix/profiles/per-user/root/channels/nixos"; prefix = ""; } { path = "/etc/nixos/configuration.nix"; prefix = "nixos-config"; } { path = "/home/eelco/Dev/nix/inst/share/nix/corepkgs"; prefix = "nix"; } ]
2014-02-26Test trace and addErrorContextEelco Dolstra
2014-02-26Test some more primopsEelco Dolstra
2014-02-19nix-instantiate: Rename --eval-only to --eval, --parse-only to --parseEelco Dolstra
2013-07-31Test the delayed with a bit moreEelco Dolstra
2012-01-03* Refactoring: Get rid of a few subdirectories in corepkgs/, and someEelco Dolstra
other simplifications. * Use <nix/...> to locate the corepkgs. This allows them to be overriden through $NIX_PATH. * Use bash's pipefail option in the NAR builder so that we don't need to create a temporary file.
2011-10-10* Refactoring: remove unnecessary variables from the tests.Eelco Dolstra
2011-08-06* Add a Nix expression search path feature. Paths between angleEelco Dolstra
brackets, e.g. import <nixpkgs/pkgs/lib> are resolved by looking them up relative to the elements listed in the search path. This allows us to get rid of hacks like import "${builtins.getEnv "NIXPKGS_ALL"}/pkgs/lib" The search path can be specified through the ‘-I’ command-line flag and through the colon-separated ‘NIX_PATH’ environment variable, e.g., $ nix-build -I /etc/nixos ... If a file is not found in the search path, an error message is lazily thrown.
2010-05-07* Sync with the trunk.Eelco Dolstra
2010-04-21* Update the expected test output (no longer an ATerm).Eelco Dolstra
2010-04-21* Because --parse-only no longer produces an ATerm, don't check theEelco Dolstra
output. Whether it parses at all should be enough.
2010-04-19* Drop the dependency on the ATerm library.Eelco Dolstra
2010-03-31Make source location info in the XML output optional.Ludovic Courtès
* src/libexpr/expr-to-xml.cc (nix::showAttrs): Add `location' parameter. Provide location XML attributes when it's true. Update callers. (nix::printTermAsXML): Likewise. * src/libexpr/expr-to-xml.hh (nix::printTermAsXML): Update prototype; have `location' default to `false'. * src/nix-instantiate/nix-instantiate.cc (printResult, processExpr): Add `location' parameter; update callers. (run): Add support for `--no-location'. * src/nix-instantiate/help.txt: Update accordingly. * tests/lang.sh: Invoke `nix-instantiate' with `--no-location' for the XML tests. * tests/lang/eval-okay-toxml.exp, tests/lang/eval-okay-to-xml.nix: New files.
2007-01-14* Option --argstr for passing string arguments easily. (NIX-75)Eelco Dolstra
2006-10-17* Fix the tests wrt the AST changes, i.e., Str(s) -> Str(s, []), andEelco Dolstra
the semantic changes.
2006-09-24* Builtin function `getEnv' for getting environment variables.Eelco Dolstra
2006-09-22* Builtin function `add' to add integers.Eelco Dolstra
* Put common test functions in tests/lang/lib.nix.
2006-08-22* Urgh (see NIX-56).Eelco Dolstra
2006-08-17* Test for `nix-instantiate --eval-only --xml'.Eelco Dolstra
2006-03-01* Simplification.Eelco Dolstra
2006-03-01* Make it easy to run individual tests from the command line.Eelco Dolstra
2004-10-27* Use `atdiff' instead of `cmp' for checking test output.Eelco Dolstra
* Don't use local file names in tests since they will produce different parse trees depending on the current directory.
2004-10-27* Remove ancient Fix tests.Eelco Dolstra
* Add automated Nix expression language tests.