move test to correct file

This commit is contained in:
Tharun T 2024-03-28 02:20:33 +05:30
parent 53c15336b0
commit 52359ca00a
2 changed files with 19 additions and 29 deletions

View file

@ -56,6 +56,18 @@ cat > $flake1Dir/flake.nix <<EOF
a12 = self.drvCall.outPath; a12 = self.drvCall.outPath;
a13 = "\${self.drvCall.drvPath}\${self.drvCall.outPath}"; a13 = "\${self.drvCall.drvPath}\${self.drvCall.outPath}";
a14 = with import ./config.nix; mkDerivation {
name = "dot-installable";
outputs = [ "foo" "out" ];
meta.outputsToInstall = [ "out" ];
buildCommand = ''
mkdir \$foo \$out
echo "foo" > \$foo/file
echo "out" > \$out/file
'';
outputSpecified = true;
};
}; };
} }
EOF EOF
@ -94,3 +106,10 @@ nix build --json --out-link $TEST_ROOT/result $flake1Dir#a12
expectStderr 1 nix build --impure --json --out-link $TEST_ROOT/result $flake1Dir#a13 \ expectStderr 1 nix build --impure --json --out-link $TEST_ROOT/result $flake1Dir#a13 \
| grepQuiet "has 2 entries in its context. It should only have exactly one entry" | grepQuiet "has 2 entries in its context. It should only have exactly one entry"
# Test accessing output in installables with `.` (foobarbaz.<output>)
nix build --json --no-link $flake1Dir#a14.foo | jq --exit-status '
(.[0] |
(.drvPath | match(".*dot-installable.drv")) and
(.outputs | keys == ["foo"]))
'

View file

@ -285,35 +285,6 @@ git -C "$flake3Dir" add flake.lock
git -C "$flake3Dir" commit -m 'Add lockfile' git -C "$flake3Dir" commit -m 'Add lockfile'
# Test accessing output in installables with `.` (foobarbaz.<output>)
cat > "$flake3Dir/flake.nix" <<EOF
{
outputs = {self}: {
packages.$system.hello = (import ./config.nix).mkDerivation {
name = "hello";
outputs = [ "foo" "out" ];
meta.outputsToInstall = [ "out" ];
buildCommand = ''
mkdir \$foo \$out
echo "foo" > \$foo/file
echo "out" > \$out/file
'';
outputSpecified = true;
};
};
}
EOF
cp ../config.nix "$flake3Dir"
git -C "$flake3Dir" add flake.nix config.nix
git -C "$flake3Dir" commit -m 'multi outputs flake'
nix build "$flake3Dir#hello.foo" --json --no-link | jq --exit-status '
(.[0] |
(.drvPath | match(".*hello.drv")) and
(.outputs | keys == ["foo"]))
'
# Test whether registry caching works. # Test whether registry caching works.
nix registry list --flake-registry "file://$registry" | grepQuiet flake3 nix registry list --flake-registry "file://$registry" | grepQuiet flake3
mv "$registry" "$registry.tmp" mv "$registry" "$registry.tmp"