07d6a74cbb
GitOrigin-RevId: f5e8bdd07d1afaabf6b37afc5497b1e498b8046f
46 lines
1,016 B
Bash
46 lines
1,016 B
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 [ "${cargoBuildType}" != "debug" ]; then
|
|
cargoBuildProfileFlag="--${cargoBuildType}"
|
|
fi
|
|
|
|
argstr="${cargoBuildProfileFlag} --target @rustTargetPlatformSpec@ --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
|