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

Commit

Permalink
testing: fix TESTDEP naming and add extra test report channel
Browse files Browse the repository at this point in the history
  • Loading branch information
leedagee committed Sep 30, 2023
1 parent 19c03ad commit 6f3c69a
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 12 deletions.
8 changes: 7 additions & 1 deletion contrib/autobuild-test
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ echo "================= Running autobuild3 test for $TEST ================="

abrequire tests

abtest_result(){
if [[ -e "$ABTEST_RESULT_OUTPUT" ]]; then
echo "X-AOSC-Testing-$TEST-$1: $2" >> $ABTEST_RESULT_OUTPUT
fi
}

if [[ "$TEST" == "default" ]]; then
DEFAULT=yes
fi
Expand Down Expand Up @@ -50,7 +56,7 @@ fi

. $AB/tests/$TESTTYPE.sh || aberr "Test type $TESTTYPE is invalid."

abtest
abtest_${TESTTYPE}_test

if [[ $EXIT_CODE -gt 2 ]]; then
EXIT_CODE=255
Expand Down
7 changes: 3 additions & 4 deletions lib/tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ abtest_run(){
systemd-run \
--wait --pipe --service-type=exec \
--working-directory=${SRCDIR} \
--setenv="ABTEST_RESULT_OUTPUT"
-- autobuild test $testname
local exitcode=$?
;;
Expand All @@ -104,9 +105,7 @@ abtest_run(){
abdie "Test $testname failed, aborting build ..."
fi
aberr "Test $testname failed, but build continues ..."
;;
2)
abwarn "Test $testname soft-failed, the build continues ..."
ABTEST_FAILED="${ABTEST_FAILED} ${testname}"
;;
255)
abdie "Test $testname failed with fatal error!"
Expand All @@ -126,7 +125,7 @@ abtest_gen_default() {
if [[ $? -eq 0 ]]; then
abinfo "Found check script file, using it as default test ..."
ABTEST_default_TESTTYPE=custom
ABTEST_default_TESTDEPS=$TESTDEPS
ABTEST_default_TESTDEP=$TESTDEP
ABTEST_default_CUSTOM_STAGE=$ABTEST_AUTO_DETECT_STAGE
ABTEST_default_CUSTOM_SCRIPT=$SRCDIR/autobuild/check
ABTEST_default_CUSTOM_IS_BASHSCRIPT=yes
Expand Down
8 changes: 8 additions & 0 deletions pm/dpkg/pack
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,14 @@ dpkgctrl(){
if dpkg -l autobuild3 >/dev/null 2>&1; then
echo "X-AOSC-Autobuild3-Version: $(dpkg-query -f '${Version}' -W autobuild3)"
fi
if ! bool $NOTEST; then
if [[ -n $ABTEST_FAILED ]]; then
echo "X-AOSC-Testing-Failed: $ABTEST_FAILED"
fi
if [[ -e $ABTEST_RESULT_OUTPUT ]]; then
cat $ABTEST_RESULT_OUTPUT
fi
fi
echo "$DPKGXTRACTRL"
}

Expand Down
12 changes: 7 additions & 5 deletions proc/10-tests_scan.sh
Original file line number Diff line number Diff line change
@@ -1,24 +1,26 @@
#!/bin/bash
##proc/tests_pre: scan for tests in $ABTESTS and construct $TESTDEPS
##proc/tests_pre: scan for tests in $ABTESTS and construct $TESTDEP
##@copyright GPL-2.0+

if bool $NOTEST; then
ABTESTS=""
TESTDEPS="" # Empty TESTDEPS by explicitly override it
TESTDEP="" # Empty TESTDEPS by explicitly override it
else
abinfo "Currently enabled tests are: $ABTESTS"
abrequire tests
export ABTEST_RESULT_OUTPUT="$SRCDIR/abtestoutput.txt"
echo -n "" > "$ABTEST_RESULT_OUTPUT"
fi

if [[ -n "$ABTESTS" ]]; then
_IFS="$IFS" IFS=$' '
for test in $ABTESTS; do
abtest_scanner_load "$test"

local _testdeps="ABTEST_${test}_TESTDEPS"
local _testdep="ABTEST_${test}_TESTDEP"
local _testtype="ABTEST_${test}_TESTTYPE"
local _testtypedeps="ABTESTTYPE_${!_testtype}_DEPS"
TESTDEPS="${TESTDEPS} ${!_testdeps} ${!_testtypedeps}"
local _testtypedep="ABTESTTYPE_${!_testtype}_DEP"
TESTDEP="${TESTDEP} ${!_testdep} ${!_testtypedep}"
done
IFS="$_IFS"
unset _IFS
Expand Down
2 changes: 1 addition & 1 deletion sets/testspec_exports
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
TESTDESC
TESTDEPS
TESTDEP
TESTTYPE
TESTEXEC
CUSTOM_STAGE
2 changes: 1 addition & 1 deletion tests/custom.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#tests/custom: test script wrapper for custom test runs
#This script is called by autobuild-test to run custom tests.

abtest() {
abtest_custom_test () {
if bool $CUSTOM_IS_BASHSCRIPT; then
load_strict $CUSTOM_SCRIPT $CUSTOM_ARGS
else
Expand Down

0 comments on commit 6f3c69a

Please sign in to comment.