aboutsummaryrefslogtreecommitdiff
path: root/tests
AgeCommit message (Collapse)Author
2024-04-18tests: unhaunt the flakes nixos testseldritch horrors
these should really wait for networks to come up, otherwise they can fail. fixes #235 Change-Id: I08989e8bdb0de280df74660ac43983de5c34fa9d
2024-04-16Merge "libstore/build: set NO_NEW_PRIVS for the sandbox" into mainIlya K
2024-04-15abort with a descriptive message on bad HintFmt usageQyriad
Change-Id: Ic2f05572042343a8160fd971394372f5f2706fc4
2024-04-15libstore/build: set NO_NEW_PRIVS for the sandboxK900
Change-Id: I711f64e2b68495ed9c85c1a4bd5025405805e43a
2024-04-13libstore/build: just copy the magic /etc files into the sandboxK900
Saves us a bunch of thinking about how to handle symlinks, and prevents the DNS config from changing on the fly under the build, which may or may not be a good thing? Change-Id: I071e6ae7e220884690b788d94f480866f428db71
2024-04-11Merge pull request #10456 from NixOS/fixpermdeniedbindThéophane Hufschmitt
Fix adding symlink to the sandbox paths (cherry-picked from commit da1e977bf48cff2a635034c85e7c13878e38efc2) Change-Id: I221c85a38180800ec6552d2e86a88df48398fad8
2024-04-09Print top-level errors normally in `nix repl`Rebecca Turner
Previously, errors while printing values in `nix repl` would be printed in `«error: ...»` brackets rather than displayed normally: ``` nix-repl> legacyPackages.aarch64-darwin.pythonPackages.APScheduler «error: Package ‘python-2.7.18.7’ in /nix/store/6s0m1qc31zw3l3kq0q4wd5cp3lqpkq0q-source/pkgs/development/interpreters/python/cpython/2.7/default.nix:335 is marked as insecure, refusing to evaluate.» ``` Now, errors will be displayed normally if they're emitted at the top-level of an expression: ``` nix-repl> legacyPackages.aarch64-darwin.pythonPackages.APScheduler error: … in the condition of the assert statement at /nix/store/6s0m1qc31zw3l3kq0q4wd5cp3lqpkq0q-source/lib/customisation.nix:268:17: 267| in commonAttrs // { 268| drvPath = assert condition; drv.drvPath; | ^ 269| outPath = assert condition; drv.outPath; … in the left operand of the OR (||) operator at /nix/store/6s0m1qc31zw3l3kq0q4wd5cp3lqpkq0q-source/pkgs/development/interpreters/python/passthrufun.nix:28:45: 27| if lib.isDerivation value then 28| lib.extendDerivation (valid value || throw "${name} should use `buildPythonPackage` or `toPythonModule` if it is to be part of the Python packages set.") {} value | ^ 29| else (stack trace truncated; use '--show-trace' to show the full trace) error: Package ‘python-2.7.18.7’ in /nix/store/6s0m1qc31zw3l3kq0q4wd5cp3lqpkq0q-source/pkgs/development/interpreters/python/cpython/2.7/default.nix:335 is marked as insecure, refusing to evaluate. ``` Errors emitted in nested structures (like e.g. when printing `nixpkgs`) will still be printed in brackets. Change-Id: I25aeddf08c017582718cb9772a677bf51b9fc2ad
2024-04-09Merge "Add `repl-overlays`" into mainrebecca “wiggles” turner
2024-04-08Add `repl-overlays`Rebecca Turner
Adds a `repl-overlays` option, which specifies files that can overlay and modify the top-level bindings in `nix repl`. For example, with the following contents in `~/.config/nix/repl.nix`: info: final: prev: let optionalAttrs = predicate: attrs: if predicate then attrs else {}; in optionalAttrs (prev ? legacyPackages && prev.legacyPackages ? ${info.currentSystem}) { pkgs = prev.legacyPackages.${info.currentSystem}; } We can run `nix repl` and use `pkgs` to refer to `legacyPackages.${currentSystem}`: $ nix repl --repl-overlays ~/.config/nix/repl.nix nixpkgs Lix 2.90.0 Type :? for help. Loading installable 'flake:nixpkgs#'... Added 5 variables. Loading 'repl-overlays'... Added 6 variables. nix-repl> pkgs.bash «derivation /nix/store/g08b5vkwwh0j8ic9rkmd8mpj878rk62z-bash-5.2p26.drv» Change-Id: Ic12e0f2f210b2f46e920c33088dfe1083f42391a
2024-04-08"but doctor, I AM the untrusted store": nix doctor had wrong trustednessJade Lovelace
This probably snuck in in a refactor using truthiness or so. The trustedness flag was having the optional fullness checked, rather than the actual contained trust level. Also adds some tests. ``` m1@6876551b-255d-4cb0-af02-8a4f17b27e2e ~ % nix store ping warning: 'nix store ping' is a deprecated alias for 'nix store info' Store URL: daemon Version: 2.20.4 Trusted: 0 m1@6876551b-255d-4cb0-af02-8a4f17b27e2e ~ % nix doctor warning: 'doctor' is a deprecated alias for 'config check' [PASS] PATH contains only one nix version. [PASS] All profiles are gcroots. [PASS] Client protocol matches store protocol. [INFO] You are trusted by store uri: daemon ``` Fixes: https://git.lix.systems/lix-project/lix/issues/232 Change-Id: I21576e2a0a755036edf8814133345987617ba3d0
2024-04-08Merge "Don't run libstore unit tests in project root" into mainrebecca “wiggles” turner
2024-04-08Don't run libstore unit tests in project rootRebecca Turner
This keeps the libstore unit tests from writing `libstore-unit-tests.xml` to the project root. Change-Id: I0d9909aabf9f3574cc1e72a5ae81daefba9a394b
2024-04-08Fix REPL test parser nitsRebecca Turner
Follow-up to https://gerrit.lix.systems/c/lix/+/546 Change-Id: Ie603f01e5520329bf879e061cea9e3fba45213fd
2024-04-08Merge "Rename some parse failure tests to `parse-fail-*`" into mainrebecca “wiggles” turner
2024-04-08Merge "Add `PathsSetting`" into mainrebecca “wiggles” turner
2024-04-07Merge pull request #10208 from 9999years/print-strings-directlyRobert Hensing
`:print` strings directly in `nix repl` (cherry picked from commit 3539172fd2f7cee639ce46423c58beca4231f2db) Change-Id: I1972f3bf3b56312851f38288509d371d37f21677 Upstream-PR: https://github.com/NixOS/nix/pull/10208
2024-04-07Add `PathsSetting`Rebecca Turner
Change-Id: I1165f6ef033a5f757ca3716d3f8008ba36b01fd0
2024-04-06Merge "Rewrite REPL test parser" into mainrebecca “wiggles” turner
2024-04-06Merge "meson: add missing tests: ca, dyn-drv, plugins, libstoreconsumer" ↵Qyriad
into main
2024-04-05Merge changes I1fa30114,I3ca208b6,Ide4c6e00,I74c46b9f,I05fa6a9d, ... into maineldritch horrors
* changes: Revert "libutil: drop Pool resources on exceptional free" Revert "libutil: remove Pool::Handle::bad" Revert "libstore: remove one Resource::good flag" Revert "libstore: using throwing finally in withFramedSink" Revert "libutil: allow graceful dropping of Pool::Handle" Revert "libutil: drop Fs{Source,Sink}::good" libutil: guard Finally against invalid exception throws
2024-04-05Merge "meson: run repl characterization test" into mainQyriad
2024-04-05Rewrite REPL test parserRebecca Turner
- Use a recursive descent parser so that it's easy to extend. - Add `@args` to enable customizing command-line arguments - Add `@should-start` to enable `nix repl` tests that error before entering the REPL - Make sure to read all stdout output before comparing. This catches some extra output we were tossing out before! Change-Id: I5522555df4c313024ab15cd10f9f04e7293bda3a
2024-04-05Revert "libutil: drop Pool resources on exceptional free"eldritch horrors
This reverts commit de2884b82b376d10de5c400d8e73bc7d98f195d2. Change-Id: I1fa301149d7c2ed3d266a40c15b2d010e12e44e6
2024-04-04meson: add missing tests: ca, dyn-drv, plugins, libstoreconsumerQyriad
Change-Id: I6a74ebaf93697cb99aadd6b51538c2766b0a808a
2024-04-04Rename some parse failure tests to `parse-fail-*`Rebecca Turner
These were mistakenly labeled `eval-fail-*`. Note that the `lang.sh` runner passes `parse-fail-*` tests on stdin, so filenames are removed from error messages. Change-Id: I7f3a0d78b6cfa87af29aaa1b7af19d5a57fd4ade
2024-04-03meson: run repl characterization testQyriad
This was mistakenly left out of 69c3363f2. Fixes #205. Change-Id: Ib9a2088c9eee3a192623bee107ba32221d048640
2024-04-03Make `repl_characterization.cc` constants `string_view`sRebecca Turner
Change-Id: I96455ee365799ae87d9ab433cf102c691616a45e
2024-04-03Add `EscapeStringOptions` and `escapeString` testsRebecca Turner
Change-Id: I86ead2f969c9e03c9edfa51bbc92ee06393fd7d6
2024-03-31Merge pull request #9920 from 9999years/forbid-nested-debuggersThéophane Hufschmitt
Forbid nested debuggers (cherry picked from commit e164b39ee90fd655dbb7f479fdd4fbe38cc883bd) Change-Id: Iff62f40fd251116516a63e2d3f9fb5b21480b16d
2024-03-31Merge changes Ib62d3d68,Ic3e7affe into mainjade
* changes: Make things that can throw not noexcept anymore Fix various clang-tidy lints
2024-03-31libutil: remove Pool::flushBadeldritch horrors
this was never actually used, and bad design in the first place—why should a bad resource be put back into the idle pool? just drop it. Change-Id: Idab8774bee19dadae0209d404c4fb86dd4aeba1e
2024-03-30libutil: drop Pool resources on exceptional freeeldritch horrors
if a scope owning a resource does not gracefully drop that resource while handling exceptions from deeper down the call stack we should assume the resource is invalid state and drop it. currently it *is* true that such cases do not cause resources to be freed, but thanks to validator misuses this has so far not caused any larger problem. Change-Id: Ie4f91bcd60a64d05c5ff9d22cc97954816d13b97
2024-03-29Add `pre-commit` checksRebecca Turner
The big ones here are `trim-trailing-whitespace` and `end-of-file-fixer` (which makes sure that every file ends with exactly one newline character). Change-Id: Idca73b640883188f068f9903e013cf0d82aa1123
2024-03-29Fix various clang-tidy lintsJade Lovelace
* some things that can throw are marked noexcept yet the linter seems to think not. Maybe they can't throw in practice. I would rather not have the UB possibility in pretty obvious cold paths. * various default-case-missing complaints * a fair pile of casts from integer to character, which are in fact deliberate. * an instance of <https://clang.llvm.org/extra/clang-tidy/checks/bugprone/move-forwarding-reference.html> * bugprone-not-null-terminated-result on handing a string to curl in chunks of bytes. our usage is fine. * reassigning a unique_ptr by CRIMES instead of using release(), then using release() and ignoring the result. wild. let's use release() for its intended purpose. Change-Id: Ic3e7affef12383576213a8a7c8145c27e662513d
2024-03-29Move `escapeString` to its own fileRebecca Turner
Change-Id: Ie5c954ec73c46c9d3c679ef99a83a29cc7a08352
2024-03-29meson: add missing explicit dependency on nlohmann_jsonWinter
Without this, the Meson setup won't bail out if nlohmann_json is missing, leading to subpar DX (and maybe worse, but I'm not entirely sure). Change-Id: I5913111060226b540dcf003257c99a08e84da0de
2024-03-29Merge "Move `DebugChar` into its own file" into mainrebecca “wiggles” turner
2024-03-29meson: increase functional test timeouteldritch horrors
sometimes these fail with timeouts on loaded machines. let's up the timeouts until we can pull the tests apart to more reasonable sizes Change-Id: I2dfff2183cc1f3ff5e6107f43748ac046fe00d05
2024-03-29Merge "Remove `HintFmt::operator%`" into mainwiggles dog
2024-03-28Move `DebugChar` into its own fileRebecca Turner
Change-Id: Ia40549e5d0b78ece8dd0722c3a5a032b9915f24b
2024-03-28Merge "Move `shell_words` into its own file" into mainwiggles dog
2024-03-27meson: implement functional testsQyriad
Functional tests can be run with `meson test -C build --suite installcheck`. Notably, functional tests must be run *after* running `meson install` (Lix's derivation runs the installcheck suite in installCheckPhase so it does this correctly), due to some quirks between Meson and the testing system. As far as I can tell the functional tests are meant to be run after installing anyway, but unfortunately I can't transparently make `meson test --suite installcheck` depend on the install targets. The script that runs the functional tests, meson/run-test.py, checks that `meson install` has happened and fails fast with a (hopefully) helpful error message if any of the functional tests are run before installing. TODO: this change needs reflection in developer documentation Change-Id: I8dcb5fdfc0b6cb17580973d24ad930abd57018f6
2024-03-27HOT SALE: 15% off your build times!Jade Lovelace
This was achieved by running maintainers/buildtime_report.sh on the build directory of a meson build, then asking "why the heck is json eating our build times", and strategically moving the json using bits out of widely included headers. It turns out that putting literally any metrics whatsoever into the build had immediate and predictable results. Results are 1382.5s frontend time -> 1175.4s frontend time, back end time approximately invariant. Related: https://git.lix.systems/lix-project/lix/issues/159 Change-Id: I7edea95c8536203325c8bb4dae5f32d727a21b2d
2024-03-26Move `shell_words` into its own fileRebecca Turner
Change-Id: I34c0ebfb6dcea49bf632d8880e04075335a132bf
2024-03-26Remove `HintFmt::operator%`Rebecca Turner
Change-Id: Ibcf1a7848b4b18ec9b0807628ff229079ae7a0fe
2024-03-26Merge "meson: implement unit tests" into mainQyriad
2024-03-26meson: implement unit testsQyriad
Unit tests can be run with `meson test -C build --suite check`. `--suite check` is optional, as right now that's the only test suite, but when functional tests are added those will be in a separate suite. Change-Id: I7f22f1cde4b489b3cdb5f9a36a544f0c409fcc1f
2024-03-25Merge pull request #8817 from iFreilicht/flake-update-lock-overhaulThéophane Hufschmitt
Overhaul `nix flake update` and `nix flake lock` UX (cherry picked from commit 12a0ae73dbb37becefa5a442eb4532ff0de9ce65) Change-Id: Iff3b4f4235ebb1948ec612036b39ab29e4ca22b2
2024-03-25feat: notation to refer to no attribute search prefixTom Bereknyei
An attrPath prefix of "." indicates no need to try default attrPath prefixes. For example `nixpkgs#legacyPackages.x86_64-linux.ERROR` searches through ``` trying flake output attribute 'packages.x86_64-linux.legacyPackages.x86_64-linux.ERROR' using cached attrset attribute '' trying flake output attribute 'legacyPackages.x86_64-linux.legacyPackages.x86_64-linux.ERROR' using cached attrset attribute 'legacyPackages.x86_64-linux' trying flake output attribute 'legacyPackages.x86_64-linux.ERROR' using cached attrset attribute 'legacyPackages.x86_64-linux' ``` And there is no way to specify that one does not want the automatic search behavior. Now one can specify `nixpkgs#.legacyPackages.x86_64-linux.ERROR` to only refer to the rooted attribute path without any default injection of attribute search path or system. Change-Id: Iac1334e1470137b7ce11dcf845513810230638ec (cherry picked from commit d4aed18883b361133607296fb6cd789c47427a38)
2024-03-24Improve new CLI UX by supporting short `-E` flag for `--expr`Lunaphied
Change-Id: I55881c846da8416a92a14deedfa5bbbf09a122fb