mirror of
https://github.com/NixOS/nix.git
synced 2025-11-24 03:09:35 +01:00
Fix the logging of the tests time
Also log the time of `init.sh`
This commit is contained in:
parent
4d3e4ccdc5
commit
8daa04e265
1 changed files with 6 additions and 5 deletions
|
|
@ -2,13 +2,16 @@
|
||||||
|
|
||||||
set -u
|
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=""
|
red=""
|
||||||
green=""
|
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="[31;1m"
|
red="[31;1m"
|
||||||
|
|
@ -18,11 +21,8 @@ if [ -t 1 ]; then
|
||||||
fi
|
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)
|
|
||||||
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=$?
|
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))
|
||||||
|
|
||||||
|
|
@ -35,3 +35,4 @@ else
|
||||||
echo "$log" | sed 's/^/ /'
|
echo "$log" | sed 's/^/ /'
|
||||||
exit "$status"
|
exit "$status"
|
||||||
fi
|
fi
|
||||||
|
echo "$(date -u +%s) $1 stop" >> "$TESTS_TIMER_LOG"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue