Skip to content

Commit ac48da5

Browse files
avarttaylorr
authored andcommitted
submodule tests: reset "trace.out" between "grep" invocations
Fix test patterns added in 62104ba (submodules: allow parallel fetching, add tests and documentation, 2015-12-15) and a028a19 (fetching submodules: respect `submodule.fetchJobs` config option, 2016-02-29). In the former case we were leaving a trace.out file at the top-level for any subsequent tests (there are none, currently). Let's clean the file up instead. In the latter case we were testing that a given configuration would result in "N tasks" in the log, but we were grepping through the log for all previous such tests, when we really meant to clear the logs between the "grep" invocations. In practice this resulted in no logic error, as e.g. "--fetch 7" would not print out a "9 tasks" line, but let's be paranoid and stop implicitly assuming that that's the case. This change was originally left out of 51243f9 (run-command API: don't fall back on online_cpus(), 2022-10-12), which added the ">trace.out" seen at the end of the context. Signed-off-by: Ævar Arnfjörð Bjarmason <[email protected]> Signed-off-by: Taylor Blau <[email protected]>
1 parent 035cccf commit ac48da5

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

t/t5526-fetch-submodules.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,7 @@ test_expect_success "submodule.recurse option triggers recursive fetch" '
178178
'
179179

180180
test_expect_success "fetch --recurse-submodules -j2 has the same output behaviour" '
181+
test_when_finished "rm -f trace.out" &&
181182
add_submodule_commits &&
182183
(
183184
cd downstream &&
@@ -705,15 +706,22 @@ test_expect_success "'fetch.recurseSubmodules=on-demand' works also without .git
705706

706707
test_expect_success 'fetching submodules respects parallel settings' '
707708
git config fetch.recurseSubmodules true &&
709+
test_when_finished "rm -f downstream/trace.out" &&
708710
(
709711
cd downstream &&
710712
GIT_TRACE=$(pwd)/trace.out git fetch &&
711713
grep "1 tasks" trace.out &&
714+
>trace.out &&
715+
712716
GIT_TRACE=$(pwd)/trace.out git fetch --jobs 7 &&
713717
grep "7 tasks" trace.out &&
718+
>trace.out &&
719+
714720
git config submodule.fetchJobs 8 &&
715721
GIT_TRACE=$(pwd)/trace.out git fetch &&
716722
grep "8 tasks" trace.out &&
723+
>trace.out &&
724+
717725
GIT_TRACE=$(pwd)/trace.out git fetch --jobs 9 &&
718726
grep "9 tasks" trace.out &&
719727
>trace.out &&

0 commit comments

Comments
 (0)