mirror of
https://github.com/NixOS/nix
synced 2025-07-12 06:35:08 +02:00
Merge branch 'master' into flake_search
This commit is contained in:
commit
f404189368
110 changed files with 13588 additions and 4110 deletions
6
tests/ca/import-derivation.sh
Normal file
6
tests/ca/import-derivation.sh
Normal file
|
@ -0,0 +1,6 @@
|
|||
source common.sh
|
||||
|
||||
export NIX_TESTS_CA_BY_DEFAULT=1
|
||||
|
||||
cd .. && source import-derivation.sh
|
||||
|
|
@ -18,6 +18,7 @@ chmod +x echoing-post-hook.sh
|
|||
cat <<EOF > flake.nix
|
||||
{
|
||||
nixConfig.post-build-hook = "$PWD/echoing-post-hook.sh";
|
||||
nixConfig.allow-dirty = false; # See #5621
|
||||
|
||||
outputs = a: {
|
||||
defaultPackage.$system = import ./simple.nix;
|
||||
|
|
|
@ -249,6 +249,14 @@ cat > $flake3Dir/flake.nix <<EOF
|
|||
url = git+file://$nonFlakeDir;
|
||||
flake = false;
|
||||
};
|
||||
nonFlakeFile = {
|
||||
url = path://$nonFlakeDir/README.md;
|
||||
flake = false;
|
||||
};
|
||||
nonFlakeFile2 = {
|
||||
url = "$nonFlakeDir/README.md";
|
||||
flake = false;
|
||||
};
|
||||
};
|
||||
|
||||
description = "Fnord";
|
||||
|
@ -265,6 +273,8 @@ cat > $flake3Dir/flake.nix <<EOF
|
|||
dummy2 = builtins.readFile (builtins.path { name = "source"; path = inputs.flake1; filter = path: type: baseNameOf path == "simple.nix"; } + "/simple.nix");
|
||||
buildCommand = ''
|
||||
cat \${inputs.nonFlake}/README.md > \$out
|
||||
[[ \$(cat \${inputs.nonFlake}/README.md) = \$(cat \${inputs.nonFlakeFile}) ]]
|
||||
[[ \${inputs.nonFlakeFile} = \${inputs.nonFlakeFile2} ]]
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
|
|
@ -19,7 +19,7 @@ pid=$!
|
|||
|
||||
sleep 2
|
||||
|
||||
outPath=$(nix-build -o "$TEST_ROOT/result" -E "
|
||||
outPath=$(nix-build --max-silent-time 60 -o "$TEST_ROOT/result" -E "
|
||||
with import ./config.nix;
|
||||
mkDerivation {
|
||||
name = \"non-blocking\";
|
||||
|
|
1
tests/lang/eval-okay-groupBy.exp
Normal file
1
tests/lang/eval-okay-groupBy.exp
Normal file
|
@ -0,0 +1 @@
|
|||
{ "1" = [ 9 ]; "2" = [ 8 ]; "3" = [ 13 29 ]; "4" = [ 3 4 10 11 17 18 ]; "5" = [ 0 23 26 28 ]; "6" = [ 1 12 21 27 30 ]; "7" = [ 7 22 ]; "8" = [ 14 ]; "9" = [ 19 ]; b = [ 16 25 ]; c = [ 24 ]; d = [ 2 ]; e = [ 5 6 15 31 ]; f = [ 20 ]; }
|
5
tests/lang/eval-okay-groupBy.nix
Normal file
5
tests/lang/eval-okay-groupBy.nix
Normal file
|
@ -0,0 +1,5 @@
|
|||
with import ./lib.nix;
|
||||
|
||||
builtins.groupBy (n:
|
||||
builtins.substring 0 1 (builtins.hashString "sha256" (toString n))
|
||||
) (range 0 31)
|
|
@ -11,7 +11,7 @@ nix_tests = \
|
|||
local-store.sh remote-store.sh export.sh export-graph.sh \
|
||||
db-migration.sh \
|
||||
timeout.sh secure-drv-outputs.sh nix-channel.sh \
|
||||
multiple-outputs.sh import-derivation.sh fetchurl.sh optimise-store.sh \
|
||||
multiple-outputs.sh import-derivation.sh ca/import-derivation.sh fetchurl.sh optimise-store.sh \
|
||||
binary-cache.sh \
|
||||
substitute-with-invalid-ca.sh \
|
||||
binary-cache-build-remote.sh \
|
||||
|
|
|
@ -35,16 +35,14 @@ grep -q 'item.*attrPath="foo".*name="dependencies-top"' $TEST_ROOT/meta.xml
|
|||
nix-env -i dependencies-top
|
||||
[ -e $TEST_HOME/.nix-profile/foobar ]
|
||||
|
||||
clearProfiles
|
||||
rm -f $TEST_HOME/.nix-channels
|
||||
|
||||
# Test updating from a tarball
|
||||
nix-channel --add file://$TEST_ROOT/foo/nixexprs.tar.bz2 foo
|
||||
nix-channel --add file://$TEST_ROOT/foo/nixexprs.tar.bz2 bar
|
||||
nix-channel --update
|
||||
|
||||
# Do a query.
|
||||
nix-env -qa \* --meta --xml --out-path > $TEST_ROOT/meta.xml
|
||||
grep -q 'meta.*description.*Random test package' $TEST_ROOT/meta.xml
|
||||
grep -q 'item.*attrPath="bar".*name="dependencies-top"' $TEST_ROOT/meta.xml
|
||||
grep -q 'item.*attrPath="foo".*name="dependencies-top"' $TEST_ROOT/meta.xml
|
||||
|
||||
# Do an install.
|
||||
|
|
|
@ -11,6 +11,9 @@ missingImpureErrorMsg=$(! nix eval --expr 'builtins.readFile ./pure-eval.sh' 2>&
|
|||
echo "$missingImpureErrorMsg" | grep -q -- --impure || \
|
||||
fail "The error message should mention the “--impure” flag to unblock users"
|
||||
|
||||
[[ $(nix eval --expr 'builtins.pathExists ./pure-eval.sh') == false ]] || \
|
||||
fail "Calling 'pathExists' on a non-authorised path should return false"
|
||||
|
||||
(! nix eval --expr builtins.currentTime)
|
||||
(! nix eval --expr builtins.currentSystem)
|
||||
|
||||
|
|
|
@ -1,8 +1,16 @@
|
|||
source common.sh
|
||||
|
||||
replCmds="
|
||||
simple = 1
|
||||
simple = import ./simple.nix
|
||||
:b simple
|
||||
:log simple
|
||||
"
|
||||
|
||||
replFailingCmds="
|
||||
failing = import ./simple-failing.nix
|
||||
:b failing
|
||||
:log failing
|
||||
"
|
||||
|
||||
testRepl () {
|
||||
|
@ -12,6 +20,12 @@ testRepl () {
|
|||
local outPath=$(echo "$replOutput" |&
|
||||
grep -o -E "$NIX_STORE_DIR/\w*-simple")
|
||||
nix path-info "${nixArgs[@]}" "$outPath"
|
||||
# simple.nix prints a PATH during build
|
||||
echo "$replOutput" | grep -qs 'PATH=' || fail "nix repl :log doesn't output logs"
|
||||
local replOutput="$(nix repl "${nixArgs[@]}" <<< "$replFailingCmds")"
|
||||
echo "$replOutput"
|
||||
echo "$replOutput" | grep -qs 'This should fail' \
|
||||
|| fail "nix repl :log doesn't output logs for a failed derivation"
|
||||
}
|
||||
|
||||
# Simple test, try building a drv
|
||||
|
|
12
tests/simple-failing.nix
Normal file
12
tests/simple-failing.nix
Normal file
|
@ -0,0 +1,12 @@
|
|||
with import ./config.nix;
|
||||
|
||||
mkDerivation {
|
||||
name = "simple-failing";
|
||||
builder = builtins.toFile "builder.sh"
|
||||
''
|
||||
echo "This should fail"
|
||||
exit 1
|
||||
'';
|
||||
PATH = "";
|
||||
goodPath = path;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue