Skip to content

Commit

Permalink
run_tests: show total time
Browse files Browse the repository at this point in the history
  • Loading branch information
michaellilltokiwa committed Apr 22, 2024
1 parent 67d3919 commit 199a593
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion bin/run_tests.sh
Expand Up @@ -43,6 +43,7 @@ trap "echo """"; cat ""$BUILD_DIR""/run_tests.results ""$BUILD_DIR""/run_tests.f

echo "$(echo "$TESTS" | wc -l) tests."

START_TIME_TOTAL=$(date +%s%N | cut -b1-13)
for test in $TESTS; do
if test -n "$VERBOSE"; then
echo -en "\nrun $test: "
Expand All @@ -68,14 +69,15 @@ for test in $TESTS; do
fi
fi
done
END_TIME_TOTAL=$(date +%s%N | cut -b1-13)

OK=$( grep --count ok$ "$BUILD_DIR"/run_tests.results || true)
SKIPPED=$(grep --count skipped$ "$BUILD_DIR"/run_tests.results || true)
FAILED=$( grep --count failed$ "$BUILD_DIR"/run_tests.results || true)

echo -n " $OK/$(echo "$TESTS" | wc -w) tests passed,"
echo -n " $SKIPPED skipped,"
echo " $FAILED failed."
echo " $FAILED failed in $((END_TIME_TOTAL-START_TIME_TOTAL))ms."
grep failed$ "$BUILD_DIR"/run_tests.results || echo -n

if [ "$FAILED" -ge 1 ]; then
Expand Down
4 changes: 3 additions & 1 deletion bin/run_tests_parallel.sh
Expand Up @@ -75,6 +75,7 @@ echo "$(echo "$TESTS" | wc -l) tests, running $N tests in parallel."

open_sem "$N"

START_TIME_TOTAL=$(date +%s%N | cut -b1-13)
for test in $TESTS; do
task(){
if test -n "$VERBOSE"; then
Expand Down Expand Up @@ -104,14 +105,15 @@ for test in $TESTS; do
run_with_lock task
done
wait
END_TIME_TOTAL=$(date +%s%N | cut -b1-13)

OK=$( grep --count ok$ "$BUILD_DIR"/run_tests.results || true)
SKIPPED=$(grep --count skipped$ "$BUILD_DIR"/run_tests.results || true)
FAILED=$( grep --count failed$ "$BUILD_DIR"/run_tests.results || true)

echo -n " $OK/$(echo "$TESTS" | wc -w) tests passed,"
echo -n " $SKIPPED skipped,"
echo " $FAILED failed."
echo " $FAILED failed in $((END_TIME_TOTAL-START_TIME_TOTAL))ms."
grep failed$ "$BUILD_DIR"/run_tests.results || echo -n

if [ "$FAILED" -ge 1 ]; then
Expand Down

0 comments on commit 199a593

Please sign in to comment.