buildRustPackage: fix cargoBuildFlags

When features were supplied in cargoBuildFlags, the binaries were built
with these features enabled. Unless checking was disabled, `cargo test`
was executed without these build flags, meaning the binaries were
rebuilt and overwritten without the specified features.

Fix this bug by running tests after the installation phase.
This commit is contained in:
Flakebi 2020-06-27 11:50:42 +02:00 committed by zowoq
parent 9dcb508f2d
commit deb78151a9
2 changed files with 4 additions and 2 deletions

View File

@ -199,7 +199,7 @@ stdenv.mkDerivation (args // {
-executable ! \( -regex ".*\.\(so.[0-9.]+\|so\|a\|dylib\)" \))
'';
checkPhase = args.checkPhase or (let
installCheckPhase = args.checkPhase or (let
argstr = "${stdenv.lib.optionalString (checkType == "release") "--release"} --target ${rustTarget} --frozen";
in ''
${stdenv.lib.optionalString (buildAndTestSubdir != null) "pushd ${buildAndTestSubdir}"}

View File

@ -39,7 +39,9 @@ rustPlatform.buildRustPackage rec {
)
];
doCheck = !stdenv.isAarch64 && !stdenv.isDarwin;
# Disable tests until they can be run with --features no-self-update
doCheck = false;
#doCheck = !stdenv.isAarch64 && !stdenv.isDarwin;
postInstall = ''
pushd $out/bin