2021-02-15 11:18:37 +01:00
|
|
|
declare -a checkFlags
|
2021-02-24 09:32:22 +01:00
|
|
|
declare -a cargoTestFlags
|
2021-02-15 11:18:37 +01:00
|
|
|
|
2021-02-15 10:26:40 +01:00
|
|
|
cargoCheckHook() {
|
|
|
|
echo "Executing cargoCheckHook"
|
|
|
|
|
|
|
|
runHook preCheck
|
|
|
|
|
|
|
|
if [[ -n "${buildAndTestSubdir-}" ]]; then
|
|
|
|
pushd "${buildAndTestSubdir}"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ -z ${dontUseCargoParallelTests-} ]]; then
|
|
|
|
threads=$NIX_BUILD_CORES
|
|
|
|
else
|
|
|
|
threads=1
|
|
|
|
fi
|
|
|
|
|
2021-03-03 19:09:04 +01:00
|
|
|
if [ "${cargoBuildType}" != "debug" ]; then
|
|
|
|
cargoBuildProfileFlag="--${cargoBuildType}"
|
|
|
|
fi
|
|
|
|
|
|
|
|
argstr="${cargoBuildProfileFlag} --target @rustTargetPlatformSpec@ --frozen ${cargoTestFlags}";
|
2021-02-15 10:26:40 +01:00
|
|
|
|
|
|
|
(
|
|
|
|
set -x
|
|
|
|
cargo test \
|
|
|
|
-j $NIX_BUILD_CORES \
|
|
|
|
${argstr} -- \
|
|
|
|
--test-threads=${threads} \
|
|
|
|
${checkFlags} \
|
|
|
|
${checkFlagsArray+"${checkFlagsArray[@]}"}
|
|
|
|
)
|
|
|
|
|
|
|
|
if [[ -n "${buildAndTestSubdir-}" ]]; then
|
|
|
|
popd
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "Finished cargoCheckHook"
|
|
|
|
|
|
|
|
runHook postCheck
|
|
|
|
}
|
|
|
|
|
2021-02-15 11:18:37 +01:00
|
|
|
if [ -z "${checkPhase-}" ]; then
|
|
|
|
checkPhase=cargoCheckHook
|
|
|
|
fi
|