moodlehq / who-broke-it

Finds which commit is breaking "something", where something can be a test suite, script...
GNU General Public License v3.0
7 stars 3 forks source link

Failing on mac with the set -e #5

Open danpoltawski opened 7 years ago

danpoltawski commented 7 years ago

I'm not sure if this is a mac bash incompability..

12:00 $ bash --version
GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin16)
Copyright (C) 2007 Free Software Foundation, Inc`

But I ran who broke it and it failed silently:

10:19 $ ./who-broke-it.sh ./run-moodle-behat.sh 216ea39be7bff49e916dc03efa1dc3ff331f7db8 mod/quiz/tests/behat/editing_section_headings.feature
Checking who broke /Users/danp/www/im/mod/quiz/tests/behat/editing_section_headings.feature
UPGRADING TEST SITE...
RUNNING vendor/bin/behat --config /Users/danp/moodles/im/moodledata_behat/behatrun/behat/behat.yml --stop-on-failure /Users/danp/www/im/mod/quiz/tests/behat/editing_section_headings.feature
✘-1 ~/www/im [master|…2] 
10:22 $ echo $?
1

I worked out it was existing at the behatoutput line (whcih made sense to me, because it exited on failure), so i applied this patch:

diff --git a/run-moodle-behat.sh b/run-moodle-behat.sh
index df75d07..3b63215 100755
--- a/run-moodle-behat.sh
+++ b/run-moodle-behat.sh
@@ -58,9 +58,11 @@ if [ "$failedscenario" != "" ]; then
 fi

 echo "RUNNING $behatfullcommand"
+set +e
 behatoutput=$( ${behatfullcommand} )
-
 export failed=$?
+set -e
+
 if [ $failed -ne 0 ]; then

     # Get the name of the failed scenario.

But I don't quite understand why that works on other systems (and it seemed like the bisect didn't work also)

dmonllao commented 7 years ago

Hi Dan, can you pull and try https://github.com/dmonllao/who-broke-it/tree/fix-behat-runner? works as expected to me, but we still need to check osx

danpoltawski commented 7 years ago

It works, but.. the last two lines..

** Running vendor/bin/behat --config /Users/danp/moodles/im/moodledata_behat/behatrun/behat/behat.yml --stop-on-failure mod/quiz/tests/behat/editing_section_headings.feature **
** Failed feature name could not be determined **
** $failedtest not modified **
dmonllao commented 7 years ago

mmmm, yes, we will need to explain this better.

The first message is the running command, behat failed again but the failing feature file path (probably the same than before) can not be determined. I haven't modified Rajesh original's formula to extract the feature (https://github.com/dmonllao/who-broke-it/blob/fix-behat-runner/run-moodle-behat.sh#L84) I guess a combination of a stronger regex to extract the feature file and rewording the error would be enough.

dmonllao commented 7 years ago

Just updated the pull branch, it should be fine now: https://github.com/dmonllao/who-broke-it/compare/master...fix-behat-runner