Skip to content

Commit 86f7433

Browse files
jeffhostetlergitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 8aa0209 commit 86f7433

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

t/perf/p7519-fsmonitor.sh

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,13 @@ trace_stop () {
9898
fi
9999
}
100100

101+
touch_files () {
102+
n=$1 &&
103+
d="$n"_files &&
104+
105+
(cd $d && test_seq 1 $n | xargs touch )
106+
}
107+
101108
test_expect_success "one time repo setup" '
102109
# set untrackedCache depending on the environment
103110
if test -n "$GIT_PERF_7519_UNTRACKED_CACHE"
@@ -119,10 +126,11 @@ test_expect_success "one time repo setup" '
119126
fi &&
120127
121128
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 &&
126134
git add 1_file 10_files 100_files 1000_files 10000_files &&
127135
git commit -qm "Add files" &&
128136
@@ -199,15 +207,15 @@ test_fsmonitor_suite () {
199207

200208
# Update the mtimes on upto 100k files to make status think
201209
# 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.
205213
#
206214
test_perf_w_drop_caches "status (dirty) ($DESC)" '
207215
git ls-files | \
208216
head -100000 | \
209217
grep -v \" | \
210-
sed '\''s/\(.\)/\\\1/g'\'' | \
218+
grep -v " ." | \
211219
xargs test-tool chmtime -300 &&
212220
git status
213221
'

0 commit comments

Comments
 (0)