Download & Extend

[run-tests.sh] Segmentation fault; D7 function drupal_get_bootstrap_phase() called in D6

Project:SimpleTest
Version:6.x-2.x-dev
Component:Code
Category:bug report
Priority:critical
Assigned:boombatower
Status:closed (fixed)

Issue Summary

Hi,

I just installed simpletest 6.x-2.8, followed all instructions in INSTALL, and I first ran it on xmlsitemap from the browser. It apparently went fine (reporting failures, not surprisingly since that module was often raising error messages).

But then, maybe I missed it, I couldn't find a report in a form suitable for sending to the module maintainer (please tell me if there is).

So I tried to re-run the tests from the command line, but there, every command (except help) ends with a segmentation fault.

mich@claddagh:/usr/local/share/drupal$ sudo -u www-data php ./scripts/run-tests.sh --url http://localhost/drupal/ --file sites/default/modules/xmlsitemap/xmlsitemap.test

Fatal error: Call to undefined function drupal_get_bootstrap_phase() in /usr/local/share/drupal-sites/default/modules/simpletest/simpletest.function.inc on line 130

Call Stack:
    1.8919   19069896   1. _drupal_exception_handler() /usr/local/share/drupal-sites/default/modules/simpletest/simpletest.function.inc:0
    1.8920   19070336   2. _drupal_log_error() /usr/local/share/drupal-sites/default/modules/simpletest/simpletest.function.inc:78

Segmentation fault

It turns up that drupal_get_bootstrap_phase() is in D7 only.

Anyway I then tried simpler :

mich@claddagh:/usr/local/share/drupal$ php scripts/run-tests.sh --clean

Environment cleaned.
- No left over tables to remove.
- No temporary directories to remove.
- Removed 0 test results.
Segmentation fault

That doesn't sound good what do you think ?

I'm running PHP 5.2.6-3ubuntu4.1 with Suhosin-Patch 0.9.6.2 with Apache/2.2.11 (linux ubuntu 9.04)

My drupal installation is based on PostgreSQL 8.3 .

I'd really like to be able to use test driven development for D6, because D7 is not released yet, and many big servers still run 5.x ...

Letting code maintainers improve reliability of their D6 modules would be a good step before they port them to D7.

Thank you for your work.

Best regards,

RockyRoad

Comments

#1

Version:6.x-2.8» 6.x-2.x-dev
Assigned to:Anonymous» boombatower
Status:active» needs review

See if this fixes it.

AttachmentSizeStatusTest resultOperations
473504-bootstrap-phase.patch1.57 KBIgnored: Check issue status.NoneNone

#2

Status:needs review» needs work

Told it still seg faults in IRC.

#3

Hmmm...running block.test with a call to hax() in the testMethod() results in the display of the PHP Fatal error as expected.

Running test with following command:

sudo -u wwwrun php ./scripts/run-tests.sh --php /usr/bin/php --url http://drupal.d6x.loc/ --class BlockTestCase

#4

Status:needs work» needs review

Seems to require a few more updates from D7, but I can now run the xmlsitemap test the same way you do and get the error messages.

AttachmentSizeStatusTest resultOperations
473504-bootstrap-phase.patch3.75 KBIgnored: Check issue status.NoneNone

#5

I still get seg fault in both --clean invocation and the following:

mich@claddagh:/usr/local/share/drupal$ sudo -u www-data php ./scripts/run-tests.sh --url http://localhost/drupal/ --file sites/default/modules/xmlsitemap/xmlsitemap.test

Fatal error: Call to undefined function drupal_get_page() in /usr/local/share/drupal-sites/available/simpletest-6.x-2-dev/simpletest.function.inc on line 179

Call Stack:
    1.3117   19284844   1. _drupal_exception_handler() /usr/local/share/drupal-sites/available/simpletest-6.x-2-dev/simpletest.function.inc:0
    1.3118   19285284   2. _drupal_log_error() /usr/local/share/drupal-sites/available/simpletest-6.x-2-dev/simpletest.function.inc:78

