explicitly exit from TEST_exit
This prevents some odd interactions with the EXIT trap, and our last command's status is seemingly not preserved for the script's real exit. Add a BASH override to the Makefile as well, as it might be useful for debugging or testing against other versions of bash.
This commit is contained in:
parent
7b4cf9a637
commit
25c058a2a2
4
Makefile
4
Makefile
@ -7,6 +7,8 @@ BINPROGS = \
|
||||
genfstab \
|
||||
pacstrap
|
||||
|
||||
BASH = bash
|
||||
|
||||
all: $(BINPROGS)
|
||||
|
||||
V_GEN = $(_v_GEN_$(V))
|
||||
@ -23,7 +25,7 @@ clean:
|
||||
|
||||
check: all
|
||||
@for f in $(BINPROGS); do bash -O extglob -n $$f; done
|
||||
@r=0; for t in test/test_*; do $$t || r=1; done; exit $$r
|
||||
@r=0; for t in test/test_*; do $(BASH) $$t || { echo $$t fail; r=1; }; done; exit $$r
|
||||
|
||||
install: all
|
||||
install -dm755 $(DESTDIR)$(PREFIX)/bin
|
||||
|
@ -27,6 +27,8 @@ TEST_exit() {
|
||||
(( fail == 0 )) && result=PASS || result=FAIL
|
||||
|
||||
printf '%s: %s\n' "$result" "$1"
|
||||
|
||||
exit $(( fail != 0 ))
|
||||
}
|
||||
|
||||
ASSERT_streq() {
|
||||
|
@ -53,5 +53,3 @@ EXPECT_success optstring_match_option key key=val
|
||||
EXPECT_success optstring_match_option key=val key=val
|
||||
EXPECT_failure optstring_match_option key=val key=val2
|
||||
EXPECT_failure optstring_match_option 'key=*' key=val2
|
||||
|
||||
(( fail == 0 ))
|
||||
|
@ -3,7 +3,6 @@
|
||||
. "${1:-./common}"
|
||||
. ./test/common
|
||||
|
||||
|
||||
EXPECT_success valid_number_of_base 16 feedfacebeef
|
||||
EXPECT_failure valid_number_of_base 16 feedsfacebeef
|
||||
EXPECT_success valid_number_of_base 16 1234567890
|
||||
@ -13,5 +12,3 @@ EXPECT_failure valid_number_of_base 10 1234.567890
|
||||
EXPECT_failure valid_number_of_base 10 1234567890abcdef
|
||||
|
||||
EXPECT_success valid_number_of_base 18 1234567890abcdefghi
|
||||
|
||||
(( fail == 0 ))
|
||||
|
Loading…
Reference in New Issue
Block a user