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

Fix the logging of the tests time

Also log the time of `init.sh`
This commit is contained in:
regnat 2022-02-28 14:40:28 +01:00
parent 4d3e4ccdc5
commit 8daa04e265

View file

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