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

[PATCH] t/perf/perf-lib.sh: remove test_times.* at the end test_perf_()

From
JGJeff Hostetler via GitGitGadget <gitgitgadget@gmail.com>
Date
Oct 4, 2021, 22:29 UTC
Message-ID
<pull.1051.git.1633386543759.gitgitgadget@gmail.com>
From: Jeff Hostetler <jeffhost@microsoft.com>

Teach test_perf_() to remove the temporary test_times.* files at the end of each test.

test_perf_() runs a particular GIT_PERF_REPEAT_COUNT times and creates ./test_times.[123...]. It then uses a perl script to find the minimum over "./test_times.*" (note the wildcard) and writes that time to "test-results/<testname>.<testnumber>.result".

If the repeat count is changed during the pXXXX test script, stale test_times.* files (from previous steps) may be included in the min() computation. For example:

...
GIT_PERF_REPEAT_COUNT=3 \
test_perf "status" "
	git status
"
GIT_PERF_REPEAT_COUNT=1 \
test_perf "checkout other" "
	git checkout other
"
...

The time reported in the summary for "XXXX.2 checkout other" would be "min( checkout[1], status[2], status[3] )".

We prevent that error by removing the test_times.* files at the end of each test.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
---
    t/perf/perf-lib.sh: remove test_times.* at the end test_perf_()
    
    Teach test_perf_() to remove the temporary test_times.* files at the end
    of each test.
    
    test_perf_() runs a particular GIT_PERF_REPEAT_COUNT times and creates
    ./test_times.[123...]. It then uses a perl script to find the minimum
    over "./test_times.*" (note the wildcard) and writes that time to
    "test-results/..result".
    
    If the repeat count is changed during the pXXXX test script, stale
    test_times.* files (from previous steps) may be included in the min()
    computation. For example:
    
    ... GIT_PERF_REPEAT_COUNT=3
    test_perf "status" " git status "
    
    GIT_PERF_REPEAT_COUNT=1
    test_perf "checkout other" " git checkout other " ...
    
    The time reported in the summary for "XXXX.2 checkout other" would be
    "min( checkout[1], status[2], status[3] )".
    
    We prevent that error by removing the test_times.* files at the end of
    each test.
    
    Signed-off-by: Jeff Hostetler jeffhost@microsoft.com
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-1051%2Fjeffhostetler%2Fperf-test-remove-test-times-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1051/jeffhostetler/perf-test-remove-test-times-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/1051
 t/perf/perf-lib.sh | 1 +
 1 file changed, 1 insertion(+)
diff --git a/t/perf/perf-lib.sh b/t/perf/perf-lib.sh
index f5ed092ee59..a1b5d2804dc 100644
--- a/t/perf/perf-lib.sh
+++ b/t/perf/perf-lib.sh
@@ -230,6 +230,7 @@ test_perf_ () {
 		test_ok_ "$1"
 	fi
 	"$TEST_DIRECTORY"/perf/min_time.perl test_time.* >"$base".result
+	rm test_time.*
 }
 
 test_perf () {

base-commit: 0785eb769886ae81e346df10e88bc49ffc0ac64e
-- 
gitgitgadget
Next: Taylor Blau
Message 1 of 11 in “t/perf/perf-lib.sh: remove test_times.* at the end test_perf_()”
  1. t/perf/perf-lib.sh: remove test_times.* at the end test_perf_()Jeff Hostetler via GitGitGadget, Oct 4, 2021
  2. Taylor BlauOct 5, 2021
  3. Jeff KingOct 6, 2021
  4. Taylor BlauOct 6, 2021
  5. Jeff HostetlerOct 7, 2021
  6. Jeff KingOct 8, 2021
  7. A hard dependency on "hyperfine" for t/perfÆvar Arnfjörð Bjarmason, Oct 8, 2021
  8. Junio C HamanoOct 8, 2021
  9. Jeff KingOct 8, 2021
  10. SZEDER GáborOct 10, 2021
  11. Jeff HostetlerOct 13, 2021

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.