diff --git a/tests/functional/launch_tests_on_instance.sh b/tests/functional/launch_tests_on_instance.sh index 7aad48c..77dfbdb 100755 --- a/tests/functional/launch_tests_on_instance.sh +++ b/tests/functional/launch_tests_on_instance.sh @@ -20,17 +20,23 @@ opt_slowness_factor=1 opt_log_prefix= opt_module= opt_post_run= +opt_functional_tests=1 +opt_unit_tests=1 declare -A capabilities=( [ed25519]=1 [mfa]=1 [mfa-password]=0 [pamtester]=1 [piv]=1 [sk]=0 [ipv6]=1 ) # set the helptext now to get the proper default values help_text=$(cat < $fbasename" - set +e - $r0 perl "$opt_remote_basedir/tests/unit/$fbasename"; ret=$? - set -e - if [ $ret != 0 ]; then - printf "%b%b%b\\n" "$WHITE_ON_RED" "Unit tests failed (ret=$ret) :(" "$NOC" - exit 1 - fi -done +if [ "$opt_unit_tests" = 1 ]; then + echo '=== running unit tests ===' + # a while read loop doesn't work well here: + # shellcheck disable=SC2044 + for f in $(find "$basedir/tests/unit/" -mindepth 1 -maxdepth 1 -type f -name "*.pl" -print) + do + fbasename=$(basename "$f") + echo "-> $fbasename" + set +e + $r0 perl "$opt_remote_basedir/tests/unit/$fbasename"; ret=$? + set -e + if [ $ret != 0 ]; then + printf "%b%b%b\\n" "$WHITE_ON_RED" "Unit tests failed (ret=$ret) :(" "$NOC" + exit 1 + fi + done +fi -COUNTONLY=1 -testno=0 -echo '=== counting functional tests ===' -runtests -testcount=$testno +if [ "$opt_functional_tests" = 1 ]; then + COUNTONLY=1 + testno=0 + echo '=== counting functional tests ===' + runtests + testcount=$testno + + echo "=== will run $testcount functional tests ===" + COUNTONLY=0 + testno=0 + runtests +fi -echo "=== will run $testcount functional tests ===" -COUNTONLY=0 -testno=0 -runtests echo - if [ $((nbfailedret + nbfailedgrep + nbfailedcon + nbfailedgeneric)) -eq 0 ] ; then printf "%b%b%b\\n" "$BLACK_ON_GREEN" "All tests succeeded :)" "$NOC" else