Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: NixOS/nix
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 5bdb67c84308
Choose a base ref
...
head repository: NixOS/nix
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 5722f9690c39
Choose a head ref
  • 1 commit
  • 11 files changed
  • 1 contributor

Commits on May 12, 2020

  1. Copy the full SHA
    5722f96 View commit details
18 changes: 16 additions & 2 deletions tests/binary-cache.sh
Original file line number Diff line number Diff line change
@@ -105,10 +105,24 @@ mv $cacheDir/nar2 $cacheDir/nar
# incomplete closure.
clearStore

rm $(grep -l "StorePath:.*dependencies-input-2" $cacheDir/*.narinfo)
rm -v $(grep -l "StorePath:.*dependencies-input-2" $cacheDir/*.narinfo)

nix-build --substituters "file://$cacheDir" --no-require-sigs dependencies.nix -o $TEST_ROOT/result 2>&1 | tee $TEST_ROOT/log
grep -q "copying path" $TEST_ROOT/log
grep -q "copying path.*input-0" $TEST_ROOT/log
grep -q "copying path.*input-2" $TEST_ROOT/log
grep -q "copying path.*top" $TEST_ROOT/log


# Idem, but without cached .narinfo.
clearStore
clearCacheCache

nix-build --substituters "file://$cacheDir" --no-require-sigs dependencies.nix -o $TEST_ROOT/result 2>&1 | tee $TEST_ROOT/log
grep -q "don't know how to build" $TEST_ROOT/log
grep -q "building.*input-1" $TEST_ROOT/log
grep -q "building.*input-2" $TEST_ROOT/log
grep -q "copying path.*input-0" $TEST_ROOT/log
grep -q "copying path.*top" $TEST_ROOT/log


if [ -n "$HAVE_SODIUM" ]; then
4 changes: 2 additions & 2 deletions tests/build-hook.nix
Original file line number Diff line number Diff line change
@@ -4,13 +4,13 @@ let

input1 = mkDerivation {
name = "build-hook-input-1";
builder = ./dependencies.builder1.sh;
buildCommand = "mkdir $out; echo FOO > $out/foo";
requiredSystemFeatures = ["foo"];
};

input2 = mkDerivation {
name = "build-hook-input-2";
builder = ./dependencies.builder2.sh;
buildCommand = "mkdir $out; echo BAR > $out/bar";
};

in
4 changes: 2 additions & 2 deletions tests/build-remote.sh
Original file line number Diff line number Diff line change
@@ -20,5 +20,5 @@ cat $outPath/foobar | grep FOOBAR

# Ensure that input1 was built on store1 due to the required feature.
p=$(readlink -f $outPath/input-2)
(! nix path-info --store $TEST_ROOT/store0 --all | grep dependencies.builder1.sh)
nix path-info --store $TEST_ROOT/store1 --all | grep dependencies.builder1.sh
(! nix path-info --store $TEST_ROOT/store0 --all | grep builder-build-hook-input-1.sh)
nix path-info --store $TEST_ROOT/store1 --all | grep builder-build-hook-input-1.sh
2 changes: 1 addition & 1 deletion tests/config.nix.in
Original file line number Diff line number Diff line change
@@ -11,7 +11,7 @@ rec {
derivation ({
inherit system;
builder = shell;
args = ["-e" args.builder or (builtins.toFile "builder.sh" "if [ -e .attrs.sh ]; then source .attrs.sh; fi; eval \"$buildCommand\"")];
args = ["-e" args.builder or (builtins.toFile "builder-${args.name}.sh" "if [ -e .attrs.sh ]; then source .attrs.sh; fi; eval \"$buildCommand\"")];
PATH = path;
} // removeAttrs args ["builder" "meta"])
// { meta = args.meta or {}; };
2 changes: 0 additions & 2 deletions tests/dependencies.builder1.sh

This file was deleted.

2 changes: 0 additions & 2 deletions tests/dependencies.builder2.sh

This file was deleted.

15 changes: 12 additions & 3 deletions tests/dependencies.nix
Original file line number Diff line number Diff line change
@@ -2,18 +2,27 @@ with import ./config.nix;

let {

input0 = mkDerivation {
name = "dependencies-input-0";
buildCommand = "mkdir $out; echo foo > $out/bar";
};

input1 = mkDerivation {
name = "dependencies-input-1";
builder = ./dependencies.builder1.sh;
buildCommand = "mkdir $out; echo FOO > $out/foo";
};

input2 = mkDerivation {
name = "dependencies-input-2";
builder = "${./dependencies.builder2.sh}";
buildCommand = ''
mkdir $out
echo BAR > $out/bar
echo ${input0} > $out/input0
'';
};

body = mkDerivation {
name = "dependencies";
name = "dependencies-top";
builder = ./dependencies.builder0.sh + "/FOOBAR/../.";
input1 = input1 + "/.";
input2 = "${input2}/.";
2 changes: 1 addition & 1 deletion tests/dependencies.sh
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@ drvPath=$(nix-instantiate dependencies.nix)

echo "derivation is $drvPath"

nix-store -q --tree "$drvPath" | grep '───.*builder1.sh'
nix-store -q --tree "$drvPath" | grep '───.*builder-dependencies-input-1.sh'

# Test Graphviz graph generation.
nix-store -q --graph "$drvPath" > $TEST_ROOT/graph
2 changes: 1 addition & 1 deletion tests/export-graph.sh
Original file line number Diff line number Diff line change
@@ -11,7 +11,7 @@ checkRef() {

outPath=$(nix-build ./export-graph.nix -A 'foo."bar.runtimeGraph"' -o $TEST_ROOT/result)

test $(nix-store -q --references $TEST_ROOT/result | wc -l) = 2 || fail "bad nr of references"
test $(nix-store -q --references $TEST_ROOT/result | wc -l) = 3 || fail "bad nr of references"

checkRef input-2
for i in $(cat $outPath); do checkRef $i; done
6 changes: 3 additions & 3 deletions tests/gc-concurrent.nix
Original file line number Diff line number Diff line change
@@ -4,12 +4,12 @@ rec {

input1 = mkDerivation {
name = "dependencies-input-1";
builder = ./dependencies.builder1.sh;
buildCommand = "mkdir $out; echo FOO > $out/foo";
};

input2 = mkDerivation {
name = "dependencies-input-2";
builder = ./dependencies.builder2.sh;
buildCommand = "mkdir $out; echo BAR > $out/bar";
};

test1 = mkDerivation {
@@ -23,5 +23,5 @@ rec {
builder = ./gc-concurrent2.builder.sh;
inherit input1 input2;
};

}
8 changes: 4 additions & 4 deletions tests/nix-channel.sh
Original file line number Diff line number Diff line change
@@ -32,10 +32,10 @@ if [ "$xmllint" != false ]; then
$xmllint --noout $TEST_ROOT/meta.xml || fail "malformed XML"
fi
grep -q 'meta.*description.*Random test package' $TEST_ROOT/meta.xml
grep -q 'item.*attrPath="foo".*name="dependencies"' $TEST_ROOT/meta.xml
grep -q 'item.*attrPath="foo".*name="dependencies-top"' $TEST_ROOT/meta.xml

# Do an install.
nix-env -i dependencies
nix-env -i dependencies-top
[ -e $TEST_HOME/.nix-profile/foobar ]

clearProfiles
@@ -51,9 +51,9 @@ if [ "$xmllint" != false ]; then
$xmllint --noout $TEST_ROOT/meta.xml || fail "malformed XML"
fi
grep -q 'meta.*description.*Random test package' $TEST_ROOT/meta.xml
grep -q 'item.*attrPath="foo".*name="dependencies"' $TEST_ROOT/meta.xml
grep -q 'item.*attrPath="foo".*name="dependencies-top"' $TEST_ROOT/meta.xml

# Do an install.
nix-env -i dependencies
nix-env -i dependencies-top
[ -e $TEST_HOME/.nix-profile/foobar ]