diff --git a/lib/tests.sh b/lib/tests.sh index 630ae26..07bf658 100644 --- a/lib/tests.sh +++ b/lib/tests.sh @@ -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 @@ -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 ;; diff --git a/sets/testspec_exports b/sets/testspec_exports index d48f11d..5f0c1c0 100644 --- a/sets/testspec_exports +++ b/sets/testspec_exports @@ -1,4 +1,4 @@ -TESTDESC +TESTDES TESTDEP TESTTYPE TESTEXEC diff --git a/tests/cargo.sh b/tests/cargo.sh new file mode 100644 index 0000000..d7dbbd0 --- /dev/null +++ b/tests/cargo.sh @@ -0,0 +1,7 @@ +abtest_cargo_run() { + abinfo "Running cargo test ..." + cargo test \ + --path "$SRCDIR/Cargo.toml" \ + --no-fail-fast -r \ + ${CARGO_TEST_AFTER} +} diff --git a/tests/custom.sh b/tests/custom.sh index 012dcad..521d80d 100644 --- a/tests/custom.sh +++ b/tests/custom.sh @@ -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=$?