tests: migrate export-graph.sh

Change-Id: I0de67ba6b1f710434f504814dd9b5eb7d486e65a
This commit is contained in:
rootile
2026-06-14 19:02:11 +02:00
parent ba3a026f40
commit bc8a95457f
4 changed files with 46 additions and 31 deletions
-29
View File
@@ -1,29 +0,0 @@
with import ./config.nix;
rec {
printRefs =
''
echo $exportReferencesGraph
while read path; do
read drv
read nrRefs
echo "$path has $nrRefs references"
echo "$path" >> $out
for ((n = 0; n < $nrRefs; n++)); do read ref; echo "ref $ref"; test -e "$ref"; done
done < refs
'';
foo."bar.runtimeGraph" = mkDerivation {
name = "dependencies";
builder = builtins.toFile "build-graph-builder" "${printRefs}";
exportReferencesGraph = ["refs" (import ./dependencies.nix {})];
};
foo."bar.buildGraph" = mkDerivation {
name = "dependencies";
builder = builtins.toFile "build-graph-builder" "${printRefs}";
exportReferencesGraph = ["refs" (import ./dependencies.nix {}).drvPath];
};
}
-30
View File
@@ -1,30 +0,0 @@
source common.sh
clearStore
clearProfiles
checkRef() {
nix-store -q --references $TEST_ROOT/result | grepQuiet "$1"'$' || fail "missing reference $1"
}
# Test the export of the runtime dependency graph.
outPath=$(nix-build ./export-graph.nix -A 'foo."bar.runtimeGraph"' -o $TEST_ROOT/result)
test $(nix-store -q --references $TEST_ROOT/result | wc -l) = 4 || fail "bad nr of references"
checkRef input-2
for i in $(cat $outPath); do checkRef $i; done
# Test the export of the build-time dependency graph.
nix-store --gc # should force rebuild of input-1
outPath=$(nix-build ./export-graph.nix -A 'foo."bar.buildGraph"' -o $TEST_ROOT/result)
checkRef input-1
checkRef input-1.drv
checkRef input-2
checkRef input-2.drv
for i in $(cat $outPath); do checkRef $i; done
-1
View File
@@ -48,7 +48,6 @@ functional_tests_scripts = [
'repair.sh',
'repair-chroot.sh',
'fixed.sh',
'export-graph.sh',
'fetchGitRefs.sh',
'gc-runtime.sh',
'fetchers.sh',