From 8daa04e26524d4af8474d3fe905618f2c3b7588c Mon Sep 17 00:00:00 2001 From: regnat Date: Mon, 28 Feb 2022 14:40:28 +0100 Subject: [PATCH] Fix the logging of the tests time Also log the time of `init.sh` --- mk/run_test.sh | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/mk/run_test.sh b/mk/run_test.sh index d28826744..02dc966be 100755 --- a/mk/run_test.sh +++ b/mk/run_test.sh @@ -2,13 +2,16 @@ set -u +TESTS_TIMER_LOG=${TESTS_TIMER_LOG:-/dev/null} + +start_time=$(date -u +%s) +echo "$(date -u +%s) $1 start" >> "$TESTS_TIMER_LOG" + red="" green="" yellow="" normal="" -TESTS_TIMER_LOG=${TESTS_TIMER_LOG:-/dev/null} - post_run_msg="ran test $1..." if [ -t 1 ]; then red="" @@ -18,11 +21,8 @@ if [ -t 1 ]; then fi (cd tests && env ${TESTS_ENVIRONMENT} init.sh 2>/dev/null > /dev/null) -start_time=$(date -u +%s) -echo "$(date -u +%s) $1 start" >> "$TESTS_TIMER_LOG" log="$(cd $(dirname $1) && env ${TESTS_ENVIRONMENT} $(basename $1) 2>&1)" status=$? -echo "$(date -u +%s) $1 stop" >> "$TESTS_TIMER_LOG" stop_time=$(date -u +%s) elapsed_time=$(($stop_time-$start_time)) @@ -35,3 +35,4 @@ else echo "$log" | sed 's/^/ /' exit "$status" fi +echo "$(date -u +%s) $1 stop" >> "$TESTS_TIMER_LOG"