This is a little experiment stemming from http://drupal.org/node/652420#comment-2347502, in which sun posted a patch that:
- Accidentally introduced fatal errors in multiple .test files
- Passed the test bot (?!)
I'm trying to see if this is reproducible by calling an undefined function, foo(), in a .test file.
| Comment | File | Size | Author |
|---|---|---|---|
| #21 | simpletest-completion-check.patch | 1.9 KB | carlos8f |
| #17 | kobayashi-maru-drupalget-nocollect.patch | 2.46 KB | carlos8f |
| #11 | kobayashi-maru-drupalget.patch | 2.47 KB | carlos8f |
| #8 | kobayashi-maru-chx.patch | 3.52 KB | carlos8f |
| #7 | kobayashi-maru.patch | 689 bytes | carlos8f |
Comments
Comment #1
carlos8f commentedJust as I suspected :-/
Now, merging in the patch from #653940: Clean-up: Tests do not report all errors, to see if that exposes the fatal error.
Comment #2
carlos8f commentedOK, that didn't improve the situation. Now merging with #652394: Aggressive watchdog message assertion, per sun's request.
Comment #3
sunsubscribing
Comment #5
carlos8f commentedFails because of the aggressive watchdog patch, but FilterCRUDTestCase is still disappearing from the results due to the fatal error. Interesting experiment. Further progress will have to be made in the issue, #560646: Fatal PHP errors don't cause tests to fail to fix this.
Comment #6
carlos8f commentedContinuing some testing. The following patches and results can be ignored :)
Comment #7
carlos8f commentedComment #8
carlos8f commentedkobayashi-maru.patch *should* cause the bot to fail the test, if it catches fatal errors properly. Now merging with #560646: Fatal PHP errors don't cause tests to fail (comment #12).
Comment #9
sunI do not see a difference between #6 and #7, but you somehow managed to make #6 fail.
Comment #10
carlos8f commented@sun: #6 had windows line endings. the bot doesn't like them :)
Comment #11
carlos8f commentedComment #13
sunerrr. So all we're missing is this?
This review is powered by Dreditor.
Comment #14
carlos8f commentedWith #11, I am testing whether fatal errors are caught when the page requested with drupalGet() has a fatal error on it.
Results are:
Hmm.
Comment #15
carlos8f commented@sun: I'm not convinced that SIMPLETEST_COLLECT_ERRORS does anything for catching fatal errors. I think the 'collection' mechanism is simply to record errors in an array for later reference by the test. I could be wrong though! Lots more testing to do on these testing systems.
Comment #16
sunBut your patch in #11 failed?
See http://api.drupal.org/api/function/_drupal_log_error/7
Note that this approach currently only tests fatal errors on the "client site". Not in the parent site, e.g. in tests. For example, see #656300: Typo in system.test prevents D7 from passing tests.
Comment #17
carlos8f commentedHere SIMPLETEST_COLLECT_ERRORS will be FALSE. If this passes, you are right.
I'm not marking this issue critical, since it's simply my private test area for PIFR right now. I'll report back to #560646: Fatal PHP errors don't cause tests to fail when I figure out what the solution is.
I tried to make it clear in #14 that #11 only deals with fatals in drupalGet() responses. Ideally code in .test files and pages invoked by drupalGet() will report fatals securely. I'm aware that if a fatal occurs in a test class, the entire class will disappear from the test results, because each class gets tested within its own
HTTP requestedit: PHP process or HTTP request. So the way to catch fatals in test classes would be different -- it would involve comparing the number of test classes in the results with the number from before the tests, if they don't match, a fatal error probably occurred and mark the whole test as failed. I don't know anything about how PIFR invokes simpletest yet, so I'll have to research how to implement that tomorrow. So far, I'm getting different pass/fail results in standard Drupal SimpleTest, run-tests.sh, and PIFR for the same code. Kind of frustrating :-/Comment #19
carlos8f commentedOK, I am installing pifr on a local machine to see what I can do.
Comment #20
glacialheart commentedsubscribing
Comment #21
carlos8f commentedgogogo
Comment #22
carlos8f commentedWOOOO!!!
The results from the test above reveal that the Comment tests are broken in HEAD due to the fatal error I described in http://drupal.org/node/653940#comment-2366180.
I'm taking this patch over to #560646: Fatal PHP errors don't cause tests to fail for review. That was well worth an all-nighter! :-D