diff options
author | Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com> | 2024-11-25 10:17:15 +0100 |
---|---|---|
committer | Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com> | 2024-11-27 13:55:06 +0100 |
commit | 3fbdda4978b278b80aa6417116004d7bef068a67 (patch) | |
tree | f9729d9d8232e75c73ea6da107413ea334d324e9 | |
parent | imsm: fix tpv drvies check in add_to_super (diff) | |
download | mdadm-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-x | test | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -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 |