1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-09-20 01:08:50 +02:00

Improve performance of Phabricator unit tests

Summary: Build one fixture total, not one per test case. Depends on D5258.

Test Plan: `arc unit --everything`

Reviewers: vrana

Reviewed By: vrana

CC: aran

Differential Revision: https://secure.phabricator.com/D5259
This commit is contained in:
epriestley 2013-03-06 13:53:48 -08:00
parent a7cbcb3495
commit 457b91f6cb

View file

@ -56,22 +56,35 @@ abstract class PhabricatorTestCase extends ArcanistPhutilTestCase {
return $config;
}
protected function willRunTests() {
public function willRunTestCases(array $test_cases) {
$root = dirname(phutil_get_library_root('phabricator'));
require_once $root.'/scripts/__init_script__.php';
$config = $this->getComputedConfiguration();
if ($config[self::PHABRICATOR_TESTCONFIG_ISOLATE_LISK]) {
LiskDAO::beginIsolateAllLiskEffectsToCurrentProcess();
}
if ($config[self::PHABRICATOR_TESTCONFIG_BUILD_STORAGE_FIXTURES]) {
++self::$storageFixtureReferences;
if (!self::$storageFixture) {
self::$storageFixture = $this->newStorageFixture();
}
}
}
public function didRunTestCases(array $test_cases) {
if (self::$storageFixture) {
self::$storageFixtureReferences--;
if (!self::$storageFixtureReferences) {
self::$storageFixture = null;
}
}
}
protected function willRunTests() {
$config = $this->getComputedConfiguration();
if ($config[self::PHABRICATOR_TESTCONFIG_ISOLATE_LISK]) {
LiskDAO::beginIsolateAllLiskEffectsToCurrentProcess();
}
$this->env = PhabricatorEnv::beginScopedEnv();
}
@ -83,13 +96,6 @@ abstract class PhabricatorTestCase extends ArcanistPhutilTestCase {
LiskDAO::endIsolateAllLiskEffectsToCurrentProcess();
}
if (self::$storageFixture) {
self::$storageFixtureReferences--;
if (!self::$storageFixtureReferences) {
self::$storageFixture = null;
}
}
try {
if (phutil_is_hiphop_runtime()) {
$this->env->__destruct();