From 343ec1061fda6ecbc9782e33a8e4539525899594 Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Mon, 4 May 2020 17:34:59 +0000 Subject: [PATCH] 'make perf': Show only a cumulative datum per highligher, rather than per test file. The overall per-highlighter duration should be less prone to random noise than the multitude of per-test-file figures. --- tests/test-perfs.zsh | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/tests/test-perfs.zsh b/tests/test-perfs.zsh index 2b003fc..a84e147 100755 --- a/tests/test-perfs.zsh +++ b/tests/test-perfs.zsh @@ -62,8 +62,6 @@ run_test_internal() { local srcdir="$PWD" builtin cd -q -- "$tests_tempdir" || { echo >&2 "Bail out! cd failed: $?"; return 1 } - echo -n "# ${1:t:r}: " - # Load the data and prepare checking it. PREBUFFER= BUFFER= ; . "$srcdir"/"$1" @@ -71,9 +69,8 @@ run_test_internal() { # Check the data declares $PREBUFFER or $BUFFER. [[ -z $PREBUFFER && -z $BUFFER ]] && { echo >&2 "Bail out! Either 'PREBUFFER' or 'BUFFER' must be declared and non-blank"; return 1; } - # Measure the time taken by _zsh_highlight. - TIMEFMT="%*Es" - { time (BUFFER="$BUFFER" && _zsh_highlight) } 2>&1 + # Set $? for _zsh_highlight + true && _zsh_highlight } run_test() { @@ -93,9 +90,10 @@ run_test() { # Process each test data file in test data directory. local data_file -for data_file in ${0:h:h}/highlighters/$1/test-data/*.zsh; do +TIMEFMT="%*Es" +{ time (for data_file in ${0:h:h}/highlighters/$1/test-data/*.zsh; do run_test "$data_file" (( $pipestatus[1] )) && exit 2 -done +done) } 2>&1 || exit $? exit 0