1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-24 11:19:35 +01:00

Show the elapsed time for each test

To have an idea of what’s taking time
This commit is contained in:
regnat 2022-01-28 16:52:09 +01:00
parent b592359c56
commit 576c5951e4

View file

@ -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