summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>2024-11-25 10:17:15 +0100
committerMariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>2024-11-27 13:55:06 +0100
commit3fbdda4978b278b80aa6417116004d7bef068a67 (patch)
treef9729d9d8232e75c73ea6da107413ea334d324e9
parentimsm: fix tpv drvies check in add_to_super (diff)
downloadmdadm-3fbdda4978b278b80aa6417116004d7bef068a67.tar.xz
mdadm-3fbdda4978b278b80aa6417116004d7bef068a67.zip
test: Log execution time
To start optymalizing test suite, we need to know which tests are the most time consuming. Log execution time after every test. Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
-rwxr-xr-xtest13
1 files changed, 13 insertions, 0 deletions
diff --git a/test b/test
index f8f07ff4..76e64ea7 100755
--- a/test
+++ b/test
@@ -95,11 +95,22 @@ mdadm() {
return $rv
}
+print_time_elapsed() {
+ local start_sec=$1
+ local end_sec=$(date +%s)
+
+ local execution_time=$((end_sec - start_sec))
+
+ echo -ne "Execution time (seconds): ${execution_time} "
+}
+
do_test() {
_script=$1
_basename=`basename $_script`
_broken=0
+ local start_sec=$(date +%s)
+
if [ -f "$_script" ]
then
if [ -f "${_script}.broken" ]; then
@@ -121,6 +132,7 @@ do_test() {
echo -ne "$_script... "
if ( set -ex ; . $_script ) &> $targetdir/log
then
+ print_time_elapsed $start_sec
if [ -f "${_script}.inject_error" ]; then
echo "dmesg checking is skipped because test inject error"
else
@@ -130,6 +142,7 @@ do_test() {
succeed "succeeded\n"
_fail=0
else
+ print_time_elapsed $start_sec
save_log fail
_fail=1
if [ "$_broken" == "1" ]; then