Skip to content

Commit 97df7fc

Browse files
committed
Abort test script when subprocesses fail
1 parent 45f7721 commit 97df7fc

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

tests/test-plugins.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
#! /bin/bash
22

3+
set -eo pipefail
4+
35
repodir="${REPODIR:-"$(git rev-parse --show-toplevel)"}"
46
appdir="${APPDIR:-"$(mktemp --tmpdir --directory AppDir.XXXXXXXX)"}"
57
count=0
68
failed=0
79

810
run_valid_command() {
11+
set +e
912
((count++))
1013
if out="$("$@" 2>&1 )"; then
1114
echo -e "[\033[1;32m OK \033[0m]"
@@ -14,9 +17,11 @@ run_valid_command() {
1417
((failed++))
1518
echo "$out"
1619
fi
20+
set -e
1721
}
1822

1923
run_invalid_command() {
24+
set +e
2025
((count++))
2126
if out="$("$@" 2>&1 )"; then
2227
echo -e "[\033[1;31mFAILED\033[0m]"
@@ -25,6 +30,7 @@ run_invalid_command() {
2530
else
2631
echo -e "[\033[1;32m OK \033[0m]"
2732
fi
33+
set -e
2834
}
2935

3036
while IFS= read -r -d '' plugin; do

0 commit comments

Comments
 (0)