aboutsummaryrefslogtreecommitdiff
path: root/tests
AgeCommit message (Collapse)Author
2023-09-01Merge branch 'master' into valid_deriver_2Eelco Dolstra
2023-09-01Merge pull request #8869 from hercules-ci/fix-issue-8838-pathExists-isDirEelco Dolstra
Fix #8838, pathExists: isDir when ends with `/ `
2023-08-29Merge pull request #8859 from edolstra/tarball-last-modifiedEelco Dolstra
Tarball trees: Propagate lastModified
2023-08-25pathExists: isDir when endswith /Robert Hensing
Fixes https://github.com/NixOS/nix/issues/8838
2023-08-25tests/lang/eval-okay-pathexists: Add casesRobert Hensing
2023-08-25Merge pull request #8829 from obsidiansystems/build-dynamic-derivationsJohn Ericson
Adapt scheduler to work with dynamic derivations
2023-08-25Merge pull request #8819 from VertexA115/fix/deep-follow-pathstomberek
Fix follow path checking at depths greater than 2
2023-08-25Merge pull request #8661 from hercules-ci/test-reformat-error-messageJohn Ericson
tests: Reformat exit code error message
2023-08-25Adapt scheduler to work with dynamic derivationsJohn Ericson
To avoid dealing with an optional `drvPath` (because we might not know it yet) everywhere, make an `CreateDerivationAndRealiseGoal`. This goal just builds/substitutes the derivation file, and then kicks of a build for that obtained derivation; in other words it does the chaining of goals when the drv file is missing (as can already be the case) or computed (new case). This also means the `getDerivation` state can be removed from `DerivationGoal`, which makes the `BasicDerivation` / in memory case and `Derivation` / drv file file case closer together. The map type is factored out for clarity, and because we will soon hvae a second use for it (`Derivation` itself). Co-authored-by: Robert Hensing <roberth@users.noreply.github.com>
2023-08-24add nix-store --query --valid-derivers commandGuillaume Girol
notably useful when nix-store --query --deriver returns a non-existing path. Co-authored-by: Felix Uhl <iFreilicht@users.noreply.github.com>
2023-08-22Tarball trees: Propagate lastModifiedEelco Dolstra
This makes them behave consistently with GitHub/GitLab flakes.
2023-08-18test/flakes/follow-paths.sh: QuoteRobert Hensing
Co-authored-by: Alex Ameen <alex.ameen.tx@gmail.com>
2023-08-17Test repl formatting with and without :pFelix Uhl
2023-08-15Update tests/flakes/follow-paths.shVertex
Co-authored-by: Robert Hensing <roberth@users.noreply.github.com>
2023-08-14Fix follow path checking at depths greater than 2Alex Zero
We need to recurse into the input tree to handle follows paths that trarverse multiple inputs that may or may not be follow paths themselves.
2023-08-14Create `outputOf` primop.John Ericson
In the Nix language, given a drv path, we should be able to construct another string referencing to one of its output. We can do this today with `(import drvPath).output`, but this only works for derivations we already have. With dynamic derivations, however, that doesn't work well because the `drvPath` isn't yet built: importing it like would need to trigger IFD, when the whole point of this feature is to do "dynamic build graph" without IFD! Instead, what we want to do is create a placeholder value with the right string context to refer to the output of the as-yet unbuilt derivation. A new primop in the language, analogous to `builtins.placeholder` can be used to create one. This will achieve all the right properties. The placeholder machinery also will match out the `outPath` attribute for CA derivations works. In 60b7121d2c6d4322b7c2e8e7acfec7b701b2d3a1 we added that type of placeholder, and the derived path and string holder changes necessary to support it. Then in the previous commit we cleaned up the code (inspiration finally hit me!) to deduplicate the code and expose exactly what we need. Now, we can wire up the primop trivally! Part of RFC 92: dynamic derivations (tracking issue #6316) Co-authored-by: Robert Hensing <roberth@users.noreply.github.com>
2023-08-11Merge pull request #8369 from obsidiansystems/inductive-derived-pathtomberek
Make the Derived Path family of types inductive for dynamic derivations
2023-08-10Make the Derived Path family of types inductive for dynamic derivationsJohn Ericson
We want to be able to write down `foo.drv^bar.drv^baz`: `foo.drv^bar.drv` is the dynamic derivation (since it is itself a derivation output, `bar.drv` from `foo.drv`). To that end, we create `Single{Derivation,BuiltPath}` types, that are very similar except instead of having multiple outputs (in a set or map), they have a single one. This is for everything to the left of the rightmost `^`. `NixStringContextElem` has an analogous change, and now can reuse `SingleDerivedPath` at the top level. In fact, if we ever get rid of `DrvDeep`, `NixStringContextElem` could be replaced with `SingleDerivedPath` entirely! Important note: some JSON formats have changed. We already can *produce* dynamic derivations, but we can't refer to them directly. Today, we can merely express building or example at the top imperatively over time by building `foo.drv^bar.drv`, and then with a second nix invocation doing `<result-from-first>^baz`, but this is not declarative. The ethos of Nix of being able to write down the full plan everything you want to do, and then execute than plan with a single command, and for that we need the new inductive form of these types. Co-authored-by: Robert Hensing <roberth@users.noreply.github.com> Co-authored-by: Valentin Gagarin <valentin.gagarin@tweag.io>
2023-08-09Try to realise CA derivations during queryMissingPeter Waller
This enables nix to correctly report what will be fetched in the case that everything is a cache hit. Note however that if an intermediate build of something which is not cached could still cause products to end up being substituted if the intermediate build results in a CA path which is in the cache. Fixes #8615. Signed-off-by: Peter Waller <p@pwaller.net>
2023-08-08Merge pull request #8805 from tweag/fix-add-to-store-existingThéophane Hufschmitt
[V2] Fix misread of source if path is already valid
2023-08-08Test the parallel copy over ssh-ngThéophane Hufschmitt
Regression test for https://github.com/NixOS/nix/issues/6253
2023-08-07Merge pull request #8786 from Ma27/fix-why-depends-preciseEelco Dolstra
nix/why-depends: fix output of `--precise`
2023-08-07Merge pull request #8322 from tweag/stabilize-discard-referencesThéophane Hufschmitt
Stabilize `discard-references`
2023-08-07Stabilize `discard-references`Théophane Hufschmitt
It has been there for a few releases now (landed in 2.14.0), doesn't seem to cause any major issue and is wanted in a few places (https://github.com/NixOS/nix/pull/7087#issuecomment-1544471346).
2023-08-04nix/why-depends: fix output of `--precise`Maximilian Bosch
I haven't checked when this was exactly introduced, but on Nix 2.16 I realized that the additional lines inserted when using `--precise` are completely separated from the tree: nix why-depends /nix/store/ccgr4faaxys39s091qridxg1947lggh4-evcxr-0.14.2 /nix/store/b7hvml0m3qmqraz1022fwvyyg6fc1vdy-gcc-12.2.0 --precise --extra-experimental-features nix-command /nix/store/ccgr4faaxys39s091qridxg1947lggh4-evcxr-0.14.2 → /nix/store/lcf37pgp3rgww67v9x2990hbfwx96c1w-gcc-wrapper-12.2.0 → /nix/store/b7hvml0m3qmqraz1022fwvyyg6fc1vdy-gcc-12.2.0 └───bin/evcxr: …':'}.PATH=${PATH/':''/nix/store/lcf37pgp3rgww67v9x2990hbfwx96c1w-gcc-wrapper-12.2.0/bin'':'/':'}… └───bin/cpp: …k disable=SC2193.[[ "/nix/store/b7hvml0m3qmqraz1022fwvyyg6fc1vdy-gcc-12.2.0/bin/cpp" = *++ ]] &&… This is apparently because `std::cout` is buffered and flushed in the end whereas the rest of the output isn't. The fix is rather simple, just use `logger->cout` as it's already the case for the rest of the code. This way we also don't need to insert additional newlines in the `hits` map since that's something the logger takes care of. Also added a small test to make sure that the layout of this is somehow tested to reduce the risk of further regressions here.
2023-08-01Don't require .tar/.zip extension for tarball flakerefsEelco Dolstra
Special-casing the file name is rather ugly, so we shouldn't do that. So now any {file,http,https} URL is handled by TarballInputScheme, except for non-flake inputs (i.e. inputs that have the attribute `flake = false`).
2023-07-31toJSON: Add attribute path to traceRobert Hensing
2023-07-25Add `parseFlakeRef` and `flakeRefToString` builtins (#8670)Alex Ameen
Over the last year or so I've run into several use cases where I need to parse and/or serialize URLs for use by `builtins.fetchTree` or `builtins.getFlake`, largely in order to produce _lockfile-like_ files for lang2nix frameworks or tools which use `nix` internally to drive builds. I've gone through the painstaking process of emulating `nix::FlakeRef::fromAttrs` and `nix::parseFlakeRef` several times with mixed success; but these are difficult to create and even harder to maintain if I hope to stay aligned with changes to the real parser/serializer. I understand why adding new `builtins` isn't something we want to do flagrantly. I'm recommending this addition simply because I keep encountering use cases where I need to parse/serialize these URIs in `nix` expressions, and I want a reliable solution. Co-authored-by: Eelco Dolstra <edolstra@gmail.com> Co-authored-by: John Ericson <git@JohnEricson.me>
2023-07-21parser: merge nested dynamic attributesNaïm Favier
Fixes https://github.com/NixOS/nix/issues/7115
2023-07-19Merge pull request #8680 from NixLayeredStore/test-groupsJohn Ericson
Introduce notion of a test group, use for CA tests
2023-07-18Merge pull request #8506 from corngood/ssh-masterRobert Hensing
Pass NIX_SSHOPTS when checking for an ssh master connection.
2023-07-18Introduce notion of a test group, use for CA testsJohn Ericson
Grouping our tests should make it easier to understand the intent than one long poorly-arranged list. It also is convenient for running just the tests for a specific component when working on that component. We need at least one test group so this isn't dead code; I decided to collect the tests for the `ca-derivations` and `dynamic-derivations` experimental features in groups. Do ```bash make ca.test-group -jN ``` and ```bash make dyn-drv.test-group -jN ``` to try running just them. I originally did this as part of #8397 for being able to just the local overlay store alone. I am PRing it separately now so we can separate general infra from new features. Co-authored-by: Valentin Gagarin <valentin.gagarin@tweag.io>
2023-07-17Merge pull request #8342 from NixLayeredStore/best-effort-supplementary-groupsThéophane Hufschmitt
Best effort supplementary groups
2023-07-14Test nested sandboxing, and make nicer errorJohn Ericson
We were bedeviled by sandboxing issues when working on the layered store. The problem ended up being that when we have nested nix builds, and the inner store is inside the build dir (e.g. store is `/build/nix-test/$name/store`, build dir is `/build`) bind mounts clobber each other and store paths cannot be found. After thoroughly cleaning up `local-derivation-goal.cc`, we might be able to make that work. But that is a lot of work. For now, we just fail earlier with a proper error message. Finally, test this: nested sandboxing without the problematic store dir should work, and with should fail with the expected error message. Co-authored-by: Dylan Green <67574902+cidkidnix@users.noreply.github.com> Co-authored-by: Robert Hensing <roberth@users.noreply.github.com>
2023-07-13move unset NIX_STORE_DIR in supplementary-groups.shcidkidnix
to inside the unshare
2023-07-13Add comment regarding the unset of NIX_STORE_DIRcidkidnix
in build-remote.sh and supplementary-groups.sh
2023-07-13Revert "Skip build-remote-trustless unless sandbox is supported."John Ericson
This reverts commit 41412dc4ae0fec2d08335c19724276d99e0c6056.
2023-07-13Revert "Check _NIX_TEST_NO_SANDBOX when setting _canUseSandbox."John Ericson
This reverts commit c1d39de1fbceebbb6b46abc4a21fb8e34423df99.
2023-07-13Merge remote-tracking branch 'upstream/master' into ↵John Ericson
best-effort-supplementary-groups
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-07-11Skip build-remote-trustless unless sandbox is supported.Ben Radford
2023-07-11Check _NIX_TEST_NO_SANDBOX when setting _canUseSandbox.Ben Radford
2023-07-11Always attempt setgroups but allow failure to be ignored.Ben Radford
2023-07-11Merge remote-tracking branch 'origin/master' into ↵Ben Radford
best-effort-supplementary-groups
2023-07-10Fix test file nameJohn Ericson
It's UTF-8, not UFT-8.
2023-07-09Merge pull request #8370 from hercules-ci/fetchClosure-input-addressedJohn Ericson
`fetchClosure`: input addressed and pure
2023-07-07signing.sh: Revert test improvement because it fails on GHA + macOSRobert Hensing
2023-07-07tests: Reformat exit code error messageRobert Hensing
Now looks like: Expected exit code '123' but got '0' from command 'echo' 'hi'
2023-07-03Fix testEelco Dolstra