From 76c36742eeb067f0cfb4dce8db9d9abe112b3ecd Mon Sep 17 00:00:00 2001 From: regnat Date: Fri, 28 Jan 2022 16:52:09 +0100 Subject: [PATCH] Show the elapsed time for each test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit To have an idea of what’s taking time --- mk/run_test.sh | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/mk/run_test.sh b/mk/run_test.sh index 3783d3bf7..9353db91e 100755 --- a/mk/run_test.sh +++ b/mk/run_test.sh @@ -15,14 +15,18 @@ if [ -t 1 ]; then normal="" fi (cd tests && env ${TESTS_ENVIRONMENT} init.sh 2>/dev/null > /dev/null) + +start_time=$(date -u +%s) log="$(cd $(dirname $1) && env ${TESTS_ENVIRONMENT} $(basename $1) 2>&1)" -status=$? +stop_time=$(date -u +%s) +elapsed_time=$(($stop_time-$start_time)) + if [ $status -eq 0 ]; then - echo "$post_run_msg [${green}PASS$normal]" + echo "$post_run_msg [${green}PASS$normal] in ${elapsed_time}s" elif [ $status -eq 99 ]; then - echo "$post_run_msg [${yellow}SKIP$normal]" + echo "$post_run_msg [${yellow}SKIP$normal] after ${elapsed_time}s" else - echo "$post_run_msg [${red}FAIL$normal]" + echo "$post_run_msg [${red}FAIL$normal] in ${elapsed_time}s" echo "$log" | sed 's/^/ /' exit "$status" fi