summaryrefslogtreecommitdiffstats
path: root/run-tests.sh
diff options
context:
space:
mode:
authorPrashanth Pai <ppai@redhat.com>2016-02-11 18:54:41 +0530
committerRaghavendra Talur <rtalur@redhat.com>2016-02-15 09:27:04 -0800
commit5858b2b1b568f253dbee818d4017f4c0fb642ae4 (patch)
tree093faad2bcc711b4c1b9d1517d7aca26981058b0 /run-tests.sh
parentd4c415776b20e4152d4a706276cb06d833a58baa (diff)
Mark slowest tests in regression test output
Recording of elapsed time is only accurate to the second. This should be okay. Some *BSD systems may not have '%N' support in date command. Change-Id: I81e887c4783b052317922f3a4af37ec3676fb67d Signed-off-by: Prashanth Pai <ppai@redhat.com> Reviewed-on: http://review.gluster.org/13430 Smoke: Gluster Build System <jenkins@build.gluster.com> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Raghavendra Talur <rtalur@redhat.com>
Diffstat (limited to 'run-tests.sh')
-rwxr-xr-xrun-tests.sh12
1 files changed, 12 insertions, 0 deletions
diff --git a/run-tests.sh b/run-tests.sh
index 57c81224324..fe58ed68b56 100755
--- a/run-tests.sh
+++ b/run-tests.sh
@@ -192,6 +192,9 @@ function run_tests()
FAILED=''
GENERATED_CORE=''
+ # key = path of .t file; value = time taken to run the .t file
+ declare -A ELAPSEDTIMEMAP
+
for t in $(find ${regression_testsdir}/tests -name '*.t' \
| LC_COLLATE=C sort) ; do
old_cores=$(ls /core.* 2> /dev/null | wc -l)
@@ -205,8 +208,10 @@ function run_tests()
continue
fi
echo "Running tests in file $t"
+ starttime="$(date +%s)"
prove -mf --timer $t
TMP_RES=$?
+ ELAPSEDTIMEMAP[$t]=`expr $(date +%s) - $starttime`
if [ ${TMP_RES} -ne 0 ] && [ "x${retry}" = "xyes" ] ; then
echo "$t: bad status $TMP_RES"
echo ""
@@ -248,6 +253,13 @@ function run_tests()
GENERATED_CORE_COUNT=$( echo -n "${GENERATED_CORE}" | grep -c '^' )
echo -e "$GENERATED_CORE_COUNT test(s) generated core \n${GENERATED_CORE}"
fi
+
+ echo "Slowest 10 tests: "
+ for key in "${!ELAPSEDTIMEMAP[@]}"
+ do
+ echo $key ' - ' ${ELAPSEDTIMEMAP["$key"]}
+ done | sort -rn -k3 | head
+
echo "Result is $RES"
return ${RES}
}