https://dispatcher.drupalci.org/job/default/1635/console is an example of where a fatal error happened during a unit test, but did *not* show a fail during that test.

We need to investigate whether this is happening on the old bots as well, or if this is a new bug.

Comments

Mixologic’s picture

This does not happen on the old bots. they fail. The new bots do not, and there are plentymany examples.

https://dispatcher.drupalci.org/job/default/174/consoleFull
https://dispatcher.drupalci.org/job/default/205/consoleFull
https://dispatcher.drupalci.org/job/default/439/consoleFull
https://dispatcher.drupalci.org/job/default/536/consoleFull
https://dispatcher.drupalci.org/job/default/1391/consoleFull
https://dispatcher.drupalci.org/job/default/1393/consoleFull
https://dispatcher.drupalci.org/job/default/1397/consoleFull
https://dispatcher.drupalci.org/job/default/1544/consoleFull
https://dispatcher.drupalci.org/job/default/1847/consoleFull
https://dispatcher.drupalci.org/job/default/2153/consoleFull
https://dispatcher.drupalci.org/job/default/2264/consoleFull
https://dispatcher.drupalci.org/job/default/2282/consoleFull
https://dispatcher.drupalci.org/job/default/2295/consoleFull
https://dispatcher.drupalci.org/job/default/2414/consoleFull
https://dispatcher.drupalci.org/job/default/2607/consoleFull
https://dispatcher.drupalci.org/job/default/2733/consoleFull
https://dispatcher.drupalci.org/job/default/3093/consoleFull
https://dispatcher.drupalci.org/job/default/3188/consoleFull
https://dispatcher.drupalci.org/job/default/3189/consoleFull
https://dispatcher.drupalci.org/job/default/3190/consoleFull
https://dispatcher.drupalci.org/job/default/3313/consoleFull
https://dispatcher.drupalci.org/job/default/3314/consoleFull
https://dispatcher.drupalci.org/job/default/3448/consoleFull
https://dispatcher.drupalci.org/job/default/3449/consoleFull
https://dispatcher.drupalci.org/job/default/3450/consoleFull
https://dispatcher.drupalci.org/job/default/3500/consoleFull
https://dispatcher.drupalci.org/job/default/3501/consoleFull
https://dispatcher.drupalci.org/job/default/3502/consoleFull
https://dispatcher.drupalci.org/job/default/3507/consoleFull
https://dispatcher.drupalci.org/job/default/3965/consoleFull
https://dispatcher.drupalci.org/job/default/3967/consoleFull
https://dispatcher.drupalci.org/job/default/4204/consoleFull
https://dispatcher.drupalci.org/job/default/4206/consoleFull
https://dispatcher.drupalci.org/job/default/4441/consoleFull
https://dispatcher.drupalci.org/job/default/4442/consoleFull
https://dispatcher.drupalci.org/job/default/4558/consoleFull
https://dispatcher.drupalci.org/job/default/4793/consoleFull
https://dispatcher.drupalci.org/job/default/5278/consoleFull
https://dispatcher.drupalci.org/job/default/5279/consoleFull
https://dispatcher.drupalci.org/job/default/5280/consoleFull
https://dispatcher.drupalci.org/job/default/5284/consoleFull
https://dispatcher.drupalci.org/job/default/5285/consoleFull
https://dispatcher.drupalci.org/job/default/5286/consoleFull
https://dispatcher.drupalci.org/job/default/5360/consoleFull
https://dispatcher.drupalci.org/job/default/5382/consoleFull
https://dispatcher.drupalci.org/job/default/5398/consoleFull
https://dispatcher.drupalci.org/job/default/5531/consoleFull
https://dispatcher.drupalci.org/job/default/5532/consoleFull
https://dispatcher.drupalci.org/job/default/5655/consoleFull
https://dispatcher.drupalci.org/job/default/5657/consoleFull
https://dispatcher.drupalci.org/job/default/5658/consoleFull
https://dispatcher.drupalci.org/job/default/5664/consoleFull
https://dispatcher.drupalci.org/job/default/5699/consoleFull
https://dispatcher.drupalci.org/job/default/5700/consoleFull
https://dispatcher.drupalci.org/job/default/5703/consoleFull
https://dispatcher.drupalci.org/job/default/5704/consoleFull
https://dispatcher.drupalci.org/job/default/5707/consoleFull
https://dispatcher.drupalci.org/job/default/5708/consoleFull
https://dispatcher.drupalci.org/job/default/5723/consoleFull
https://dispatcher.drupalci.org/job/default/5724/consoleFull
https://dispatcher.drupalci.org/job/default/5725/consoleFull
https://dispatcher.drupalci.org/job/default/5726/consoleFull
https://dispatcher.drupalci.org/job/default/5732/consoleFull
https://dispatcher.drupalci.org/job/default/5733/consoleFull
https://dispatcher.drupalci.org/job/default/5735/consoleFull
https://dispatcher.drupalci.org/job/default/5736/consoleFull
https://dispatcher.drupalci.org/job/default/5742/consoleFull
https://dispatcher.drupalci.org/job/default/5861/consoleFull
https://dispatcher.drupalci.org/job/default/5868/consoleFull
https://dispatcher.drupalci.org/job/default/6144/consoleFull

