2021-02-15 10:18:37 +00:00
|
|
|
declare -a checkFlags
|
2021-02-24 08:32:22 +00:00
|
|
|
declare -a cargoTestFlags
|
2021-02-15 10:18:37 +00:00
|
|
|
|
2021-02-15 09:26:40 +00: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-09-21 18:00:25 +01:00
|
|
|
if [ "${cargoCheckType}" != "debug" ]; then
|
|
|
|
cargoCheckProfileFlag="--${cargoCheckType}"
|
2021-03-03 18:09:04 +00:00
|
|
|
fi
|
|
|
|
|
2021-10-27 03:41:37 +01:00
|
|
|
if [ -n "${cargoCheckNoDefaultFeatures-}" ]; then
|
|
|
|
cargoCheckNoDefaultFeaturesFlag=--no-default-features
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -n "${cargoCheckFeatures-}" ]; then
|
|
|
|
cargoCheckFeaturesFlag="--features=${cargoCheckFeatures// /,}"
|
|
|
|
fi
|
|
|
|
|
|
|
|
argstr="${cargoCheckProfileFlag} ${cargoCheckNoDefaultFeaturesFlag} ${cargoCheckFeaturesFlag}
|
|
|
|
--target @rustTargetPlatformSpec@ --frozen ${cargoTestFlags}"
|
2021-02-15 09:26:40 +00: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-03-01 01:18:12 +00:00
|
|
|
if [ -z "${dontCargoCheck-}" ] && [ -z "${checkPhase-}" ]; then
|
2021-02-15 10:18:37 +00:00
|
|
|
checkPhase=cargoCheckHook
|
|
|
|
fi
|