diff options
author | Eric Sunshine <sunshine@sunshineco.com> | 2021-12-09 00:11:06 -0500 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2021-12-13 10:29:48 -0800 |
commit | 74d2f5695dab4454097b2d1693f7206e8328724a (patch) | |
tree | 6d4a147a909ef45477fd1509e83530b7ed39bec9 /t/perf | |
parent | tests: use test_write_lines() to generate line-oriented output (diff) | |
download | tgif-74d2f5695dab4454097b2d1693f7206e8328724a.tar.xz |
tests: fix broken &&-chains in compound statements
The top-level &&-chain checker built into t/test-lib.sh causes tests to
magically exit with code 117 if the &&-chain is broken. However, it has
the shortcoming that the magic does not work within `{...}` groups,
`(...)` subshells, `$(...)` substitutions, or within bodies of compound
statements, such as `if`, `for`, `while`, `case`, etc. `chainlint.sed`
partly fills in the gap by catching broken &&-chains in `(...)`
subshells, but bugs can still lurk behind broken &&-chains in the other
cases.
Fix broken &&-chains in compound statements in order to reduce the
number of possible lurking bugs.
Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Reviewed-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/perf')
-rwxr-xr-x | t/perf/p0005-status.sh | 12 | ||||
-rwxr-xr-x | t/perf/p0006-read-tree-checkout.sh | 20 | ||||
-rwxr-xr-x | t/perf/p0007-write-cache.sh | 4 | ||||
-rwxr-xr-x | t/perf/p5302-pack-index.sh | 2 | ||||
-rwxr-xr-x | t/perf/p5303-many-packs.sh | 8 |
5 files changed, 23 insertions, 23 deletions
diff --git a/t/perf/p0005-status.sh b/t/perf/p0005-status.sh index 0b0aa9858f..ca58d6c9b5 100755 --- a/t/perf/p0005-status.sh +++ b/t/perf/p0005-status.sh @@ -24,17 +24,17 @@ test_perf_default_repo test_expect_success "setup repo" ' if git rev-parse --verify refs/heads/p0006-ballast^{commit} then - echo Assuming synthetic repo from many-files.sh - git branch br_base master - git branch br_ballast p0006-ballast - git config --local core.sparsecheckout 1 + echo Assuming synthetic repo from many-files.sh && + git branch br_base master && + git branch br_ballast p0006-ballast && + git config --local core.sparsecheckout 1 && cat >.git/info/sparse-checkout <<-EOF /* !ballast/* EOF else - echo Assuming non-synthetic repo... - git branch br_base $(git rev-list HEAD | tail -n 1) + echo Assuming non-synthetic repo... && + git branch br_base $(git rev-list HEAD | tail -n 1) && git branch br_ballast HEAD fi && git checkout -q br_ballast && diff --git a/t/perf/p0006-read-tree-checkout.sh b/t/perf/p0006-read-tree-checkout.sh index 78cc23fe2f..900b385c4b 100755 --- a/t/perf/p0006-read-tree-checkout.sh +++ b/t/perf/p0006-read-tree-checkout.sh @@ -24,21 +24,21 @@ test_perf_default_repo test_expect_success "setup repo" ' if git rev-parse --verify refs/heads/p0006-ballast^{commit} then - echo Assuming synthetic repo from many-files.sh - git branch br_base master - git branch br_ballast p0006-ballast^ - git branch br_ballast_alias p0006-ballast^ - git branch br_ballast_plus_1 p0006-ballast - git config --local core.sparsecheckout 1 + echo Assuming synthetic repo from many-files.sh && + git branch br_base master && + git branch br_ballast p0006-ballast^ && + git branch br_ballast_alias p0006-ballast^ && + git branch br_ballast_plus_1 p0006-ballast && + git config --local core.sparsecheckout 1 && cat >.git/info/sparse-checkout <<-EOF /* !ballast/* EOF else - echo Assuming non-synthetic repo... - git branch br_base $(git rev-list HEAD | tail -n 1) - git branch br_ballast HEAD^ || error "no ancestor commit from current head" - git branch br_ballast_alias HEAD^ + echo Assuming non-synthetic repo... && + git branch br_base $(git rev-list HEAD | tail -n 1) && + git branch br_ballast HEAD^ || error "no ancestor commit from current head" && + git branch br_ballast_alias HEAD^ && git branch br_ballast_plus_1 HEAD fi && git checkout -q br_ballast && diff --git a/t/perf/p0007-write-cache.sh b/t/perf/p0007-write-cache.sh index 09595264f0..25d8ff7443 100755 --- a/t/perf/p0007-write-cache.sh +++ b/t/perf/p0007-write-cache.sh @@ -9,8 +9,8 @@ test_perf_default_repo test_expect_success "setup repo" ' if git rev-parse --verify refs/heads/p0006-ballast^{commit} then - echo Assuming synthetic repo from many-files.sh - git config --local core.sparsecheckout 1 + echo Assuming synthetic repo from many-files.sh && + git config --local core.sparsecheckout 1 && cat >.git/info/sparse-checkout <<-EOF /* !ballast/* diff --git a/t/perf/p5302-pack-index.sh b/t/perf/p5302-pack-index.sh index 228593d9ad..654cd9c86e 100755 --- a/t/perf/p5302-pack-index.sh +++ b/t/perf/p5302-pack-index.sh @@ -21,7 +21,7 @@ test_expect_success 'set up thread-counting tests' ' threads= && while test $t -gt 0 do - threads="$t $threads" + threads="$t $threads" && t=$((t / 2)) done ' diff --git a/t/perf/p5303-many-packs.sh b/t/perf/p5303-many-packs.sh index 35c0cbdf49..58213fe171 100755 --- a/t/perf/p5303-many-packs.sh +++ b/t/perf/p5303-many-packs.sh @@ -126,10 +126,10 @@ done # Measure pack loading with 10,000 packs. test_expect_success 'generate lots of packs' ' for i in $(test_seq 10000); do - echo "blob" - echo "data <<EOF" - echo "blob $i" - echo "EOF" + echo "blob" && + echo "data <<EOF" && + echo "blob $i" && + echo "EOF" && echo "checkpoint" done | git -c fastimport.unpackLimit=0 fast-import |