From d8cb04c8f98a13a2e11379b3beb6e97ea2b4f7e8 Mon Sep 17 00:00:00 2001 From: Camber Huang Date: Mon, 6 Jun 2022 12:09:26 +0800 Subject: [PATCH 1/8] tests/*: fundamental implementation of build-time package integrity check modules Signed-off-by: Camber Huang --- tests/00-self_file.sh | 22 ++++++++++++++++++++++ tests/01-self_files.sh | 15 +++++++++++++++ tests/_base.sh | 18 ++++++++++++++++++ 3 files changed, 55 insertions(+) create mode 100644 tests/00-self_file.sh create mode 100644 tests/01-self_files.sh create mode 100644 tests/_base.sh diff --git a/tests/00-self_file.sh b/tests/00-self_file.sh new file mode 100644 index 0000000..eedaa6c --- /dev/null +++ b/tests/00-self_file.sh @@ -0,0 +1,22 @@ +#!/bin/bash +##tests/00-self_file.sh: invoke testing function defined in `autobuild/test` +##Part of AB3 build-time package integrity check implementation. +##@copyright GPL-2.0+ + +. "$AB/tests"/_base.sh + +abtest() { + abwarn "ABTEST_TYPE is set to self, but no abtest() found in autobuild{,/\$ARCH}/test" + return 127 +} + +abtest_unprivileged() { + abwarn "ABTEST_TYPE is set to self, but no abtest_unprivileged() found in autobuild{,/\$ARCH}/test" + return 127 +} + +# Redefine +arch_loadfile "$SRCDIR"/test + +abtest || abtest_non-zero-handler $1 "$SRCDIR"/test +abtest_unprivileged || abtest_unprivileged_non-zero-handler $1 "$SRCDIR"/test diff --git a/tests/01-self_files.sh b/tests/01-self_files.sh new file mode 100644 index 0000000..0dca197 --- /dev/null +++ b/tests/01-self_files.sh @@ -0,0 +1,15 @@ +#!/bin/bash +##tests/01-self_files.sh: invoke testing function defined in `autobuild/tests/T*.sh` +##Part of AB3 build-time package integrity check implementation. +##@copyright GPL-2.0+ + +. "$AB/tests"/_base.sh + +for i in "$SRCDIR"/tests/T*.sh +do + arch_loadfile $i + abtest || abtest_non-zero-handler $? $i + abtest_unprivileged || abtest_non-zero-handler $? $i + unset abtest abtest_unprivileged +done + diff --git a/tests/_base.sh b/tests/_base.sh new file mode 100644 index 0000000..d4d4331 --- /dev/null +++ b/tests/_base.sh @@ -0,0 +1,18 @@ +#!/bin/bash +##tests/_base.sh: Basic functions of build-time package integrity check modules. +##@copyright GPL-2.0+ + +abtest_non-zero-handler() { + case $1 in + 0) return 0;; + 127) abwarn "No abtest() available in file ${2}";; + *) abwarn "Non-zero returned: ${1}!";; + esac +} + +abtest_unprivileged_non-zero-handler() { + case $1 in + 127) abwarn "No abtest_unprivileged() available in file ${2}";; + *) abtest_non-zero-handler $1 $2;; + esac +} From 762f594ab1433a0d44a9f2248c9ae5785aa24d36 Mon Sep 17 00:00:00 2001 From: Camber Huang Date: Mon, 6 Jun 2022 16:37:37 +0800 Subject: [PATCH 2/8] etc: basic configurations for build-time package integrity check module Signed-off-by: Camber Huang --- etc/autobuild/ab3_defcfg.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/etc/autobuild/ab3_defcfg.sh b/etc/autobuild/ab3_defcfg.sh index 5a4ffc8..87b5117 100644 --- a/etc/autobuild/ab3_defcfg.sh +++ b/etc/autobuild/ab3_defcfg.sh @@ -169,4 +169,7 @@ abassigngroup() { : "${ABBUILD:="$(abdetectarch)"}" "${ABHOST:=$ABBUILD}" "${ABTARGET:=$ABHOST}" ABHOST_GROUP="$(abassigngroup $ABHOST)" +# Default configurations for ab3 package integrity check module. +[ ! -v $ABTEST_ENABLED ] || ABTEST_ENABLED=0 # Disabled during current development cycle + unset -f abdetectarch abassigngroup From 2bc04dafb14b0490700b124233402a68e29fc44b Mon Sep 17 00:00:00 2001 From: Camber Huang Date: Mon, 6 Jun 2022 16:41:07 +0800 Subject: [PATCH 3/8] meta: fundamental implementation of build-time package integrity check module - tests/* + lib/tests.sh: more AB3 style - proc: add scripts for test module Signed-off-by: Camber Huang --- tests/_base.sh => lib/tests.sh | 2 +- proc/81-test_probe.sh | 20 ++++++++++++++++++++ proc/82-test_exec.sh | 10 ++++++++++ tests/00-self_file.sh | 34 ++++++++++++++++++++++------------ tests/01-self_files.sh | 25 +++++++++++++++++-------- tests/99-notest.sh | 14 ++++++++++++++ 6 files changed, 84 insertions(+), 21 deletions(-) rename tests/_base.sh => lib/tests.sh (83%) create mode 100644 proc/81-test_probe.sh create mode 100644 proc/82-test_exec.sh create mode 100644 tests/99-notest.sh diff --git a/tests/_base.sh b/lib/tests.sh similarity index 83% rename from tests/_base.sh rename to lib/tests.sh index d4d4331..2d85dc9 100644 --- a/tests/_base.sh +++ b/lib/tests.sh @@ -1,5 +1,5 @@ #!/bin/bash -##tests/_base.sh: Basic functions of build-time package integrity check modules. +##lib/tests.sh: Basic functions of build-time package integrity check modules. ##@copyright GPL-2.0+ abtest_non-zero-handler() { diff --git a/proc/81-test_probe.sh b/proc/81-test_probe.sh new file mode 100644 index 0000000..919a90d --- /dev/null +++ b/proc/81-test_probe.sh @@ -0,0 +1,20 @@ +#!/bin/bash +##proc/81-test_probe.sh: TBF +##FIXME: is there a better name for this? +##@copyright GPL-2.0+ + +. "$AB/lib/tests.sh" + +if bool $ABTEST_ENABLED; then + if [ -z "$ABTEST_TYPE"]; then + for i in $ABTEST_TESTPROBES; do + if abtest_${i}_probe; then + ABTEST_TYPE=$i + break + fi + done + fi +else + abinfo "Build-time package integrity check is disabled. Skipping ..." +fi + diff --git a/proc/82-test_exec.sh b/proc/82-test_exec.sh new file mode 100644 index 0000000..e5017e0 --- /dev/null +++ b/proc/82-test_exec.sh @@ -0,0 +1,10 @@ +#!/bin/bash +##proc/81-check.sh: TBF +##@copyright GPL-2.0+ + +abtrylib tests || ablibret + +cd "$SRCDIR" + +abtest_${ABTEST_TYPE}_test || \ + abwarn "Test exited with non-zero status: $?" diff --git a/tests/00-self_file.sh b/tests/00-self_file.sh index eedaa6c..cfc3c33 100644 --- a/tests/00-self_file.sh +++ b/tests/00-self_file.sh @@ -3,20 +3,30 @@ ##Part of AB3 build-time package integrity check implementation. ##@copyright GPL-2.0+ -. "$AB/tests"/_base.sh +abtrylib arch tests || ablibret -abtest() { - abwarn "ABTEST_TYPE is set to self, but no abtest() found in autobuild{,/\$ARCH}/test" - return 127 +abtest_self_file_probe() { + [ -f "$(arch_trymore=1 arch_findfile test)" ] } -abtest_unprivileged() { - abwarn "ABTEST_TYPE is set to self, but no abtest_unprivileged() found in autobuild{,/\$ARCH}/test" - return 127 -} +abtest_self_file_test() { + . "$AB/lib/tests.sh" + + abtest() { + abwarn "ABTEST_TYPE is set to self, but no abtest() found in autobuild{,/\$ARCH}/test" + return 127 + } + + abtest_unprivileged() { + abwarn "ABTEST_TYPE is set to self, but no abtest_unprivileged() found in autobuild{,/\$ARCH}/test" + return 127 + } -# Redefine -arch_loadfile "$SRCDIR"/test + # Redefine + arch_loadfile "$SRCDIR"/test + + abtest || abtest_non-zero-handler $1 "$SRCDIR"/test + abtest_unprivileged || abtest_unprivileged_non-zero-handler $1 "$SRCDIR"/test +} -abtest || abtest_non-zero-handler $1 "$SRCDIR"/test -abtest_unprivileged || abtest_unprivileged_non-zero-handler $1 "$SRCDIR"/test +ABTEST_TESTPROBES+=' self_file' diff --git a/tests/01-self_files.sh b/tests/01-self_files.sh index 0dca197..c1f5a9f 100644 --- a/tests/01-self_files.sh +++ b/tests/01-self_files.sh @@ -3,13 +3,22 @@ ##Part of AB3 build-time package integrity check implementation. ##@copyright GPL-2.0+ -. "$AB/tests"/_base.sh +abtrylib tests || ablibret -for i in "$SRCDIR"/tests/T*.sh -do - arch_loadfile $i - abtest || abtest_non-zero-handler $? $i - abtest_unprivileged || abtest_non-zero-handler $? $i - unset abtest abtest_unprivileged -done +abtest_self_files_probe() { + [ -d "$SRCDIR"/autobuild/tests ] +} +abtest_self_files_test() { + . "$AB/lib/tests.sh" + + for i in "$SRCDIR"/tests/T*.sh + do + arch_loadfile $i + abtest || abtest_non-zero-handler $? $i + abtest_unprivileged || abtest_non-zero-handler $? $i + unset abtest abtest_unprivileged + done +} + +ABTEST_TESTPROBES+=' self_files' diff --git a/tests/99-notest.sh b/tests/99-notest.sh new file mode 100644 index 0000000..d9f148f --- /dev/null +++ b/tests/99-notest.sh @@ -0,0 +1,14 @@ +#!/bin/bash +##tests/99-notest.sh: Dummy file indicates that test is not available. +##Part of AB3 build-time package integrity check implementation. +##@copyright GPL-2.0+ + +abtest_notest_probe() { + true +} + +abtest_notest_test(){ + abinfo "ABTEST_TYPE is set to 'notest'. Skipping..." +} + +ABTEST_TESTPROBES+=' notest' From 3f6e83c116d0b645be270ab2c6b492f51877be61 Mon Sep 17 00:00:00 2001 From: Camber Huang Date: Mon, 6 Jun 2022 17:27:49 +0800 Subject: [PATCH 4/8] tests: bugfix for previous commits - tests/*: fix wrong usage of arch_loadfile - procs: - New script 81-test_funcs.sh to load functions in "$AB"/tests/* - rename previous scripts and minor bugfix - ab3_defcfg.sh: minor bugfix Signed-off-by: Camber Huang --- etc/autobuild/ab3_defcfg.sh | 2 +- proc/81-test_funcs.sh | 7 +++++++ proc/82-test_exec.sh | 10 ---------- proc/{81-test_probe.sh => 82-test_probe.sh} | 2 +- proc/83-test_exec.sh | 11 +++++++++++ tests/00-self_file.sh | 2 +- tests/01-self_files.sh | 2 +- 7 files changed, 22 insertions(+), 14 deletions(-) create mode 100644 proc/81-test_funcs.sh delete mode 100644 proc/82-test_exec.sh rename proc/{81-test_probe.sh => 82-test_probe.sh} (91%) create mode 100644 proc/83-test_exec.sh diff --git a/etc/autobuild/ab3_defcfg.sh b/etc/autobuild/ab3_defcfg.sh index 87b5117..7bab38e 100644 --- a/etc/autobuild/ab3_defcfg.sh +++ b/etc/autobuild/ab3_defcfg.sh @@ -170,6 +170,6 @@ abassigngroup() { ABHOST_GROUP="$(abassigngroup $ABHOST)" # Default configurations for ab3 package integrity check module. -[ ! -v $ABTEST_ENABLED ] || ABTEST_ENABLED=0 # Disabled during current development cycle +[ -v $ABTEST_ENABLED ] || ABTEST_ENABLED=0 # Disabled during current development cycle unset -f abdetectarch abassigngroup diff --git a/proc/81-test_funcs.sh b/proc/81-test_funcs.sh new file mode 100644 index 0000000..bf1505d --- /dev/null +++ b/proc/81-test_funcs.sh @@ -0,0 +1,7 @@ +#!/bin/bash +##proc/build_funcs: Loads the tests/ functions +##@copyright GPL-2.0+ +for i in "$AB/tests"/*.sh +do + . "$i" +done diff --git a/proc/82-test_exec.sh b/proc/82-test_exec.sh deleted file mode 100644 index e5017e0..0000000 --- a/proc/82-test_exec.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash -##proc/81-check.sh: TBF -##@copyright GPL-2.0+ - -abtrylib tests || ablibret - -cd "$SRCDIR" - -abtest_${ABTEST_TYPE}_test || \ - abwarn "Test exited with non-zero status: $?" diff --git a/proc/81-test_probe.sh b/proc/82-test_probe.sh similarity index 91% rename from proc/81-test_probe.sh rename to proc/82-test_probe.sh index 919a90d..4fce242 100644 --- a/proc/81-test_probe.sh +++ b/proc/82-test_probe.sh @@ -9,7 +9,7 @@ if bool $ABTEST_ENABLED; then if [ -z "$ABTEST_TYPE"]; then for i in $ABTEST_TESTPROBES; do if abtest_${i}_probe; then - ABTEST_TYPE=$i + export ABTEST_TYPE=$i break fi done diff --git a/proc/83-test_exec.sh b/proc/83-test_exec.sh new file mode 100644 index 0000000..05c8ecd --- /dev/null +++ b/proc/83-test_exec.sh @@ -0,0 +1,11 @@ +#!/bin/bash +##proc/81-check.sh: TBF +##@copyright GPL-2.0+ + +abtrylib tests || ablibret + +if bool $ABTEST_ENABLED; then + cd "$SRCDIR" + abtest_${ABTEST_TYPE}_test || \ + abwarn "Test exited with non-zero status: $?" +fi diff --git a/tests/00-self_file.sh b/tests/00-self_file.sh index cfc3c33..806f219 100644 --- a/tests/00-self_file.sh +++ b/tests/00-self_file.sh @@ -23,7 +23,7 @@ abtest_self_file_test() { } # Redefine - arch_loadfile "$SRCDIR"/test + arch_loadfile test abtest || abtest_non-zero-handler $1 "$SRCDIR"/test abtest_unprivileged || abtest_unprivileged_non-zero-handler $1 "$SRCDIR"/test diff --git a/tests/01-self_files.sh b/tests/01-self_files.sh index c1f5a9f..17e68c9 100644 --- a/tests/01-self_files.sh +++ b/tests/01-self_files.sh @@ -12,7 +12,7 @@ abtest_self_files_probe() { abtest_self_files_test() { . "$AB/lib/tests.sh" - for i in "$SRCDIR"/tests/T*.sh + for i in "$SRCDIR"/autobuild/tests/T*.sh do arch_loadfile $i abtest || abtest_non-zero-handler $? $i From ea7f808d565e9efc925a335d9082b18f99dec5dc Mon Sep 17 00:00:00 2001 From: Camber Huang Date: Tue, 7 Jun 2022 02:36:10 +0800 Subject: [PATCH 5/8] 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 --- exportvars/tests | 3 +++ proc/81-test_funcs.sh | 10 ++++++---- proc/82-test_probe.sh | 4 +++- proc/83-test_exec.sh | 1 + tests/00-self_file.sh | 8 ++++---- 5 files changed, 17 insertions(+), 9 deletions(-) create mode 100644 exportvars/tests diff --git a/exportvars/tests b/exportvars/tests new file mode 100644 index 0000000..956d14d --- /dev/null +++ b/exportvars/tests @@ -0,0 +1,3 @@ +ABTEST_ENABLED +ABTEST_TYPE +ABTEST_TESTPROBES diff --git a/proc/81-test_funcs.sh b/proc/81-test_funcs.sh index bf1505d..6d18029 100644 --- a/proc/81-test_funcs.sh +++ b/proc/81-test_funcs.sh @@ -1,7 +1,9 @@ #!/bin/bash ##proc/build_funcs: Loads the tests/ functions ##@copyright GPL-2.0+ -for i in "$AB/tests"/*.sh -do - . "$i" -done +if bool $ABTEST_ENABLED; then + for i in "$AB/tests"/*.sh + do + . "$i" + done +fi diff --git a/proc/82-test_probe.sh b/proc/82-test_probe.sh index 4fce242..0fea09b 100644 --- a/proc/82-test_probe.sh +++ b/proc/82-test_probe.sh @@ -7,9 +7,11 @@ if bool $ABTEST_ENABLED; then if [ -z "$ABTEST_TYPE"]; then + abinfo "No $ABTEST_TYPE set, automatically determining ..." for i in $ABTEST_TESTPROBES; do if abtest_${i}_probe; then - export ABTEST_TYPE=$i + abinfo "Automatically set ABTEST_TYPE to ${i}" + ABTEST_TYPE=$i break fi done diff --git a/proc/83-test_exec.sh b/proc/83-test_exec.sh index 05c8ecd..76a7ce9 100644 --- a/proc/83-test_exec.sh +++ b/proc/83-test_exec.sh @@ -6,6 +6,7 @@ abtrylib tests || ablibret if bool $ABTEST_ENABLED; then cd "$SRCDIR" + # FIXME: use a non-zero handler? abtest_${ABTEST_TYPE}_test || \ abwarn "Test exited with non-zero status: $?" fi diff --git a/tests/00-self_file.sh b/tests/00-self_file.sh index 806f219..b269de7 100644 --- a/tests/00-self_file.sh +++ b/tests/00-self_file.sh @@ -13,20 +13,20 @@ abtest_self_file_test() { . "$AB/lib/tests.sh" abtest() { - abwarn "ABTEST_TYPE is set to self, but no abtest() found in autobuild{,/\$ARCH}/test" + abwarn "ABTEST_TYPE is set to self_file, but no abtest() found in autobuild{,/\$ARCH}/test" return 127 } abtest_unprivileged() { - abwarn "ABTEST_TYPE is set to self, but no abtest_unprivileged() found in autobuild{,/\$ARCH}/test" + abwarn "ABTEST_TYPE is set to self_file, but no abtest_unprivileged() found in autobuild{,/\$ARCH}/test" return 127 } # Redefine arch_loadfile test - abtest || abtest_non-zero-handler $1 "$SRCDIR"/test - abtest_unprivileged || abtest_unprivileged_non-zero-handler $1 "$SRCDIR"/test + abtest || abtest_non-zero-handler $? "$SRCDIR"/test + abtest_unprivileged || abtest_unprivileged_non-zero-handler $? "$SRCDIR"/test } ABTEST_TESTPROBES+=' self_file' From e791458d036161cecc087e4d96082ba06251e505 Mon Sep 17 00:00:00 2001 From: Camber Huang Date: Tue, 7 Jun 2022 02:44:46 +0800 Subject: [PATCH 6/8] tests/01-self_files.sh: increase verbosity; Change the way to invoke test cases Signed-off-by: Camber Huang --- tests/01-self_files.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/01-self_files.sh b/tests/01-self_files.sh index 17e68c9..2fc36ca 100644 --- a/tests/01-self_files.sh +++ b/tests/01-self_files.sh @@ -14,7 +14,8 @@ abtest_self_files_test() { for i in "$SRCDIR"/autobuild/tests/T*.sh do - arch_loadfile $i + abinfo "Loading test case file ${i} and performing tests ..." + . $i abtest || abtest_non-zero-handler $? $i abtest_unprivileged || abtest_non-zero-handler $? $i unset abtest abtest_unprivileged From 0fcdcaffcd6ed279a07e3c766ac2f9a59280af56 Mon Sep 17 00:00:00 2001 From: Camber Huang Date: Tue, 7 Jun 2022 09:41:02 +0800 Subject: [PATCH 7/8] meta: test module renaming; More comments; Strip unneeded library loading Signed-off-by: Camber Huang --- lib/tests.sh | 3 ++- proc/81-test_funcs.sh | 6 +++++- proc/82-test_probe.sh | 9 ++------- proc/83-test_exec.sh | 5 ++--- tests/00-self_file.sh | 5 +++-- tests/01-self_files.sh | 4 +++- tests/99-notest.sh | 4 ++-- 7 files changed, 19 insertions(+), 17 deletions(-) diff --git a/lib/tests.sh b/lib/tests.sh index 2d85dc9..4fca344 100644 --- a/lib/tests.sh +++ b/lib/tests.sh @@ -1,5 +1,6 @@ #!/bin/bash -##lib/tests.sh: Basic functions of build-time package integrity check modules. +##lib/tests.sh: Functions for test modules. +##Part of AB3 integrated package test module ##@copyright GPL-2.0+ abtest_non-zero-handler() { diff --git a/proc/81-test_funcs.sh b/proc/81-test_funcs.sh index 6d18029..75363c9 100644 --- a/proc/81-test_funcs.sh +++ b/proc/81-test_funcs.sh @@ -1,9 +1,13 @@ #!/bin/bash -##proc/build_funcs: Loads the tests/ functions +##proc/81-test_funcs: Loads the tests/ functions +##Part of AB3 integrated package build-time test module ##@copyright GPL-2.0+ + if bool $ABTEST_ENABLED; then for i in "$AB/tests"/*.sh do . "$i" done +else + abinfo "Build-time package integrity check is disabled. Skipping ..." fi diff --git a/proc/82-test_probe.sh b/proc/82-test_probe.sh index 0fea09b..21d0c02 100644 --- a/proc/82-test_probe.sh +++ b/proc/82-test_probe.sh @@ -1,10 +1,8 @@ #!/bin/bash -##proc/81-test_probe.sh: TBF -##FIXME: is there a better name for this? +##proc/82-test_probe.sh: Determining test type +##Part of AB3 integrated package build-time test module ##@copyright GPL-2.0+ -. "$AB/lib/tests.sh" - if bool $ABTEST_ENABLED; then if [ -z "$ABTEST_TYPE"]; then abinfo "No $ABTEST_TYPE set, automatically determining ..." @@ -16,7 +14,4 @@ if bool $ABTEST_ENABLED; then fi done fi -else - abinfo "Build-time package integrity check is disabled. Skipping ..." fi - diff --git a/proc/83-test_exec.sh b/proc/83-test_exec.sh index 76a7ce9..cf569f0 100644 --- a/proc/83-test_exec.sh +++ b/proc/83-test_exec.sh @@ -1,9 +1,8 @@ #!/bin/bash -##proc/81-check.sh: TBF +##proc/83-test_exec.sh: Perform test +##Part of AB3 integrated package build-time test module ##@copyright GPL-2.0+ -abtrylib tests || ablibret - if bool $ABTEST_ENABLED; then cd "$SRCDIR" # FIXME: use a non-zero handler? diff --git a/tests/00-self_file.sh b/tests/00-self_file.sh index b269de7..d4fed8e 100644 --- a/tests/00-self_file.sh +++ b/tests/00-self_file.sh @@ -1,8 +1,10 @@ #!/bin/bash ##tests/00-self_file.sh: invoke testing function defined in `autobuild/test` -##Part of AB3 build-time package integrity check implementation. +##Part of AB3 integrated package build-time test module ##@copyright GPL-2.0+ +##FIXME: implement unprivileged tests + abtrylib arch tests || ablibret abtest_self_file_probe() { @@ -10,7 +12,6 @@ abtest_self_file_probe() { } abtest_self_file_test() { - . "$AB/lib/tests.sh" abtest() { abwarn "ABTEST_TYPE is set to self_file, but no abtest() found in autobuild{,/\$ARCH}/test" diff --git a/tests/01-self_files.sh b/tests/01-self_files.sh index 2fc36ca..49662e5 100644 --- a/tests/01-self_files.sh +++ b/tests/01-self_files.sh @@ -1,8 +1,10 @@ #!/bin/bash ##tests/01-self_files.sh: invoke testing function defined in `autobuild/tests/T*.sh` -##Part of AB3 build-time package integrity check implementation. +##Part of AB3 integrated package build-time test module ##@copyright GPL-2.0+ +##FIXME: implement unprivileged tests + abtrylib tests || ablibret abtest_self_files_probe() { diff --git a/tests/99-notest.sh b/tests/99-notest.sh index d9f148f..f4d608b 100644 --- a/tests/99-notest.sh +++ b/tests/99-notest.sh @@ -1,6 +1,6 @@ #!/bin/bash -##tests/99-notest.sh: Dummy file indicates that test is not available. -##Part of AB3 build-time package integrity check implementation. +##tests/99-notest.sh: Dummy file indicates that test is not available or skipped. +##Part of AB3 integrated package build-time test module ##@copyright GPL-2.0+ abtest_notest_probe() { From 33def496dfc4dd36484486d4ddf6d1753e0f52e2 Mon Sep 17 00:00:00 2001 From: Camber Huang Date: Tue, 7 Jun 2022 10:59:03 +0800 Subject: [PATCH 8/8] meta/tests: minor bugfix - ab3_defcfg: replace inappropriate usage of [ ] - tests/01-self_files.sh: fix typo of function call Signed-off-by: Camber Huang --- etc/autobuild/ab3_defcfg.sh | 2 +- tests/01-self_files.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/etc/autobuild/ab3_defcfg.sh b/etc/autobuild/ab3_defcfg.sh index 7bab38e..163d674 100644 --- a/etc/autobuild/ab3_defcfg.sh +++ b/etc/autobuild/ab3_defcfg.sh @@ -170,6 +170,6 @@ abassigngroup() { ABHOST_GROUP="$(abassigngroup $ABHOST)" # Default configurations for ab3 package integrity check module. -[ -v $ABTEST_ENABLED ] || ABTEST_ENABLED=0 # Disabled during current development cycle +[[ -v $ABTEST_ENABLED ]] || ABTEST_ENABLED=0 # Disabled during current development cycle unset -f abdetectarch abassigngroup diff --git a/tests/01-self_files.sh b/tests/01-self_files.sh index 49662e5..5296a76 100644 --- a/tests/01-self_files.sh +++ b/tests/01-self_files.sh @@ -19,7 +19,7 @@ abtest_self_files_test() { abinfo "Loading test case file ${i} and performing tests ..." . $i abtest || abtest_non-zero-handler $? $i - abtest_unprivileged || abtest_non-zero-handler $? $i + abtest_unprivileged || abtest_unprivileged_non-zero-handler $? $i unset abtest abtest_unprivileged done }