From 5858b2b1b568f253dbee818d4017f4c0fb642ae4 Mon Sep 17 00:00:00 2001 From: Prashanth Pai Date: Thu, 11 Feb 2016 18:54:41 +0530 Subject: 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 Reviewed-on: http://review.gluster.org/13430 Smoke: Gluster Build System NetBSD-regression: NetBSD Build System CentOS-regression: Gluster Build System Reviewed-by: Raghavendra Talur --- run-tests.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'run-tests.sh') 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} } -- cgit