1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2025-01-11 15:21:03 +01:00

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
This commit is contained in:
vrana 2012-08-06 16:56:11 -07:00
parent cb5cfb28cd
commit df81d25f1e
3 changed files with 3 additions and 27 deletions

View file

@ -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

View file

@ -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) {

View file

@ -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.