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

Commit

Permalink
testing: some changes requested in review session
Browse files Browse the repository at this point in the history
- rename proc/10-tests_pre.sh to proc-tests_scan
- rename ABTEST_USEDEFAULT to ABTEST_AUTO_DETECT
- add a small banner on start and end for autobuild-test
- improve configurability for auto detected custom tests
  • Loading branch information
leedagee committed Sep 23, 2023
1 parent e3f966b commit 19c03ad
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 21 deletions.
15 changes: 9 additions & 6 deletions contrib/autobuild-test
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
#!/bin/bash
# autobuild-test: seperated bash instance for tests

if [[ $# -eq 0 ]]; then
TEST=default
else
TEST=$1
fi

. $AB/lib/diag.sh || { echo "\e[1;91m FATAL: Cannot open stacktrace printing library! exiting."; exit 1; }
. $AB/lib/base.sh || { echo "\e[1;91m FATAL: Cannot open base library! exiting."; exit 1; }
. $AB/lib/builtins.sh || { echo "\e[1;91m FATAL: Cannot open utility function library! exiting."; exit 1; }

echo "================= Running autobuild3 test for $TEST ================="

. $AB/proc/10-core_defines.sh || abdie "Cannot load core_defines.sh, exiting ..."
. $AB/proc/10-env-setup.sh || abdie "Cannot load env-setup.sh, exting ..."

abrequire tests

if [[ $# -eq 0 ]]; then
TEST=default
else
TEST=$1
fi

if [[ "$TEST" == "default" ]]; then
DEFAULT=yes
fi
Expand Down Expand Up @@ -54,4 +56,5 @@ if [[ $EXIT_CODE -gt 2 ]]; then
EXIT_CODE=255
fi

echo "================= Finished autobuild3 test for $TEST ================="
exit $EXIT_CODE
7 changes: 4 additions & 3 deletions etc/autobuild/ab3_defcfg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,11 @@ AB_SAN_LEK=0
AB_LD_BFD=0

# Default testing flags
ABTESTS="default"
ABTEST_USEDEFAULT=no
ABTEST_TESTEXEC=plain
ABTESTS=""
ABTEST_AUTO_DETECT=yes
ABTEST_ABORT_BUILD=yes
ABTEST_TESTEXEC=plain
ABTEST_AUTO_DETECT_STAGE=post-build
NOTEST=no

##OS Directory Tree
Expand Down
2 changes: 1 addition & 1 deletion lib/tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ abtest_gen_default() {
abinfo "Found check script file, using it as default test ..."
ABTEST_default_TESTTYPE=custom
ABTEST_default_TESTDEPS=$TESTDEPS
ABTEST_default_CUSTOM_STAGE=postbuild
ABTEST_default_CUSTOM_STAGE=$ABTEST_AUTO_DETECT_STAGE
ABTEST_default_CUSTOM_SCRIPT=$SRCDIR/autobuild/check
ABTEST_default_CUSTOM_IS_BASHSCRIPT=yes
else
Expand Down
7 changes: 1 addition & 6 deletions proc/10-tests_pre.sh → proc/10-tests_scan.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,12 @@ if bool $NOTEST; then
TESTDEPS="" # Empty TESTDEPS by explicitly override it
else
abinfo "Currently enabled tests are: $ABTESTS"
abrequire tests
fi

if [[ -n "$ABTESTS" ]]; then
abrequire tests

_IFS="$IFS" IFS=$' '
for test in $ABTESTS; do
if [[ "default" == "$test" ]]; then
ABTEST_USEDEFAULT=yes
continue
fi
abtest_scanner_load "$test"

local _testdeps="ABTEST_${test}_TESTDEPS"
Expand Down
5 changes: 4 additions & 1 deletion proc/31-tests_probe.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
#!/bin/bash
#proc/tests_probe.sh: probe and generate default tests

if bool $ABTEST_USEDEFAULT; then
if bool $ABTEST_AUTO_DETECT; then
abtest_gen_default
if [[ $? -eq 0 ]]; then
ABTESTS="$ABTESTS default"
fi
fi
4 changes: 2 additions & 2 deletions proc/51-tests_post_build.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/bin/bash
##proc/tests_postbuild: run tests at post build stage
##proc/tests_post_build: run tests at post build stage
##@copyright GPL-2.0+

for testcase in $ABTESTS; do
abtest_run postbuild "${testcase}"
abtest_run post-build "${testcase}"
done

unset testcase
4 changes: 2 additions & 2 deletions proc/92-tests_post_install.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/bin/bash
##proc/tests_postbuild: run tests at post install stage
##proc/tests_post_install: run tests at post install stage
##@copyright GPL-2.0+

for testcase in $ABTESTS; do
abtest_run postinst "${testcase}"
abtest_run post-install "${testcase}"
done

unset testcase

0 comments on commit 19c03ad

Please sign in to comment.