Segmentation fault

You noticed that the error incriminates a different function and line number.

It sounds to me like two different issues:

  • seg fault, occuring even when no test is requested
  • backporting D7 functions, only when invoking tests

An idea: if #475464: SimpleTest: abstract reporter and generate XML reports (extended to text reports) was implemented, run-tests.sh use case could be reconsidered ... but I may well have missed something.

#6

Ooops... previous output was after first patch.

The second patch gave me, for xml test, an html output whose content tells:
"The website encountered an unexpected error. Please try again later."

Same output as before for --clean invocation.

#7

Same here with the patch. What needs to be backported? I could take a look, I need the cli testing for my SoC project.

#8

Hi,

I had postponed working with simpletest, and I needed to retrieve my notes.

I updated from current cvs DRUPAL-6--2 branch, and restarted the tests.

Block and SimpleTests tests succeed from the browser.

From the CLI, run-tests.sh still complains about drupal_get_bootstrap_phase(),
until I reapplied 473504-bootstrap-phase_0 patch , which backports it.

But then, I get an html output with only an error message, but I found no trace of it in apache logs.

Note that, on my localhost where I ran the tests, drupal runs with pgsql.
Nothing indicates that the problem would be there though.

AttachmentSizeStatusTest resultOperations
bug474188-interaction.txt8.46 KBIgnored: Check issue status.NoneNone

#9

I just tried todays dev roll, the class cli tests seem to work fine, cleanup works without segfault. The per-file run still misses the boostrap phase function, but I think i'll be able to run my class tests invoking --class.

#10

The segfault is due to the order of loading the curl and postgresql extensions.

#11

@Damien: any suggestions then? as I don't have postgresql so hard to test.

#12

See http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=411982

This is apparently a bug in pgsql, that frees a little bit too many things from openssl. You have to be sure to load pgsql before curl to workaround this bug. On Debian, it is as simple as:

mv /etc/php5/conf.d/curl.ini /etc/php5/conf.d/z-curl.ini

#13

Status:needs review» reviewed & tested by the community

You're right Damien, thanks :)
After renaming curl.ini and reloading apache, the seg fault disappeared \o/

But I still have "The website encountered an unexpected error" html result, when running either :

sudo -u www-data php ./scripts/run-tests.sh --url http://localhost/drupal/ --file sites/all/modules/simpletest-6.x-2-dev/simpletest.test
sudo -u www-data php ./scripts/run-tests.sh --url http://localhost/drupal/ --file sites/all/modules/simpletest-6.x-2-dev/tests/block.test
sudo -u www-data php ./scripts/run-tests.sh --url http://localhost/drupal/ --file sites/default/modules/xmlsitemap/xmlsitemap.test

I just tried the --class invocation:

sudo -u www-data php ./scripts/run-tests.sh --url http://localhost/drupal/ --class SimpleTestFunctionalTest

It works better, with a text output this time:

Drupal test run
---------------

Tests to be run:
- SimpleTest functionality (SimpleTestFunctionalTest)

Test run started: Tue, 2009-06-16 09:07

Test summary:
-------------

SimpleTest functionality 110 passes, 0 fails, and 0 exceptions

Test run duration: 2 min 54 sec

It works fine with --class BlockTestCase too, with or without the --php /usr/bin/php option, but all 66 tests succeed for me.

#14

Have you tried by group name? This is the prefered way to invoke a test. I'm not even sure if --file works in D7.

#15

ERROR: Unknown argument '--group'.

#16

You can invoke a test group like this: php scripts/run-tests.sh Block

#17

I can't claim to have tested this patch exhaustively... but I was getting the fatal error on the Simpletest admin page, caused by the offending call to drupal_get_bootstrap_phase(), and this patch seems to have resolved my issue. Thanks, and good work.

#18

Status:reviewed & tested by the community» fixed

Please re-open if still an issue.

#19

Status:fixed» closed (fixed)

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