From 40ee3110ffa696c8e754c11c0b522fc2f51648a3 Mon Sep 17 00:00:00 2001 From: Patrick Spek Date: Sat, 28 Mar 2020 08:38:02 +0100 Subject: Update the module test method A conservative PATH is now set, with the bin directories from Rakudo Star added on to it. This should ensure that the right Raku is being used. Additionally, any failing modules will be reported at the end, and the exitcode of the test action becomes non-zero if any module failed their tests. --- lib/actions/test.bash | 48 ++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 44 insertions(+), 4 deletions(-) diff --git a/lib/actions/test.bash b/lib/actions/test.bash index 482666d..f95be96 100644 --- a/lib/actions/test.bash +++ b/lib/actions/test.bash @@ -3,6 +3,7 @@ action() { local OPTIND local raku + local failures=0 while getopts ":p:" opt do @@ -39,24 +40,63 @@ action() { continue fi - "action_test_$target" + "action_test_$target" && continue + + failures=$(( failures + 1 )) done + + if (( failures > 0 )) + then + return 4 + fi } action_test_modules() { local modules - local prove + local failures modules="$(tmpfile)" - prove="$RSTAR_PREFIX/share/perl6/vendor/bin/prove6" + + # Manually set a minimal PATH + PATH="/bin:/usr/bin:/usr/local/bin" + + # Add the Rakudo bin directories from RSTAR_PREFIX + PATH+=":$(readlink -f "$RSTAR_PREFIX/bin")" + PATH+=":$(readlink -f "$RSTAR_PREFIX/share/perl6/site/bin")" + PATH+=":$(readlink -f "$RSTAR_PREFIX/share/perl6/vendor/bin")" + PATH+=":$(readlink -f "$RSTAR_PREFIX/share/perl6/core/bin")" + + # And export this version to the tests + export PATH + + debug "PATH set to $PATH" awk '/^[^#]/ {print $1}' "$BASEDIR/etc/modules.txt" > "$modules" + # Go through each module and run the tests while read -r module do chgdir "$BASEDIR/src/rakudo-star-modules/$module" - "$prove" -v . + prove6 -v . && continue + + failures+=("$module") done < "$modules" + + # Return cleanly if no failures occurred + if [[ -z ${failures[*]} ]] + then + return 0 + fi + + # Or inform the user of the failing modules + emerg "One or more modules failed their tests:" + + for module in "${failures[@]}" + do + emerg " $module" + done + + return 1 } action_test_spectest() { -- cgit v1.1