When using run-tests.sh to test sites that have caching enabled, the HTML of the site's front page gets embedded in the run-tests.sh output.

This appears to be happening because run-tests.sh masquerades as Apache by setting $_SERVER['SERVER_SOFTWARE'] to "Apache" (around line #19):

if ($args['execute-batch']) {
  // Masquerade as Apache for running tests.
  simpletest_script_init("Apache");
  simpletest_script_execute_batch();
}

…while bootstrap.inc outputs the cache unless $_SERVER['SERVER_SOFTWARE'] is set to "PHP CLI":

  if (!$user->uid && $_SERVER['REQUEST_METHOD'] == 'GET' && count(drupal_set_message()) == 0 && $_SERVER['SERVER_SOFTWARE'] !== 'PHP CLI') {
    $cache = cache_get($base_root . request_uri(), 'cache_page');
…

The extraneous output throws off Jenkins, causing the build to fail. Though I could set $conf = array('cache' => '0'); in the settings.php file, I'd prefer to leave caching enabled, since in the same job I'd like to run Selenium tests that more accurately reflect the current live site.

Alternatively, changing line #21 to simpletest_script_init("PHP CLI"); also seems to fix the problem, but will there be side effects to changing that?

Comments

matt v.’s picture

Issue summary: View changes

making it more clear that the issue is specific to run-tests.sh

lendude’s picture

Issue summary: View changes
Status: Active » Closed (outdated)

This version is not supported anymore.