2021-03-09 03:18:52 +00:00
|
|
|
declare -a checkFlags
|
2021-03-19 17:17:44 +00:00
|
|
|
declare -a cargoTestFlags
|
2021-03-09 03:18:52 +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-12-06 16:07:01 +00:00
|
|
|
if [ "${cargoCheckType}" != "debug" ]; then
|
|
|
|
cargoCheckProfileFlag="--${cargoCheckType}"
|
2021-03-19 17:17:44 +00:00
|
|
|
fi
|
|
|
|
|
2021-12-06 16:07:01 +00: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-03-09 03:18:52 +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-19 17:17:44 +00:00
|
|
|
if [ -z "${dontCargoCheck-}" ] && [ -z "${checkPhase-}" ]; then
|
2021-03-09 03:18:52 +00:00
|
|
|
checkPhase=cargoCheckHook
|
|
|
|
fi
|