Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/t/perf
diff options
context:
space:
mode:
authorEric Sunshine <sunshine@sunshineco.com>2021-12-09 08:11:12 +0300
committerJunio C Hamano <gitster@pobox.com>2021-12-13 21:29:48 +0300
commitdb5875aa9fe056c2db3a463989091c5f70d6c8d1 (patch)
tree7009932d4396e0928ca5926ac985e30f1dcce33a /t/perf
parentefe26b9ee09d53dda0f36d0ea20cb245b934f216 (diff)
t0000-t3999: detect and signal failure within loop
Failures within `for` and `while` loops can go unnoticed if not detected and signaled manually since the loop itself does not abort when a contained command fails, nor will a failure necessarily be detected when the loop finishes since the loop returns the exit code of the last command it ran on the final iteration, which may not be the command which failed. Therefore, detect and signal failures manually within loops using the idiom `|| return 1` (or `|| exit 1` within subshells). 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-xt/perf/p0100-globbing.sh4
-rwxr-xr-xt/perf/p1400-update-ref.sh4
-rwxr-xr-xt/perf/p1451-fsck-skip-list.sh2
-rwxr-xr-xt/perf/p3400-rebase.sh2
-rwxr-xr-xt/perf/p5302-pack-index.sh2
-rwxr-xr-xt/perf/p5303-many-packs.sh2
-rwxr-xr-xt/perf/p7519-fsmonitor.sh8
7 files changed, 12 insertions, 12 deletions
diff --git a/t/perf/p0100-globbing.sh b/t/perf/p0100-globbing.sh
index dd18a9ce2b..439e9c8e3c 100755
--- a/t/perf/p0100-globbing.sh
+++ b/t/perf/p0100-globbing.sh
@@ -19,9 +19,9 @@ test_expect_success 'setup' '
printf "a" >>refname &&
for j in $(test_seq 1 $i)
do
- printf "a*" >>refglob.$i
+ printf "a*" >>refglob.$i || return 1
done &&
- echo b >>refglob.$i
+ echo b >>refglob.$i || return 1
done &&
test_commit test $(cat refname).t "" $(cat refname).t
'
diff --git a/t/perf/p1400-update-ref.sh b/t/perf/p1400-update-ref.sh
index dda8a74866..a75969cbb1 100755
--- a/t/perf/p1400-update-ref.sh
+++ b/t/perf/p1400-update-ref.sh
@@ -13,7 +13,7 @@ test_expect_success "setup" '
do
printf "start\ncreate refs/heads/%d PRE\ncommit\n" $i &&
printf "start\nupdate refs/heads/%d POST PRE\ncommit\n" $i &&
- printf "start\ndelete refs/heads/%d POST\ncommit\n" $i
+ printf "start\ndelete refs/heads/%d POST\ncommit\n" $i || return 1
done >instructions
'
@@ -22,7 +22,7 @@ test_perf "update-ref" '
do
git update-ref refs/heads/branch PRE &&
git update-ref refs/heads/branch POST PRE &&
- git update-ref -d refs/heads/branch
+ git update-ref -d refs/heads/branch || return 1
done
'
diff --git a/t/perf/p1451-fsck-skip-list.sh b/t/perf/p1451-fsck-skip-list.sh
index c2b97d2487..f767d834f2 100755
--- a/t/perf/p1451-fsck-skip-list.sh
+++ b/t/perf/p1451-fsck-skip-list.sh
@@ -15,7 +15,7 @@ test_expect_success "setup $n bad commits" '
echo "committer C <c@example.com> 1234567890 +0000" &&
echo "data <<EOF" &&
echo "$i.Q." &&
- echo "EOF"
+ echo "EOF" || return 1
done | q_to_nul | git fast-import
'
diff --git a/t/perf/p3400-rebase.sh b/t/perf/p3400-rebase.sh
index 43d5a34e8c..e6b0277729 100755
--- a/t/perf/p3400-rebase.sh
+++ b/t/perf/p3400-rebase.sh
@@ -22,7 +22,7 @@ test_expect_success 'setup rebasing on top of a lot of changes' '
git add unrelated-file$i &&
test_tick &&
git commit -m commit$i-reverse unrelated-file$i ||
- break
+ return 1
done &&
git checkout to-rebase &&
test_commit our-patch interesting-file
diff --git a/t/perf/p5302-pack-index.sh b/t/perf/p5302-pack-index.sh
index 654cd9c86e..c16f6a3ff6 100755
--- a/t/perf/p5302-pack-index.sh
+++ b/t/perf/p5302-pack-index.sh
@@ -22,7 +22,7 @@ test_expect_success 'set up thread-counting tests' '
while test $t -gt 0
do
threads="$t $threads" &&
- t=$((t / 2))
+ t=$((t / 2)) || return 1
done
'
diff --git a/t/perf/p5303-many-packs.sh b/t/perf/p5303-many-packs.sh
index 58213fe171..af173a7b73 100755
--- a/t/perf/p5303-many-packs.sh
+++ b/t/perf/p5303-many-packs.sh
@@ -130,7 +130,7 @@ test_expect_success 'generate lots of packs' '
echo "data <<EOF" &&
echo "blob $i" &&
echo "EOF" &&
- echo "checkpoint"
+ echo "checkpoint" || return 1
done |
git -c fastimport.unpackLimit=0 fast-import
'
diff --git a/t/perf/p7519-fsmonitor.sh b/t/perf/p7519-fsmonitor.sh
index 5eb5044a10..c8be58f3c7 100755
--- a/t/perf/p7519-fsmonitor.sh
+++ b/t/perf/p7519-fsmonitor.sh
@@ -119,10 +119,10 @@ test_expect_success "one time repo setup" '
fi &&
mkdir 1_file 10_files 100_files 1000_files 10000_files &&
- for i in $(test_seq 1 10); do touch 10_files/$i; done &&
- for i in $(test_seq 1 100); do touch 100_files/$i; done &&
- for i in $(test_seq 1 1000); do touch 1000_files/$i; done &&
- for i in $(test_seq 1 10000); do touch 10000_files/$i; done &&
+ for i in $(test_seq 1 10); do touch 10_files/$i || return 1; done &&
+ for i in $(test_seq 1 100); do touch 100_files/$i || return 1; done &&
+ for i in $(test_seq 1 1000); do touch 1000_files/$i || return 1; done &&
+ for i in $(test_seq 1 10000); do touch 10000_files/$i || return 1; done &&
git add 1_file 10_files 100_files 1000_files 10000_files &&
git commit -qm "Add files" &&