From 0e66bc1b215b1dd2b0f05c5777eb8ee2ae4e9523 Mon Sep 17 00:00:00 2001 From: Eric Sunshine Date: Mon, 22 Aug 2022 18:26:42 +0000 Subject: t: 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 Signed-off-by: Junio C Hamano --- t/perf/p7527-builtin-fsmonitor.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 't/perf') diff --git a/t/perf/p7527-builtin-fsmonitor.sh b/t/perf/p7527-builtin-fsmonitor.sh index 9338b9ea00..c3f9a4caa4 100755 --- a/t/perf/p7527-builtin-fsmonitor.sh +++ b/t/perf/p7527-builtin-fsmonitor.sh @@ -249,7 +249,7 @@ test_expect_success "Cleanup temp and matrix branches" " do for fsm_val in $fsm_values do - cleanup $uc_val $fsm_val + cleanup $uc_val $fsm_val || return 1 done done " -- cgit v1.3-5-g9baa