Skip to content

Commit

Permalink
Merge pull request #105379 from NixOS/fix-buildRustCrateTests
Browse files Browse the repository at this point in the history
tests.buildRustCrate: Fix after hashing method change
  • Loading branch information
Ericson2314 authored Dec 19, 2020
2 parents 999f6ee + ddeef0d commit 86c1825
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
18 changes: 12 additions & 6 deletions pkgs/build-support/rust/build-rust-crate/test/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -146,12 +146,18 @@ let
};
in
runCommand "assert-outputs-${name}" {
} ''
} (''
local actualFiles=$(mktemp)
cd "${crateOutput}"
find . -type f | sort >$actualFiles
diff -q ${expectedFilesFile} $actualFiles >/dev/null || {
find . -type f \
| 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 === Got:
sed -e 's/^/ /' $actualFiles
Expand All @@ -164,7 +170,7 @@ let
exit 1
}
touch $out
''
'')
;

in rec {
Expand Down Expand Up @@ -594,7 +600,7 @@ let
};
expectedFiles = [
"./nix-support/propagated-build-inputs"
"./lib/libtest_lib-042a1fdbef.rlib"
"./lib/libtest_lib-HASH.rlib"
"./lib/link"
];
};
Expand All @@ -611,7 +617,7 @@ let
};
expectedFiles = [
"./nix-support/propagated-build-inputs"
"./lib/libtest_lib-042a1fdbef.rlib"
"./lib/libtest_lib-HASH.rlib"
"./lib/link"
];
};
Expand Down
1 change: 1 addition & 0 deletions pkgs/test/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ with pkgs;
cross = callPackage ./cross {};

rustCustomSysroot = callPackage ./rust-sysroot {};
buildRustCrate = callPackage ../build-support/rust/build-rust-crate/test { };

nixos-functions = callPackage ./nixos-functions {};

Expand Down
1 change: 0 additions & 1 deletion pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -10071,7 +10071,6 @@ in

buildRustCrate = callPackage ../build-support/rust/build-rust-crate { };
buildRustCrateHelpers = callPackage ../build-support/rust/build-rust-crate/helpers.nix { };
buildRustCrateTests = recurseIntoAttrs (callPackage ../build-support/rust/build-rust-crate/test { });
cratesIO = callPackage ../build-support/rust/crates-io.nix { };

cargo-web = callPackage ../development/tools/cargo-web {
Expand Down

0 comments on commit 86c1825

Please sign in to comment.