tests.buildRustCrate: Fix after hashing method change

As @lopsided98 points out in #105305, since the hashes are now target
sensative, and until we find reason to actually care to test what they
are exactly, we are best just normalizing them away in the tests.
This commit is contained in:
John Ericson 2020-11-29 16:28:12 +00:00
parent 5d2a20c93a
commit ddeef0d322

View File

@ -146,12 +146,18 @@ let
}; };
in in
runCommand "assert-outputs-${name}" { runCommand "assert-outputs-${name}" {
} '' } (''
local actualFiles=$(mktemp) local actualFiles=$(mktemp)
cd "${crateOutput}" cd "${crateOutput}"
find . -type f | sort >$actualFiles find . -type f \
diff -q ${expectedFilesFile} $actualFiles >/dev/null || { | sort \
''
# sed out the hash because it differs per platform
+ ''
| sed -E -e 's/-[0-9a-fA-F]{10}\.rlib/-HASH.rlib/g' \
> "$actualFiles"
diff -q ${expectedFilesFile} "$actualFiles" > /dev/null || {
echo -e "\033[0;1;31mERROR: Difference in expected output files in ${crateOutput} \033[0m" >&2 echo -e "\033[0;1;31mERROR: Difference in expected output files in ${crateOutput} \033[0m" >&2
echo === Got: echo === Got:
sed -e 's/^/ /' $actualFiles sed -e 's/^/ /' $actualFiles
@ -164,7 +170,7 @@ let
exit 1 exit 1
} }
touch $out touch $out
'' '')
; ;
in rec { in rec {
@ -594,7 +600,7 @@ let
}; };
expectedFiles = [ expectedFiles = [
"./nix-support/propagated-build-inputs" "./nix-support/propagated-build-inputs"
"./lib/libtest_lib-042a1fdbef.rlib" "./lib/libtest_lib-HASH.rlib"
"./lib/link" "./lib/link"
]; ];
}; };
@ -611,7 +617,7 @@ let
}; };
expectedFiles = [ expectedFiles = [
"./nix-support/propagated-build-inputs" "./nix-support/propagated-build-inputs"
"./lib/libtest_lib-042a1fdbef.rlib" "./lib/libtest_lib-HASH.rlib"
"./lib/link" "./lib/link"
]; ];
}; };