From 8f3893708c427d58c1b0a180d2e5e4ac3ab2e7ee Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Wed, 6 Sep 2023 13:52:20 +0200 Subject: tests/shell: record the test duration (wall time) in the result data Runtimes are important. Add a way to find out how long tests took. $ ./tests/shell/run-tests.sh ... $ for d in /tmp/nft-test.latest.*/test-*/ ; do \ printf '%10.2f %s\n' \ "$(sed '1!d' "$d/times")" \ "$(cat "$d/name")" ; \ done \ | sort -n \ | awk '{print $0; s+=$1} END{printf("%10.2f\n", s)}' Signed-off-by: Thomas Haller Signed-off-by: Florian Westphal --- tests/shell/helpers/test-wrapper.sh | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'tests/shell/helpers/test-wrapper.sh') diff --git a/tests/shell/helpers/test-wrapper.sh b/tests/shell/helpers/test-wrapper.sh index b8a54ed7..e745df85 100755 --- a/tests/shell/helpers/test-wrapper.sh +++ b/tests/shell/helpers/test-wrapper.sh @@ -9,6 +9,8 @@ TEST="$1" TESTBASE="$(basename "$TEST")" TESTDIR="$(dirname "$TEST")" +START_TIME="$(cut -d ' ' -f1 /proc/uptime)" + CLEANUP_UMOUNT_RUN_NETNS=n cleanup() { @@ -99,4 +101,8 @@ else fi fi +END_TIME="$(cut -d ' ' -f1 /proc/uptime)" +WALL_TIME="$(awk -v start="$START_TIME" -v end="$END_TIME" "BEGIN { print(end - start) }")" +printf "%s\n" "$WALL_TIME" "$START_TIME" "$END_TIME" > "$NFT_TEST_TESTTMPDIR/times" + exit "$rc_exit" -- cgit v1.2.3