Skip to content
This repository was archived by the owner on May 7, 2024. It is now read-only.

Commit 1c00b64

Browse files
committed
meta: build-time package integrity check refining
- exportvars/tests: new file to mark variables used - proc: increase verbosity; Refinements - tests/00-self_file.sh: fix inappropriate parameters when calling non-zero handler Signed-off-by: Camber Huang <camber@poi.science>
1 parent 0d10b8b commit 1c00b64

File tree

5 files changed

+17
-9
lines changed

5 files changed

+17
-9
lines changed

exportvars/tests

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
ABTEST_ENABLED
2+
ABTEST_TYPE
3+
ABTEST_TESTPROBES

proc/81-test_funcs.sh

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
#!/bin/bash
22
##proc/build_funcs: Loads the tests/ functions
33
##@copyright GPL-2.0+
4-
for i in "$AB/tests"/*.sh
5-
do
6-
. "$i"
7-
done
4+
if bool $ABTEST_ENABLED; then
5+
for i in "$AB/tests"/*.sh
6+
do
7+
. "$i"
8+
done
9+
fi

proc/82-test_probe.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,11 @@
77

88
if bool $ABTEST_ENABLED; then
99
if [ -z "$ABTEST_TYPE"]; then
10+
abinfo "No $ABTEST_TYPE set, automatically determining ..."
1011
for i in $ABTEST_TESTPROBES; do
1112
if abtest_${i}_probe; then
12-
export ABTEST_TYPE=$i
13+
abinfo "Automatically set ABTEST_TYPE to ${i}"
14+
ABTEST_TYPE=$i
1315
break
1416
fi
1517
done

proc/83-test_exec.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ abtrylib tests || ablibret
66

77
if bool $ABTEST_ENABLED; then
88
cd "$SRCDIR"
9+
# FIXME: use a non-zero handler?
910
abtest_${ABTEST_TYPE}_test || \
1011
abwarn "Test exited with non-zero status: $?"
1112
fi

tests/00-self_file.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,20 @@ abtest_self_file_test() {
1313
. "$AB/lib/tests.sh"
1414

1515
abtest() {
16-
abwarn "ABTEST_TYPE is set to self, but no abtest() found in autobuild{,/\$ARCH}/test"
16+
abwarn "ABTEST_TYPE is set to self_file, but no abtest() found in autobuild{,/\$ARCH}/test"
1717
return 127
1818
}
1919

2020
abtest_unprivileged() {
21-
abwarn "ABTEST_TYPE is set to self, but no abtest_unprivileged() found in autobuild{,/\$ARCH}/test"
21+
abwarn "ABTEST_TYPE is set to self_file, but no abtest_unprivileged() found in autobuild{,/\$ARCH}/test"
2222
return 127
2323
}
2424

2525
# Redefine
2626
arch_loadfile test
2727

28-
abtest || abtest_non-zero-handler $1 "$SRCDIR"/test
29-
abtest_unprivileged || abtest_unprivileged_non-zero-handler $1 "$SRCDIR"/test
28+
abtest || abtest_non-zero-handler $? "$SRCDIR"/test
29+
abtest_unprivileged || abtest_unprivileged_non-zero-handler $? "$SRCDIR"/test
3030
}
3131

3232
ABTEST_TESTPROBES+=' self_file'

0 commit comments

Comments
 (0)