about summary refs log tree commit diff
path: root/tests
AgeCommit message (Collapse)AuthorFilesLines
2019-08-28 gc-auto.sh: Increase verbosityEelco Dolstra1-2/+2
2019-08-27 Hopefully fix post-hook test on macOSEelco Dolstra1-1/+1
https://hydra.nixos.org/build/99262744
2019-08-15 Merge pull request #2782 from grahamc/flamesEelco Dolstra2-1/+88
Track function start and end
2019-08-14 Track function start and ends for flame graphsGraham Christensen2-1/+88
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-08 tests/post-hook.sh: Don't put result link in cwdEelco Dolstra1-1/+1
2019-08-08 Rename file for consistencyEelco Dolstra2-1/+1
2019-08-07 Merge pull request #2995 from tweag/post-build-hookEelco Dolstra4-1/+22
Add a post build hook
2019-08-02 Add a test for auto-GCEelco Dolstra2-1/+62
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-02 Add a post-build-hookregnat4-1/+22
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-30 Merge pull request #3013 from basvandijk/disable-lsof-for-darwin-testsEelco Dolstra1-0/+1
Disable findRuntimeRoots on darwin when running tests because lsof is slow
2019-07-30 Disable findRuntimeRoots on darwin when running tests because lsof is slowBas van Dijk1-0/+1
See: https://github.com/NixOS/nix/issues/3011
2019-07-30 Allow builtins.pathExists to check the existence of /nix/store pathsBas van Dijk1-1/+4
This makes it consitent with builtins.readDir.
2019-07-25 Use $HOME instead of $USERMatthew Bauer1-1/+1
$USER/.nix-profile will not be a path. I think $HOME/.nix-profile was the origininal intent. /cc @Grahamc
2019-07-02 timeout: test for error codeGraham Christensen1-4/+8
2019-07-02 build: replace 100 offset for build exit codesDaiderd Jordan1-2/+2
2019-07-02 build: add tests for --check status codesDaiderd Jordan2-4/+24
2019-06-24 Fix abort in fromTOMLEelco Dolstra2-1/+8
Fixes #2969.
2019-06-24 Add more fromTOML testsEelco Dolstra2-1/+20
2019-06-15 Fix test failures when $TMPDIR changesEelco Dolstra4-10/+8
(cherry picked from commit c38c726eb5d447c7e9d894d57cd05ac46c173ddd)
2019-06-01 Fix segfault in builtin fetchurl with hashed mirrors + SRI hashesEelco Dolstra1-0/+4
2019-05-29 Enable more fromTOML testsEelco Dolstra2-17/+15
cpptoml now parses almost all examples from the spec.
2019-05-29 Fix eval-okay-fromTOML testEelco Dolstra1-1/+1
Turns out we were mis-parsing single-quoted attributes, e.g. 'key2'.
2019-05-28 Merge branch 'attrPaths' of https://github.com/NinjaTrappeur/nixEelco Dolstra6-0/+23
2019-05-12 build: add test for sandboxed --checkDaiderd Jordan1-0/+3
2019-05-08 fix hashfile test that wasn't failing due to eval lazinessWill Dietz1-1/+1
See: https://github.com/NixOS/nix/commit/7becb1bf1c2ec1544a5374580a97b36273506baf#r33450554
2019-05-03 Add builtins.hashFileDaniel Schaefer7-1/+11
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-27 Update eval-okay-types.exp to match #1828Eelco Dolstra1-1/+1
2019-03-24 Add isPath primopzimbatm1-0/+2
this is added for completeness' sake since all the other possible `builtins.typeOf` results have a corresponding `builtins.is<Type>`
2019-03-10 Update tests to the new --roots formatGuillaume Maudoux1-1/+1
2019-03-04 Restore --init calls in testsEelco Dolstra2-0/+4
2019-02-22 remove noop uses of nix-store --initzimbatm2-4/+0
the nix-store --init command is a noop apparently
2019-01-31 Add builtins.appendContext.Shea Levy1-2/+4
A partner of builtins.getContext, useful for the same reasons.
2019-01-14 Add builtins.getContext.Shea Levy2-0/+23
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-14 tests/fetchurl: fix after changing default hash from 512 to 256Will Dietz1-1/+1
2018-12-13 Support SRI hashesEelco Dolstra2-1/+22
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-20 Merge branch 'better-git-cache' of https://github.com/graham-at-target/nixEelco Dolstra1-2/+2
2018-11-07 Enable sandboxing by defaultEelco Dolstra2-9/+7
Closes #179.
2018-10-27 Restore old (dis)allowedRequisites behaviour for self-referencesEelco Dolstra3-1/+5
stdenv relies on this. So ignore self-references (but only in legacy non-structured attributes mode).
2018-10-23 Per-output reference and closure size checksEelco Dolstra1-1/+1
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.
2018-10-08 Merge pull request #2452 from ElvishJerricco/verify-sigs-overflowEelco Dolstra1-0/+4
Fix overflow when verifying signatures of content addressable paths
2018-09-28 Check requiredSystemFeatures for local buildsEelco Dolstra1-1/+2
For example, this prevents a "kvm" build on machines that don't have KVM. Fixes #2012.
2018-09-25 Add a test for signed content-addressed pathsWill Fancher1-0/+4
2018-09-10 Prefer 'remote builder' over 'slave'Graham Christensen1-18/+18
2018-08-19 FIx floating point evaluationEelco Dolstra2-0/+7
Fixes #2361.
2018-08-17 fetchGit: use a better caching schemeGraham Christensen1-2/+2
The current usage technically works by putting multiple different repos in to the same git directory. However, it is very slow as Git tries very hard to find common commits between the two repositories. If the two repositories are large (like Nixpkgs and another long-running project,) it is maddeningly slow. This change busts the cache for existing deployments, but users will be promptly repaid in per-repository performance.
2018-08-06 Require libbrotliEelco Dolstra2-8/+0
2018-08-03 Add a test for LegacySSHStore that doesn't require a VMEelco Dolstra2-1/+22
2018-08-03 Merge pull request #2326 from aszlig/fix-symlink-leakEelco Dolstra1-0/+11
Fix symlink leak in restricted eval mode
2018-08-03 Fix symlink leak in restricted eval modeaszlig1-0/+11
In EvalState::checkSourcePath, the path is checked against the list of allowed paths first and later it's checked again *after* resolving symlinks. The resolving of the symlinks is done via canonPath, which also strips out "../" and "./". However after the canonicalisation the error message pointing out that the path is not allowed prints the symlink target in the error message. Even if we'd suppress the message, symlink targets could still be leaked if the symlink target doesn't exist (in this case the error is thrown in canonPath). So instead, we now do canonPath() without symlink resolving first before even checking against the list of allowed paths and then later do the symlink resolving and checking the allowed paths again. The first call to canonPath() should get rid of all the "../" and "./", so in theory the only way to leak a symlink if the attacker is able to put a symlink in one of the paths allowed by restricted evaluation mode. For the latter I don't think this is part of the threat model, because if the attacker can write to that path, the attack vector is even larger. Signed-off-by: aszlig <aszlig@nix.build>
2018-08-02 Allows selectively adding environment variables to pure shells.Samuel Dionne-Riel1-0/+7
Includes documentation and test.