From df81d25f1e54464493a5b2a75022077072a13cf5 Mon Sep 17 00:00:00 2001 From: vrana Date: Mon, 6 Aug 2012 16:56:11 -0700 Subject: [PATCH] Depend on events when attaching Diff ID to postponed unit tests Summary: According to @epriestley, it's nasty and kind of crazy: D2933#1. It also stands in my way for D2614. Test Plan: Rewrote our callsite to event listener and verified that it still works. Reviewers: tuomaspelkonen, epriestley Reviewed By: epriestley CC: aran, epriestley Differential Revision: https://secure.phabricator.com/D3171 --- src/unit/engine/ArcanistBaseUnitTestEngine.php | 10 ---------- src/workflow/ArcanistDiffWorkflow.php | 13 +++---------- src/workflow/ArcanistUnitWorkflow.php | 7 ------- 3 files changed, 3 insertions(+), 27 deletions(-) diff --git a/src/unit/engine/ArcanistBaseUnitTestEngine.php b/src/unit/engine/ArcanistBaseUnitTestEngine.php index 2f7473ee..1e673430 100644 --- a/src/unit/engine/ArcanistBaseUnitTestEngine.php +++ b/src/unit/engine/ArcanistBaseUnitTestEngine.php @@ -83,16 +83,6 @@ abstract class ArcanistBaseUnitTestEngine { abstract public function run(); - /** - * This function is called after run() when the diff is created - * Child classes should override this function if they want to - * do more with the diff ID. - */ - public function setDifferentialDiffID($id) { - $this->diffID = $id; - return $this; - } - /** * Modify the return value of this function in the child class, if * you do not need to echo the test results after all the tests have diff --git a/src/workflow/ArcanistDiffWorkflow.php b/src/workflow/ArcanistDiffWorkflow.php index 842a0adc..23ac69b0 100644 --- a/src/workflow/ArcanistDiffWorkflow.php +++ b/src/workflow/ArcanistDiffWorkflow.php @@ -35,8 +35,6 @@ final class ArcanistDiffWorkflow extends ArcanistBaseWorkflow { private $testResults; private $diffID; private $revisionID; - private $unitWorkflow; - private $lintWorkflow; private $postponedLinters; private $haveUncommittedChanges = false; @@ -392,10 +390,6 @@ EOTEXT $this->dispatchDiffWasCreatedEvent($diff_info['diffid']); - if ($this->unitWorkflow) { - $this->unitWorkflow->setDifferentialDiffID($diff_info['diffid']); - } - $this->updateLintDiffProperty(); $this->updateUnitDiffProperty(); $this->updateLocalDiffProperty(); @@ -1117,7 +1111,6 @@ EOTEXT $argv[] = $repository_api->getRelativeCommit(); } $lint_workflow = $this->buildChildWorkflow('lint', $argv); - $this->lintWorkflow = $lint_workflow; if ($this->shouldAmend()) { // TODO: We should offer to create a checkpoint commit. @@ -1183,8 +1176,8 @@ EOTEXT $argv[] = '--rev'; $argv[] = $repository_api->getRelativeCommit(); } - $this->unitWorkflow = $this->buildChildWorkflow('unit', $argv); - $unit_result = $this->unitWorkflow->run(); + $unit_workflow = $this->buildChildWorkflow('unit', $argv); + $unit_result = $unit_workflow->run(); switch ($unit_result) { case ArcanistUnitWorkflow::RESULT_OKAY: @@ -1208,7 +1201,7 @@ EOTEXT break; } - $this->testResults = $this->unitWorkflow->getTestResults(); + $this->testResults = $unit_workflow->getTestResults(); return $unit_result; } catch (ArcanistNoEngineException $ex) { diff --git a/src/workflow/ArcanistUnitWorkflow.php b/src/workflow/ArcanistUnitWorkflow.php index fe28b754..903ed0de 100644 --- a/src/workflow/ArcanistUnitWorkflow.php +++ b/src/workflow/ArcanistUnitWorkflow.php @@ -271,13 +271,6 @@ EOTEXT return $this->testResults; } - public function setDifferentialDiffID($id) { - if ($this->engine) { - $this->engine->setDifferentialDiffID($id); - } - return $this; - } - private static function formatTestDuration($seconds) { // Very carefully define inclusive upper bounds on acceptable unit test // durations. Times are in milliseconds and are in increasing order. -- 2.43.0