aboutsummaryrefslogtreecommitdiff
path: root/tests
AgeCommit message (Collapse)Author
2024-03-13support <program>_ENV variableseldritch horrors
this lets us set per-test-program environment variables rather than only a single, global default. this was supported in nix originally but might've gone partially missing in the upstream backports process? Change-Id: Iad0919841b1b6d11e0b7ebd3920449a62f544e77
2024-03-11import the revisions to the characterization test framework from cppnixJade Lovelace
This has some Flaws for sure (like, it is going to be a bit stretched to use for repl characterization), but it is a start. Change-Id: I258c8beb3aee236f45818a03be83bcda858120c9
2024-03-10evaluate inherit (from) exprs only once per directiveeldritch horrors
desugaring inherit-from to syntactic duplication of the source expr also duplicates side effects of the source expr (such as trace calls) and expensive computations (such as derivationStrict). (cherry picked from commit cefd0302b55b3360dbca59cfcb4bf6a750d6cdcf) Change-Id: Iff519f991adef2e51683ba2c552d37a3df7a179e
2024-03-10group inherit by source during Expr::showeldritch horrors
for plain inherits this is really just a stylistic choice, but for inherit-from it actually fixes an exponential size increase problem during expr printing (as may happen during assertion failure reporting, on during duplicate attr detection in the parser) (cherry picked from commit ecf8b12d60ad2929f9998666cf0966475b91e291) Change-Id: Ie55f0cb01a37e766414c31f8d40f51c2c7d106b0
2024-03-10use the same bindings print for ExprAttrs and ExprLeteldritch horrors
this also has the effect of sorting let bindings lexicographically rather than by symbol creation order as was previously done, giving a better canonicalization in the process. (cherry picked from commit 6c08fba533ef31cad2bdc03ba72ecf58dc8ee5a0) Change-Id: Ia887f629305645bb8a165fbbc0d32e620912595a
2024-03-10add test for inherit expr printingeldritch horrors
(cherry picked from commit 73065a400d176b21f518c1f4ece90c31318b218d) Change-Id: I9356d8084d241a7904b66554d7c4194f8433edf7
2024-03-10add test for inherit-from semanticseldritch horrors
(cherry picked from commit 8669c02468994887be91072ac58b1ee43380d354) Change-Id: If8513316bf4b4b559c5bb63842c856f016816802
2024-03-10Merge "make the multi-node vm tests a bit more reliable" into maineldritch horrors
2024-03-10make the multi-node vm tests a bit more reliableeldritch horrors
without these changes the tests will very repeatably (although not very reliably) wedge in our runs. the ssh command starts, opens a sessions, does something, the session closes again, but the test does not move on. adding *just* the redirect and not the unit waits is not sufficient either, it needs both. this feels like a bug in the nixos testing framework somewhere, but digging that far is not in the cards right now. Change-Id: Idab577b83a36cc4899bb5ffbb3d9adc04e83e51c
2024-03-09Merge pull request #10066 from 9999years/print-all-frameseldritch horrors
Do not skip any stack frames when `--show-trace` is given (cherry picked from commit 0b47783d0a879875d558f0b56e49584f25ceb2d0) Change-Id: Ia0f18266dbcf97543110110c655c219c7a3e3270
2024-03-09Pretty-print values in the REPLeldritch horrors
Pretty-print values in the REPL by printing each item in a list or attrset on a separate line. When possible, single-item lists and attrsets are printed on one line, as long as they don't contain a nested list, attrset, or thunk. Before: ``` { attrs = { a = { b = { c = { }; }; }; }; list = [ 1 ]; list' = [ 1 2 3 ]; } ``` After: ``` { attrs = { a = { b = { c = { }; }; }; }; list = [ 1 ]; list' = [ 1 2 3 ]; } ``` (cherry picked from commit c0a15fb7d03dfb8f53bc6726c414bc88aa362592) Change-Id: Ia2b41849165a5ddb63f7a8c272a2476b3e4292df
2024-03-09Merge pull request #9925 from 9999years/fmt-cleanupeldritch horrors
Cleanup `fmt.hh` (cherry picked from commit 47a1dbb4b8e7913cbb9b4d604728b912e76e4ca0) Change-Id: Id076a45cb39652f437fe3f8bda10c310a9894777
2024-03-09libexpr: Support structured error classeseldritch horrors
While preparing PRs like #9753, I've had to change error messages in dozens of code paths. It would be nice if instead of EvalError("expected 'boolean' but found '%1%'", showType(v)) we could write TypeError(v, "boolean") or similar. Then, changing the error message could be a mechanical refactor with the compiler pointing out places the constructor needs to be changed, rather than the error-prone process of grepping through the codebase. Structured errors would also help prevent the "same" error from having multiple slightly different messages, and could be a first step towards error codes / an error index. This PR reworks the exception infrastructure in `libexpr` to support exception types with different constructor signatures than `BaseError`. Actually refactoring the exceptions to use structured data will come in a future PR (this one is big enough already, as it has to touch every exception in `libexpr`). The core design is in `eval-error.hh`. Generally, errors like this: state.error("'%s' is not a string", getAttrPathStr()) .debugThrow<TypeError>() are transformed like this: state.error<TypeError>("'%s' is not a string", getAttrPathStr()) .debugThrow() The type annotation has moved from `ErrorBuilder::debugThrow` to `EvalState::error`. (cherry picked from commit c6a89c1a1659b31694c0fbcd21d78a6dd521c732) Change-Id: Iced91ba4e00ca9e801518071fb43798936cbd05a
2024-03-09Merge pull request #9928 from 9999years/error-messages-in-nix-repleldritch horrors
Improve error printing in `nix repl` (cherry picked from commit a8050d9b83052e4b5c52bf2d116381aedec3a93e) Change-Id: I588f92d1dd4c546c98788b71403cc034f5e7129a
2024-03-09Merge pull request #9929 from 9999years/dont-print-values-in-magentaeldritch horrors
Don't print the first bracket in values in magenta in error messages (cherry picked from commit 46a0625a40aef6946a35f92fdacf0e6b4a14414f) Change-Id: I8435565c87db182116140eaeea9df1243e67ea94
2024-03-09Merge pull request #9926 from 9999years/fix-cycle-detection-in-nix-repleldritch horrors
Fix cycle detection in `nix repl` (cherry picked from commit e190c20c3394fd1a5cd9be1afc3f30ab32dcd36b) Change-Id: Ie385e781b9f0b7171ca653bcd53a990bb41f9e4b
2024-03-09Merge pull request #9754 from 9999years/print-value-when-coercion-failseldritch horrors
Print the value in `error: cannot coerce` messages (cherry picked from commit 5b7bfd2d6b89d7dd5f54c1ca6c8072358d31a84e) === test taken from 6e8d5983143ae576e3f4b1d2954a5267f2943a49; it was added previously (and not backported because its pr was a mostly-revert), but it's useful to have around. Change-Id: Icbd14b55e3610ce7b774667bf14b82e6dc717982
2024-03-09Merge pull request #9818 from Ma27/print-value-on-function-call-type-erroreldritch horrors
libexpr: print value of what is attempted to be called as function (cherry picked from commit 50e5d7b883042852538371237e32a66bb22f0485) Change-Id: I7cb6290bd8f244e83bfce3b2eed2a4c8b4f16a83
2024-03-09Merge pull request #9753 from 9999years/print-value-on-type-erroreldritch horrors
Print the value in `value is X while a Y is expected` error (cherry picked from commit 5f72a97092da6af28a7d2b2a50d74e9d34fae7e1) Change-Id: Idb4bc903ae59a0f5b6fb3b1da4d47970fe0a6efe
2024-03-09Unify and refactor value printingeldritch horrors
Previously, there were two mostly-identical value printers -- one in `libexpr/eval.cc` (which didn't force values) and one in `libcmd/repl.cc` (which did force values and also printed ANSI color codes). This PR unifies both of these printers into `print.cc` and provides a `PrintOptions` struct for controlling the output, which allows for toggling whether values are forced, whether repeated values are tracked, and whether ANSI color codes are displayed. Additionally, `PrintOptions` allows tuning the maximum number of attributes, list items, and bytes in a string that will be displayed; this makes it ideal for contexts where printing too much output (e.g. all of Nixpkgs) is distracting. (As requested by @roberth in https://github.com/NixOS/nix/pull/9554#issuecomment-1845095735) Please read the tests for example output. Future work: - It would be nice to provide this function as a builtin, perhaps `builtins.toStringDebug` -- a printing function that never fails would be useful when debugging Nix code. - It would be nice to support customizing `PrintOptions` members on the command line, e.g. `--option to-string-max-attrs 1000`. (cherry picked from commit 0fa08b451682fb3311fe58112ff05c4fe5bee3a4, ) === Restore ambiguous value printer for `nix-instantiate` The Nix team has requested that this output format remain unchanged. I've added a warning to the man page explaining that `nix-instantiate --eval` output will not parse correctly in many situations. (cherry picked from commit df84dd4d8dd3fd6381ac2ca3064432ab31a16b79) Change-Id: I7cca6b4b53cd0642f2d49af657d5676a8554c9f8
2024-03-08flake.nix: upgrade to nixos-23.11Puck Meerburg
This also bypasses the Objective-C fork safety during tests. Change-Id: I92bf9f911e8a1fbd32eae13255f9a9dabde40b21
2024-03-07Merge pull request #9324 from 9999years/fix-8854-take-2eldritch horrors
Don't attempt to `git add` ignored files (cherry picked from commit 359990dfdc713c80aabd7ea6f7e4528628fbe108) === also added a regression test that isn't upstream to be sure we're actually fixing the bug. Change-Id: I8267a3d0ece9909d8008b7435b90e7b3eee366f6
2024-03-07Merge pull request #9560 from ↵eldritch horrors
obsidiansystems/serve-proto-unkeyed-valid-path-info-serializer Factor out `ServeProto::Serialiser<UnkeyedValidPathInfo>` and test (cherry picked from commit 139982997eec493a0f74105c427953f6be77da6d) Change-Id: I28e4ba5a681a90d81915a56e6dbaa5456d64f96d
2024-03-07Merge pull request #9032 from Ma27/structured-attrs-env-varseldritch horrors
structured attrs: improve support / usage of NIX_ATTRS_{SH,JSON}_FILE (cherry picked from commit 3c042f3b0b0a7ef9c47bf049f5410dbd4aac9e90) Change-Id: I7e41838338ee1edf31fff6f9e354c3db2bba6c0e
2024-03-07Merge pull request #9676 from DavHau/git-testsuiteeldritch horrors
initialize test suite for git fetchers (cherry picked from commit 0bd9e10aea747df51c8a5af124864c722cbeafde) Change-Id: Idf94a47794190c3e1de07fc4e7848741c4e9ffed
2024-03-07Merge pull request #9631 from cole-h/fixup-check-warningseldritch horrors
Fix warnings when running checks (cherry picked from commit 75e10e42f3c63fd9b9c8cf222b992ab77e497854) Change-Id: Id955008fe045f23f72fae2a2cdf8f7ccddd1e6b9
2024-03-07Merge pull request #8544 from edolstra/handle-missing-gc-socketeldritch horrors
LocalStore: :addTempRoot(): Handle ENOENT (cherry picked from commit 7115edc85af060ef235ac0270245ab46cc828f7c) Change-Id: Ie6b1596049c3fde09b98f2f0727899f98e48e6b1
2024-03-07Merge pull request #9985 from alois31/symlink-resolutioneldritch horrors
Restore `builtins.pathExists` behavior on broken symlinks (cherry picked from commit d53c8901ef7f2033855dd99063522e3d56a19dab) === note that this variant differs markedly from the source commit because we haven't endured quite as much lazy trees. Change-Id: I0facf282f21fe0db4134be5c65a8368c1b3a06fc
2024-03-07Merge pull request #10074 from lf-/jade/ban-implicit-fallthrougheldritch horrors
Warn on implicit switch case fallthrough (cherry picked from commit 21282c3c204597641402c6bcff8fc9ee7bc31fa1) Change-Id: I5ebbdfb6c037d2c55254f37dd391c07c2ce7443e
2024-03-06tests/nixos/remote-builds*: Inline module + formateldritch horrors
(cherry picked from commit 5167351efbee5c5a7390510eb720c31c6976f4d9) Change-Id: I0caba23b589ed428d08895d7b8f0c22532bd259e
2024-03-06tests/nixos: Test remote build against older versionseldritch horrors
(cherry picked from commit e502d1cf945fb3cdd0ca1e1c16ec330ccab51c7b) Change-Id: If6a1758b6457c5dae9305829c4d71d1905cfca22
2024-03-07Merge pull request #9604 from obsidiansystems/test-substitute-on-destinationeldritch horrors
Test `nix copy --substitute-on-destination` (cherry picked from commit ed93e51f4b0a8149521e3cf5b4f3ff4eabf5b060) Change-Id: I33f8b591f42acf96fd18f27758dd1141b4bbbb5f
2024-03-06Merge pull request #9280 from R-VdP/rvdp/fix_remote_logging_phase_reportingeldritch horrors
Include phase reporting in log file for ssh-ng builds (cherry picked from commit b1e7d7cad625095656fff05ac4aedeb12135110a) Change-Id: I4076669b0ba160412f7c628ca9113f9abbc8c303
2024-03-07Copy the output of fixed-output derivations before registering themPuck Meerburg
It is possible to exfiltrate a file descriptor out of the build sandbox of FODs, and use it to modify the store path after it has been registered. To avoid that issue, don't register the output of the build, but a copy of it (that will be free of any leaked file descriptor). Test that we can't leverage abstract unix domain sockets to leak file descriptors out of the sandbox and modify the path after it has been registered. (cherry picked from commit 2dadfeb690e7f4b8f97298e29791d202fdba5ca6) (tests cherry picked from commit c854ae5b3078ac5d99fa75fe148005044809e18c) Co-authored-by: Valentin Gagarin <valentin.gagarin@tweag.io> Co-authored-by: Theophane Hufschmitt <theophane.hufschmitt@tweag.io> Co-authored-by: Tom Bereknyei <tomberek@gmail.com> Change-Id: I87cd58f1c0a4f7b7a610d354206b33301e47b1a4
2024-03-05Merge pull request #9105 from Ericson2314/split-out-nixos-testseldritch horrors
Define NixOS tests in `tests/nixos/default.nix` rather than `flake.nix` (cherry picked from commit c29b8ba142a0650d1182ca838ddc1b2d273dcd2a) Change-Id: Ieae1b6476d95024485df7067e008013bc5542039
2024-03-04Ban building Nix with NDEBUGeldritch horrors
When reviewing old PRs, I found that #9997 adds some code to ensure one particular assert is always present. But, removing asserts isn't something we do in our own release builds either in the flake here or in nixpkgs, and is plainly a bad idea that increases support burden, especially if other distros make bad choices of build flags in their Nix packaging. For context, the assert macro in the C standard is defined to do nothing if NDEBUG is set. There is no way in our build system to set -DNDEBUG without manually adding it to CFLAGS, so this is simply a configuration we do not use. Let's ban it at compile time. I put this preprocessor directive in src/libutil.cc because it is not obvious where else to put it, and it seems like the most logical file since you are not getting a usable nix without it. Upstream-PR: https://github.com/NixOS/nix/pull/10126 Original-Change-Id: I513cceaac1371decb3d96231e6ef9181c910c218 Change-Id: I531a51f6348a746e8e41d88203b08f614898356c
2024-03-04Merge pull request #9933 from pennae/debugger-fixeldritch horrors
fix debugger crashing while printing envs (cherry picked from commit 9b8b4860913afdb7f9cb1e1e81f9a9dd192cd1c1) Change-Id: Ica6a17e4b3e3b8b8093719f442c28be7f13be09d
2024-03-04Merge pull request #9930 from rvl/print-dev-env-unbound-variableseldritch horrors
print-dev-env: Avoid using unbound shellHook variable (cherry picked from commit 25385a408ef7281d966c8732608833e224b32586) Change-Id: Id1aca13942adfa628f7bdcfc0b6fc03bb3bab9ea
2024-03-04Merge pull request #9861 from 9999years/colored-diff-in-lang-testseldritch horrors
Color `diff` output in `tests/functional/lang` tests (cherry picked from commit 1dc55c0f2f034bce6e3de4a5cda96d686b10a7f8) Change-Id: Ie9b3fc3446bd3caa0fd8885de88639516a2ff862
2024-03-04Merge pull request #9841 from obsidiansystems/float-speed-factoreldritch horrors
Convert `Machine::speedFactor` from a non-neg int to a non-neg float (cherry picked from commit 69d0ae27e376e7c7c4f237716b0149223b8a805a) Change-Id: I2afb5cf9e4fe1384985c58353946135c3d102b42
2024-03-04Merge pull request #9481 from ↵eldritch horrors
iFreilicht/disallow-nix-search-without-search-terms nix search: Disallow empty regex (cherry picked from commit 1c260fa6d1f47d83954792771d0614db163cc3bc) Change-Id: Iaaf3605c24a342fcb05d0b534a9f305533d3b5fa
2024-03-04Merge pull request #9632 from cole-h/nix-daemon-testingeldritch horrors
Use `nix daemon` in the test suite (cherry picked from commit e6e160a0758c0354ed810b0ec9846ed885adcc11) Change-Id: I537a25d3d48f609cd77b2c3a8ad68e87aebabfe8
2024-03-04Merge pull request #9785 from hercules-ci/test-substring-negativeeldritch horrors
tests/functional/lang: Test substring with negative length (cherry picked from commit 86156d05dd33f856d8804f89669a7fe9b81f1a0d) Change-Id: I2e2086027a43f8111ba5068ac16590eaa0b798d4
2024-03-04Merge pull request #9747 from awakesecurity/mz/fix-quadratic-splitStringeldritch horrors
Fix performance of builtins.substring for empty substrings (cherry picked from commit b2deff1947c2fe57fdbf1a472eb9003eb407f8d3) Change-Id: I4ddfc8d26a4781c9520fff9807849a073ee7bed8
2024-03-04Merge pull request #8043 from bobvanderlinden/pr-shell-enveldritch horrors
nix: develop: use SHELL from rc script (cherry picked from commit 0d55d660d5ea081630aa9606b047eb755cff1528) Change-Id: I83be6c63b282d7f01a0defa78d9e787c77f1f02d
2024-03-04Merge pull request #9648 from cole-h/nix-shell-orderingeldritch horrors
nix shell: reflect command line order in PATH order (cherry picked from commit b91c935c2faf08ced2c763dcd2a831f26d84fa86) Change-Id: If16c120bb74857c2817366e74e5b0877eb997260
2024-03-04Merge pull request #9662 from shlevy/flat-fixed-references-asserteldritch horrors
Improve error message for fixed-outputs with references. (cherry picked from commit ff6de4a9ee6c3862db9ee5f09ff9c3f43ae7a088) Change-Id: I733c49760b9a3f1b76a6bece3b250b8579cd6cac
2024-03-04Merge pull request #9617 from 9999years/stack-overflow-segfaulteldritch horrors
Fix segfault on infinite recursion in some cases (cherry picked from commit bf1b294bd81ca76c5ec9fe3ecd52196bf52a8300) Change-Id: Id137541426ec8536567835953fccf986a3aebf16
2024-03-04Merge pull request #9637 from 9999years/fix-logging-test-on-macoseldritch horrors
Fix `logging.sh` test on macOS (cherry picked from commit 94a03a810e948f65776c3386d9a5234db551dc9e) Change-Id: I65dde18ee53ccded31790e0cf1f836c3ad6dc492
2024-03-04Merge pull request #9619 from 9999years/remove-blank-lines-in-errorseldritch horrors
Remove some blank lines from stack traces (cherry picked from commit cea83544362bd6426e9bc0b7dd0d611c19b0e3fd) Change-Id: Ic1af8b09e9994d3c69fd3b37ae47a4bb786a15a1