aboutsummaryrefslogtreecommitdiff
path: root/tests
AgeCommit message (Collapse)Author
2019-10-21Add experimental-features settingEelco Dolstra
Experimental features are now opt-in. There is currently one experimental feature: "nix-command" (which enables the "nix" command. This will allow us to merge experimental features more quickly, without committing to supporting them indefinitely. Typical usage: $ nix build --experimental-features 'nix-command flakes' nixpkgs#hello (cherry picked from commit 8e478c234100cf03ea1b777d4bd42a9be7be9e8c, without the "flakes" feature)
2019-10-09nix-env: Create ~/.nix-profile automaticallyEelco Dolstra
2019-10-09nix-profile.sh: Don't create .nix-channelsEelco Dolstra
This is already done by the installer, so no need to do it again.
2019-10-09Remove world-writability from per-user directoriesEelco Dolstra
'nix-daemon' now creates subdirectories for users when they first connect. Fixes #509 (CVE-2019-17365). Should also fix #3127.
2019-09-18function-trace: always show the tracezimbatm
If the user invokes nix with --trace-function-calls it means that they want to see the trace.
2019-09-04gc-auto.sh: Increase sleep timeEelco Dolstra
2019-09-03gc-auto.sh: More test fixesEelco Dolstra
2019-09-03gc-auto.sh: Add some more instrumentationEelco Dolstra
2019-08-29Don't rely on st_blocksEelco Dolstra
It doesn't seem very reliable on ZFS.
2019-08-29Maybe fix #3058Eelco Dolstra
2019-08-29Add some more instrumentationEelco Dolstra
2019-08-28gc-auto.sh: Increase verbosityEelco Dolstra
2019-08-27Hopefully fix post-hook test on macOSEelco Dolstra
https://hydra.nixos.org/build/99262744
2019-08-15Merge pull request #2782 from grahamc/flamesEelco Dolstra
Track function start and end
2019-08-14Track function start and ends for flame graphsGraham Christensen
With this patch, and this file I called `log.py`: #!/usr/bin/env nix-shell #!nix-shell -i python3 -p python3 --pure import sys from pprint import pprint stack = [] timestack = [] for line in open(sys.argv[1]): components = line.strip().split(" ", 2) if components[0] != "function-trace": continue direction = components[1] components = components[2].rsplit(" ", 2) loc = components[0] _at = components[1] time = int(components[2]) if direction == "entered": stack.append(loc) timestack.append(time) elif direction == "exited": dur = time - timestack.pop() vst = ";".join(stack) print(f"{vst} {dur}") stack.pop() and: nix-instantiate --trace-function-calls -vvvv ../nixpkgs/pkgs/top-level/release.nix -A unstable > log.matthewbauer 2>&1 ./log.py ./log.matthewbauer > log.matthewbauer.folded flamegraph.pl --title matthewbauer-post-pr log.matthewbauer.folded > log.matthewbauer.folded.svg I can make flame graphs like: http://gsc.io/log.matthewbauer.folded.svg --- Includes test cases around function call failures and tryEval. Uses RAII so the finish is always called at the end of the function.
2019-08-08tests/post-hook.sh: Don't put result link in cwdEelco Dolstra
2019-08-08Rename file for consistencyEelco Dolstra
2019-08-07Merge pull request #2995 from tweag/post-build-hookEelco Dolstra
Add a post build hook
2019-08-02Add a test for auto-GCEelco Dolstra
This currently fails because we're using POSIX file locks. So when the garbage collector opens and closes its own temproots file, it causes the lock to be released and then deleted by another GC instance.
2019-08-02Add a post-build-hookregnat
Passing `--post-build-hook /foo/bar` to a nix-* command will cause `/foo/bar` to be executed after each build with the following environment variables set: DRV_PATH=/nix/store/drv-that-has-been-built.drv OUT_PATHS=/nix/store/...build /nix/store/...build-bin /nix/store/...build-dev This can be useful in particular to upload all the builded artifacts to the cache (including the ones that don't appear in the runtime closure of the final derivation or are built because of IFD). This new feature prints the stderr/stdout output to the `nix-build` and `nix build` client, and the output is printed in a Nix 2 compatible format: [nix]$ ./inst/bin/nix-build ./test.nix these derivations will be built: /nix/store/ishzj9ni17xq4hgrjvlyjkfvm00b0ch9-my-example-derivation.drv building '/nix/store/ishzj9ni17xq4hgrjvlyjkfvm00b0ch9-my-example-derivation.drv'... hello! bye! running post-build-hook '/home/grahamc/projects/github.com/NixOS/nix/post-hook.sh'... post-build-hook: + sleep 1 post-build-hook: + echo 'Signing paths' /nix/store/qr213vjmibrqwnyp5fw678y7whbkqyny-my-example-derivation post-build-hook: Signing paths /nix/store/qr213vjmibrqwnyp5fw678y7whbkqyny-my-example-derivation post-build-hook: + sleep 1 post-build-hook: + echo 'Uploading paths' /nix/store/qr213vjmibrqwnyp5fw678y7whbkqyny-my-example-derivation post-build-hook: Uploading paths /nix/store/qr213vjmibrqwnyp5fw678y7whbkqyny-my-example-derivation post-build-hook: + sleep 1 post-build-hook: + printf 'very important stuff' /nix/store/qr213vjmibrqwnyp5fw678y7whbkqyny-my-example-derivation [nix-shell:~/projects/github.com/NixOS/nix]$ ./inst/bin/nix build -L -f ./test.nix my-example-derivation> hello! my-example-derivation> bye! my-example-derivation (post)> + sleep 1 my-example-derivation (post)> + echo 'Signing paths' /nix/store/c263gzj2kb2609mz8wrbmh53l14wzmfs-my-example-derivation my-example-derivation (post)> Signing paths /nix/store/c263gzj2kb2609mz8wrbmh53l14wzmfs-my-example-derivation my-example-derivation (post)> + sleep 1 my-example-derivation (post)> + echo 'Uploading paths' /nix/store/c263gzj2kb2609mz8wrbmh53l14wzmfs-my-example-derivation my-example-derivation (post)> Uploading paths /nix/store/c263gzj2kb2609mz8wrbmh53l14wzmfs-my-example-derivation my-example-derivation (post)> + sleep 1 my-example-derivation (post)> + printf 'very important stuff' [1 built, 0.0 MiB DL] Co-authored-by: Graham Christensen <graham@grahamc.com> Co-authored-by: Eelco Dolstra <edolstra@gmail.com>
2019-07-30Merge pull request #3013 from basvandijk/disable-lsof-for-darwin-testsEelco Dolstra
Disable findRuntimeRoots on darwin when running tests because lsof is slow
2019-07-30Disable findRuntimeRoots on darwin when running tests because lsof is slowBas van Dijk
See: https://github.com/NixOS/nix/issues/3011
2019-07-30Allow builtins.pathExists to check the existence of /nix/store pathsBas van Dijk
This makes it consitent with builtins.readDir.
2019-07-25Use $HOME instead of $USERMatthew Bauer
$USER/.nix-profile will not be a path. I think $HOME/.nix-profile was the origininal intent. /cc @Grahamc
2019-07-02timeout: test for error codeGraham Christensen
2019-07-02build: replace 100 offset for build exit codesDaiderd Jordan
2019-07-02build: add tests for --check status codesDaiderd Jordan
2019-06-24Fix abort in fromTOMLEelco Dolstra
Fixes #2969.
2019-06-24Add more fromTOML testsEelco Dolstra
2019-06-15Fix test failures when $TMPDIR changesEelco Dolstra
(cherry picked from commit c38c726eb5d447c7e9d894d57cd05ac46c173ddd)
2019-06-01Fix segfault in builtin fetchurl with hashed mirrors + SRI hashesEelco Dolstra
2019-05-29Enable more fromTOML testsEelco Dolstra
cpptoml now parses almost all examples from the spec.
2019-05-29Fix eval-okay-fromTOML testEelco Dolstra
Turns out we were mis-parsing single-quoted attributes, e.g. 'key2'.
2019-05-28Merge branch 'attrPaths' of https://github.com/NinjaTrappeur/nixEelco Dolstra
2019-05-12build: add test for sandboxed --checkDaiderd Jordan
2019-05-08fix hashfile test that wasn't failing due to eval lazinessWill Dietz
See: https://github.com/NixOS/nix/commit/7becb1bf1c2ec1544a5374580a97b36273506baf#r33450554
2019-05-03Add builtins.hashFileDaniel Schaefer
For text files it is possible to do it like so: `builtins.hashString "sha256" (builtins.readFile /tmp/a)` but that doesn't work for binary files. With builtins.hashFile any kind of file can be conveniently hashed.
2019-03-27Update eval-okay-types.exp to match #1828Eelco Dolstra
2019-03-24Add isPath primopzimbatm
this is added for completeness' sake since all the other possible `builtins.typeOf` results have a corresponding `builtins.is<Type>`
2019-03-10Update tests to the new --roots formatGuillaume Maudoux
2019-03-04Restore --init calls in testsEelco Dolstra
2019-02-22remove noop uses of nix-store --initzimbatm
the nix-store --init command is a noop apparently
2019-01-31Add builtins.appendContext.Shea Levy
A partner of builtins.getContext, useful for the same reasons.
2019-01-14Add builtins.getContext.Shea Levy
This can be very helpful when debugging, as well as enabling complex black magic like surgically removing a single dependency from a string's context.
2018-12-14tests/fetchurl: fix after changing default hash from 512 to 256Will Dietz
2018-12-13Support SRI hashesEelco Dolstra
SRI hashes (https://www.w3.org/TR/SRI/) combine the hash algorithm and a base-64 hash. This allows more concise and standard hash specifications. For example, instead of import <nix/fetchurl.nl> { url = https://nixos.org/releases/nix/nix-2.1.3/nix-2.1.3.tar.xz; sha256 = "5d22dad058d5c800d65a115f919da22938c50dd6ba98c5e3a183172d149840a4"; }; you can write import <nix/fetchurl.nl> { url = https://nixos.org/releases/nix/nix-2.1.3/nix-2.1.3.tar.xz; hash = "sha256-XSLa0FjVyADWWhFfkZ2iKTjFDda6mMXjoYMXLRSYQKQ="; }; In fixed-output derivations, the outputHashAlgo is no longer mandatory if outputHash specifies the hash (either as an SRI or in the old "<type>:<hash>" format). 'nix hash-{file,path}' now print hashes in SRI format by default. I also reverted them to use SHA-256 by default because that's what we're using most of the time in Nixpkgs. Suggested by @zimbatm.
2018-11-20Merge branch 'better-git-cache' of https://github.com/graham-at-target/nixEelco Dolstra
2018-11-07Enable sandboxing by defaultEelco Dolstra
Closes #179.
2018-10-27Restore old (dis)allowedRequisites behaviour for self-referencesEelco Dolstra
stdenv relies on this. So ignore self-references (but only in legacy non-structured attributes mode).
2018-10-23Per-output reference and closure size checksEelco Dolstra
In structured-attributes derivations, you can now specify per-output checks such as: outputChecks."out" = { # The closure of 'out' must not be larger than 256 MiB. maxClosureSize = 256 * 1024 * 1024; # It must not refer to C compiler or to the 'dev' output. disallowedRequisites = [ stdenv.cc "dev" ]; }; outputChecks."dev" = { # The 'dev' output must not be larger than 128 KiB. maxSize = 128 * 1024; }; Also fixed a bug in allowedRequisites that caused it to ignore self-references.