ci: Add timing info to test builds

To help determine where time is being spent in tests, add a 'time'
command to the test invocation script.  In addition, split the test
invocation into a separate build and run stage.  This can be useful with
another change to ptest that logs all test outputs instead of just
failures.

Signed-off-by: David Brown <david.brown@linaro.org>
This commit is contained in:
David Brown 2021-01-12 12:03:19 -07:00 committed by David Brown
parent 0cfe2ce382
commit ed90fbfe9f
1 changed files with 6 additions and 3 deletions

View File

@ -25,14 +25,16 @@ EXIT_CODE=0
if [[ ! -z $SINGLE_FEATURES ]]; then if [[ ! -z $SINGLE_FEATURES ]]; then
if [[ $SINGLE_FEATURES =~ "none" ]]; then if [[ $SINGLE_FEATURES =~ "none" ]]; then
echo "Running cargo with no features" echo "Running cargo with no features"
cargo test time cargo test --no-run
time cargo test
rc=$? && [ $rc -ne 0 ] && EXIT_CODE=$rc rc=$? && [ $rc -ne 0 ] && EXIT_CODE=$rc
fi fi
for feature in $all_features; do for feature in $all_features; do
if [[ $SINGLE_FEATURES =~ $feature ]]; then if [[ $SINGLE_FEATURES =~ $feature ]]; then
echo "Running cargo for feature=\"${feature}\"" echo "Running cargo for feature=\"${feature}\""
cargo test --features $feature time cargo test --no-run --features $feature
time cargo test --features $feature
rc=$? && [ $rc -ne 0 ] && EXIT_CODE=$rc rc=$? && [ $rc -ne 0 ] && EXIT_CODE=$rc
fi fi
done done
@ -43,7 +45,8 @@ if [[ ! -z $MULTI_FEATURES ]]; then
read -ra multi_features <<< "$MULTI_FEATURES" read -ra multi_features <<< "$MULTI_FEATURES"
for features in "${multi_features[@]}"; do for features in "${multi_features[@]}"; do
echo "Running cargo for features=\"${features}\"" echo "Running cargo for features=\"${features}\""
cargo test --features "$features" time cargo test --no-run --features "$features"
time cargo test --features "$features"
rc=$? && [ $rc -ne 0 ] && EXIT_CODE=$rc rc=$? && [ $rc -ne 0 ] && EXIT_CODE=$rc
done done
fi fi