From f09c82886544e3fb14c1853b656029339fa688b5 Mon Sep 17 00:00:00 2001
From: davidovski <david@davidovski.xyz>
Date: Fri, 9 Jun 2023 14:43:30 +0100
Subject: Add timing to shtests

---
 src/util/shtests.sh | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

(limited to 'src/util')

diff --git a/src/util/shtests.sh b/src/util/shtests.sh
index 69da232..44ad48e 100644
--- a/src/util/shtests.sh
+++ b/src/util/shtests.sh
@@ -48,6 +48,7 @@ passed=0
 failed=0
 
 printf "${BLUE}Running $total tests: \n"
+start=$(date +%s%N)
 for name in $tests; do
     if runtest "$name" "test_$name"; then
         passed=$((passed+1))
@@ -55,10 +56,12 @@ for name in $tests; do
         failed=$((failed+1))
     fi
 done
+end=$(date +%s%N)
 
-printf "\n${BLUE}Summary for $total tests:\n"
-printf "\t${PASS} $passed\n"
-printf "\t${FAIL} $failed\n"
+printf "\n${BLUE}Summary for %s tests:\n" "$total"
+printf "\t${PASS} %s\n" "$passed"
+printf "\t${FAIL} %s\n" "$failed"
+printf "\n${LIGHT_BLUE}%s${BLUE} tests completed in ${LIGHT_BLUE}%sms\n" "$total" "$(((end-start)/1000000))"
 printf "\n"
 
 [ "$passed" = "$total" ] || exit 1
-- 
cgit v1.2.1