webchick’s picture

Priority: Normal » Critical

That seems pretty critical to address.

fabianx’s picture

Agree, that is a hard blocker for shutting down the old bots.

mradcliffe’s picture

Is this due to Jenkins not failing the build because there are no "fails" but there are "exceptions"?

Or is this due to a BuildStep not setting errorStatus on the job on an exception?

I looked at \DrupalCI\Plugin\BuildSteps\publish\JunitXMLFormat class, and this does categorize exceptions directly from the simpletest table. A fatal error is listed as an 'exception' not a 'fail'. Does Jenkins only fail builds if it has a fail count > 0? I can't find out any of this information on the Jenkins documentation pages.

jthorson’s picture

PIFR parses the run-tests.sh output for the "PHP Fatal" pattern ... currently, DrupalCI does not. This is essentially a regression which hasn't been built into DrupalCI yet.

I don't believe that the tests which result in a PHP Fatal in the output necessarily complete to the point where the exception would be reported in the simpletest result tables.

jthorson’s picture

Without taking a deep look into the code, my suggested resolution would be to tee the output into a file while the run-tests.sh command is running, and then have a post-execute build step (prior to the JunitXML parsing) which does some validation on this output file and fails if it detects any PHP Fatal error messages in the run output.

Mixologic’s picture

I noticed that not all fatal errors were being handled like this, and that some of them actually report as a true failure. (For example: https://dispatcher.drupalci.org/job/default/9727/testReport/Plugin/Drupa...)

So I dug a little deeper and it turns out its a problem with how we are handling phpunit tests vs. simpletest tests. Simpletest assumes the test is a failure from a fatal error unless otherwise told it is passing: http://cgit.drupalcode.org/drupal/tree/core/modules/simpletest/src/TestB...

When phpunit fatal errors, it creates a 0 byte xml file in /sites/default/files/simpletest/phpunit-xx.xml. When it comes time to parse that output (http://cgit.drupalcode.org/drupal/tree/core/modules/simpletest/simpletes...), In line 673 it checks and if the file is 0- bytes, it simply bails out.

What I propose is that we create a default junit xml formatted 'failure' file in simpletest_phpunit_run_command().(http://cgit.drupalcode.org/drupal/tree/core/modules/simpletest/simpletes...) that would then get overwritten on a successful execution of that particular test run.

The alternative is a pretty sad hack that involves parsing the run-tests.sh output to see if the word fail is there, which doesnt provide developers with information as to *where* a fatal error occurred without digging into the test suite. Even then, it just displays the error, but we dont know which class was attempting to be tested.

This falls into the same category of problems where in order to fix drupalci, we need to fix core's testrunning tools, and its not ultimately clear the best course of action going forward. (e.g. https://www.drupal.org/node/2551981)

Mixologic’s picture

Created #2560643: Fatal PHPUnit tests are not always reported as failure in core to get this fixed properly. In the meantime we'll work around it by doing the same "parse the logs and look for a Fatal error" that we're currently doing in pift.

dawehner’s picture

https://www.drupal.org/node/2546618#comment-10309439 is a slightly different problem, not sure whether its at all related to this issue.
This is a segfault while running the tests, and well, this was not found at all.

basic’s picture

Status: Active » Postponed

This is now waiting on #2560643: Fatal PHPUnit tests are not always reported as failure to get fixed. Once this is in core this issue can be resolved.

Mixologic’s picture

Status: Postponed » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.