2c76a4cb41
GitOrigin-RevId: c757e9bd77b16ca2e03c89bf8bc9ecb28e0c06ad
55 lines
1.3 KiB
Bash
55 lines
1.3 KiB
Bash
declare -a checkFlags
|
|
declare -a cargoTestFlags
|
|
|
|
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
|
|
|
|
if [ "${cargoCheckType}" != "debug" ]; then
|
|
cargoCheckProfileFlag="--profile ${cargoCheckType}"
|
|
fi
|
|
|
|
if [ -n "${cargoCheckNoDefaultFeatures-}" ]; then
|
|
cargoCheckNoDefaultFeaturesFlag=--no-default-features
|
|
fi
|
|
|
|
if [ -n "${cargoCheckFeatures-}" ]; then
|
|
cargoCheckFeaturesFlag="--features=${cargoCheckFeatures// /,}"
|
|
fi
|
|
|
|
argstr="${cargoCheckProfileFlag} ${cargoCheckNoDefaultFeaturesFlag} ${cargoCheckFeaturesFlag}
|
|
--target @rustHostPlatformSpec@ --frozen ${cargoTestFlags}"
|
|
|
|
(
|
|
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
|
|
}
|
|
|
|
if [ -z "${dontCargoCheck-}" ] && [ -z "${checkPhase-}" ]; then
|
|
checkPhase=cargoCheckHook
|
|
fi
|