git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] perf-lib: remove old result files before running tests

From
Thomas Gummerer <t.gummerer@gmail.com>
Date
Nov 19, 2019, 18:50 UTC
Message-ID
<20191119185047.8550-1-t.gummerer@gmail.com>

The perf tests write files recording the results of tests. These results are later aggregated by 'aggregate.perl'. If the tests are run multiple times, those results are overwritten by the new results. This works just fine as long as there are only perf tests measuring the times, whose results are stored in "$base".times files.

However 22bec79d1a ("t/perf: add infrastructure for measuring sizes", 2018-08-17) introduced a new type of test for measuring the size of something. The results of this are written to "$base".size files.

"$base" is essentially made up of the basename of the script plus the test number. So if test numbers shift because a new test was introduced earlier in the script we might end up with both a ".times" and a ".size" file for the same test. In the aggregation script the ".times" file is preferred over the ".size" file, so some size tests might end with performance numbers from a previous run of the test.

This is mainly relevant when writing perf tests that check both performance and sizes, and can get quite confusing during developement.

Signed-off-by: Thomas Gummerer <t.gummerer@gmail.com>
---

This came out of something different that I'm working on, but makes most sense as a standalone patch, rather than part of that series, so I'm sending this out separately.

 t/perf/perf-lib.sh | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/t/perf/perf-lib.sh b/t/perf/perf-lib.sh
index b58a43ea43..7e80251889 100644
--- a/t/perf/perf-lib.sh
+++ b/t/perf/perf-lib.sh
@@ -178,10 +178,11 @@ test_wrapper_ () {
 	export test_prereq
 	if ! test_skip "$@"
 	then
-		base=$(basename "$0" .sh)
-		echo "$test_count" >>"$perf_results_dir"/$base.subtests
-		echo "$1" >"$perf_results_dir"/$base.$test_count.descr
 		base="$perf_results_dir"/"$PERF_RESULTS_PREFIX$(basename "$0" .sh)"."$test_count"
+		rm -f "$base".*
+		no_prefix_base="$perf_results_dir"/$(basename "$0" .sh)
+		echo "$test_count" >>$no_prefix_base.subtests
+		echo "$1" >$no_prefix_base.$test_count.descr
 		"$test_wrapper_func_" "$@"
 	fi
 
-- 
2.24.0.155.gd9f6f3b619
Next: Junio C Hamano
Message 1 of 7 in “perf-lib: remove old result files before running tests”
  1. perf-lib: remove old result files before running testsThomas Gummerer, Nov 19, 2019
  2. Junio C HamanoNov 20, 2019
  3. Thomas GummererNov 20, 2019
  4. Jeff KingNov 21, 2019
  5. Thomas GummererNov 22, 2019
  6. Jeff KingNov 25, 2019
  7. Thomas GummererNov 25, 2019

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.