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

Commit

Permalink
testing: add cargo test, rename to TESTDES for consistency, add logging
Browse files Browse the repository at this point in the history
  • Loading branch information
leedagee committed Sep 30, 2023
1 parent 6f3c69a commit 0ca6838
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 6 deletions.
14 changes: 9 additions & 5 deletions lib/tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ abtest_scanner_extract(){
exit 1
fi

if [[ -z "${TESTDESC}" ]]; then
if [[ -z "${TESTDES}" ]]; then
abwarn "Test case ${testname} has no description!"
fi

Expand Down Expand Up @@ -118,19 +118,23 @@ abtest_run(){

abtest_gen_default() {
ABTEST_default_TESTEXEC=$ABTEST_TESTEXEC
ABTEST_default_TESTDESC="Automatically generated tests for $ABTYPE"
ABTEST_default_TESTDES="Automatically generated tests for $ABTYPE"
case $ABTYPE in
cargo)
abinfo "Found cargo project, using cargo test as default test ..."
ABTEST_default_TESTTYPE=cargo
ABTEST_default_CARGO_TEST_AFTER="$CARGO_TEST_AFTER"
;;
*)
local checkscript="$(arch_findfile check)"
if [[ $? -eq 0 ]]; then
if [[ -e $checkscript ]]; then
abinfo "Found check script file, using it as default test ..."
ABTEST_default_TESTTYPE=custom
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
else
abwarn "No default test found for $ABTYPE builds, use NOTEST=yes to suppress this warning."
abwarn "No default test found for $ABTYPE builds" # use ABTEST_AUTO_DETECT=no to suppress this warning
return 1
fi
;;
Expand Down
2 changes: 1 addition & 1 deletion sets/testspec_exports
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
TESTDESC
TESTDES
TESTDEP
TESTTYPE
TESTEXEC
Expand Down
7 changes: 7 additions & 0 deletions tests/cargo.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
abtest_cargo_run() {
abinfo "Running cargo test ..."
cargo test \
--path "$SRCDIR/Cargo.toml" \
--no-fail-fast -r \
${CARGO_TEST_AFTER}
}
2 changes: 2 additions & 0 deletions tests/custom.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@

abtest_custom_test () {
if bool $CUSTOM_IS_BASHSCRIPT; then
abinfo "Sourcing bash script $CUSTOM_SCRIPT ..."
load_strict $CUSTOM_SCRIPT $CUSTOM_ARGS
else
abinfo "Executing test script $CUSTOM_SCRIPT ..."
$CUSTOM_SCRIPT $CUSTOM_ARGS
fi
EXIT_CODE=$?
Expand Down

0 comments on commit 0ca6838

Please sign in to comment.