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

Allow tracking the start and end time of tests

This commit is contained in:
regnat 2022-02-24 14:26:05 +01:00
parent 1e622145b2
commit 8442d587ce

View file

@ -7,6 +7,8 @@ green=""
yellow="" yellow=""
normal="" normal=""
TESTS_TIMER_LOG=${TESTS_TIMER_LOG:-/dev/null}
post_run_msg="ran test $1..." post_run_msg="ran test $1..."
if [ -t 1 ]; then if [ -t 1 ]; then
red="" red=""
@ -17,7 +19,10 @@ fi
(cd tests && env ${TESTS_ENVIRONMENT} init.sh 2>/dev/null > /dev/null) (cd tests && env ${TESTS_ENVIRONMENT} init.sh 2>/dev/null > /dev/null)
start_time=$(date -u +%s) 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)" 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) stop_time=$(date -u +%s)
elapsed_time=$(($stop_time-$start_time)) elapsed_time=$(($stop_time-$start_time))