t/perf/p7519: speed up test on Windows

Change p7519 to use `test_seq` and `xargs` rather than a `for` loop to touch thousands of files. This takes minutes off of test runs on Windows because of process creation overhead. Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jeff Hostetler committed Mar 25, 2022 at 18:03 UTC 86f7433f9711012fcd9857974fc43dfd693b0aa9
1 file changed +16 -8
t/perf/p7519-fsmonitor.sh
+16 -8
@@ -98,6 +98,13 @@ trace_stop () {
98 fi
99 }
100
101 +touch_files () {
102 + n=$1 &&
103 + d="$n"_files &&
104 +
105 + (cd $d && test_seq 1 $n | xargs touch )
106 +}
107 +
108 test_expect_success "one time repo setup" '
109 # set untrackedCache depending on the environment
110 if test -n "$GIT_PERF_7519_UNTRACKED_CACHE"
@@ -119,10 +126,11 @@ test_expect_success "one time repo setup" '
126 fi &&
127
128 mkdir 1_file 10_files 100_files 1000_files 10000_files &&
122 - for i in $(test_seq 1 10); do touch 10_files/$i || return 1; done &&
123 - for i in $(test_seq 1 100); do touch 100_files/$i || return 1; done &&
124 - for i in $(test_seq 1 1000); do touch 1000_files/$i || return 1; done &&
125 - for i in $(test_seq 1 10000); do touch 10000_files/$i || return 1; done &&
129 + : 1_file directory should be left empty &&
130 + touch_files 10 &&
131 + touch_files 100 &&
132 + touch_files 1000 &&
133 + touch_files 10000 &&
134 git add 1_file 10_files 100_files 1000_files 10000_files &&
135 git commit -qm "Add files" &&
136
@@ -199,15 +207,15 @@ test_fsmonitor_suite () {
207
208 # Update the mtimes on upto 100k files to make status think
209 # that they are dirty. For simplicity, omit any files with
202 - # LFs (i.e. anything that ls-files thinks it needs to dquote).
203 - # Then fully backslash-quote the paths to capture any
204 - # whitespace so that they pass thru xargs properly.
210 + # LFs (i.e. anything that ls-files thinks it needs to dquote)
211 + # and any files with whitespace so that they pass thru xargs
212 + # properly.
213 #
214 test_perf_w_drop_caches "status (dirty) ($DESC)" '
215 git ls-files | \
216 head -100000 | \
217 grep -v \" | \
210 - sed '\''s/\(.\)/\\\1/g'\'' | \
218 + grep -v " ." | \
219 xargs test-tool chmtime -300 &&
220 git status
221 '