Commit ad2a66de authored by catch's avatar catch
Browse files

Issue #2422745 by alexpott: Reduce simpletest memory limit

parent 4cd30ead
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
* https://www.drupal.org/node/2289201 and * https://www.drupal.org/node/2289201 and
* https://www.drupal.org/node/2307163 and then decrease this limit. * https://www.drupal.org/node/2307163 and then decrease this limit.
*/ */
const SIMPLETEST_MINIMUM_PHP_MEMORY_LIMIT = '320M'; const SIMPLETEST_MINIMUM_PHP_MEMORY_LIMIT = '192M';
/** /**
* Implements hook_requirements(). * Implements hook_requirements().
......
...@@ -522,13 +522,6 @@ function simpletest_script_execute_batch($test_classes) { ...@@ -522,13 +522,6 @@ function simpletest_script_execute_batch($test_classes) {
$test_ids[] = $test_id; $test_ids[] = $test_id;
$test_class = array_shift($test_classes); $test_class = array_shift($test_classes);
// Process phpunit tests immediately since they are fast and we don't need
// to fork for them.
if (is_subclass_of($test_class, '\PHPUnit_Framework_TestCase')) {
simpletest_script_run_phpunit($test_id, $test_class);
continue;
}
// Fork a child process. // Fork a child process.
$command = simpletest_script_command($test_id, $test_class); $command = simpletest_script_command($test_id, $test_class);
$process = proc_open($command, array(), $pipes, NULL, NULL, array('bypass_shell' => TRUE)); $process = proc_open($command, array(), $pipes, NULL, NULL, array('bypass_shell' => TRUE));
...@@ -637,11 +630,15 @@ function simpletest_script_run_one_test($test_id, $test_class) { ...@@ -637,11 +630,15 @@ function simpletest_script_run_one_test($test_id, $test_class) {
$methods = array(); $methods = array();
} }
$test = new $class_name($test_id); $test = new $class_name($test_id);
$test->dieOnFail = (bool) $args['die-on-fail']; if (is_subclass_of($test_class, '\PHPUnit_Framework_TestCase')) {
$test->verbose = (bool) $args['verbose']; simpletest_script_run_phpunit($test_id, $test_class);
$test->run($methods); }
else {
simpletest_script_reporter_display_summary($test_class, $test->results); $test->dieOnFail = (bool) $args['die-on-fail'];
$test->verbose = (bool) $args['verbose'];
$test->run($methods);
simpletest_script_reporter_display_summary($test_class, $test->results);
}
// Finished, kill this runner. // Finished, kill this runner.
exit(0); exit(0);
...@@ -707,6 +704,10 @@ function simpletest_script_command($test_id, $test_class) { ...@@ -707,6 +704,10 @@ function simpletest_script_command($test_id, $test_class) {
* @see simpletest_script_run_one_test() * @see simpletest_script_run_one_test()
*/ */
function simpletest_script_cleanup($test_id, $test_class, $exitcode) { function simpletest_script_cleanup($test_id, $test_class, $exitcode) {
if (strpos($test_class, 'Drupal\\Tests\\') === 0) {
// PHPUnit test, move on.
return;
}
// Retrieve the last database prefix used for testing. // Retrieve the last database prefix used for testing.
list($db_prefix, ) = simpletest_last_test_get($test_id); list($db_prefix, ) = simpletest_last_test_get($test_id);
......
...@@ -38,11 +38,12 @@ abstract class MTimeProtectedFileStorageBase extends PhpStorageTestBase { ...@@ -38,11 +38,12 @@ abstract class MTimeProtectedFileStorageBase extends PhpStorageTestBase {
*/ */
protected function setUp() { protected function setUp() {
parent::setUp(); parent::setUp();
$this->directory = sys_get_temp_dir() . '/php' . str_replace('\\','_', get_class($this));
$this->secret = $this->randomMachineName(); $this->secret = $this->randomMachineName();
$this->settings = array( $this->settings = array(
'directory' => sys_get_temp_dir() . '/php', 'directory' => $this->directory,
'bin' => 'test', 'bin' => 'test',
'secret' => $this->secret, 'secret' => $this->secret,
); );
...@@ -69,7 +70,7 @@ public function testSecurity() { ...@@ -69,7 +70,7 @@ public function testSecurity() {
$php = new $this->storageClass($this->settings); $php = new $this->storageClass($this->settings);
$name = 'simpletest.php'; $name = 'simpletest.php';
$php->save($name, '<?php'); $php->save($name, '<?php');
$expected_root_directory = sys_get_temp_dir() . '/php/test'; $expected_root_directory = $this->directory . '/test';
if (substr($name, -4) === '.php') { if (substr($name, -4) === '.php') {
$expected_directory = $expected_root_directory . '/' . substr($name, 0, -4); $expected_directory = $expected_root_directory . '/' . substr($name, 0, -4);
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment