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:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user