mirror of
https://we.phorge.it/source/arcanist.git
synced 2025-01-26 22:48:18 +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:
parent
cb5cfb28cd
commit
df81d25f1e
3 changed files with 3 additions and 27 deletions
|
@ -83,16 +83,6 @@ abstract class ArcanistBaseUnitTestEngine {
|
||||||
|
|
||||||
abstract public function run();
|
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
|
* 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
|
* you do not need to echo the test results after all the tests have
|
||||||
|
|
|
@ -35,8 +35,6 @@ final class ArcanistDiffWorkflow extends ArcanistBaseWorkflow {
|
||||||
private $testResults;
|
private $testResults;
|
||||||
private $diffID;
|
private $diffID;
|
||||||
private $revisionID;
|
private $revisionID;
|
||||||
private $unitWorkflow;
|
|
||||||
private $lintWorkflow;
|
|
||||||
private $postponedLinters;
|
private $postponedLinters;
|
||||||
private $haveUncommittedChanges = false;
|
private $haveUncommittedChanges = false;
|
||||||
|
|
||||||
|
@ -392,10 +390,6 @@ EOTEXT
|
||||||
|
|
||||||
$this->dispatchDiffWasCreatedEvent($diff_info['diffid']);
|
$this->dispatchDiffWasCreatedEvent($diff_info['diffid']);
|
||||||
|
|
||||||
if ($this->unitWorkflow) {
|
|
||||||
$this->unitWorkflow->setDifferentialDiffID($diff_info['diffid']);
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->updateLintDiffProperty();
|
$this->updateLintDiffProperty();
|
||||||
$this->updateUnitDiffProperty();
|
$this->updateUnitDiffProperty();
|
||||||
$this->updateLocalDiffProperty();
|
$this->updateLocalDiffProperty();
|
||||||
|
@ -1117,7 +1111,6 @@ EOTEXT
|
||||||
$argv[] = $repository_api->getRelativeCommit();
|
$argv[] = $repository_api->getRelativeCommit();
|
||||||
}
|
}
|
||||||
$lint_workflow = $this->buildChildWorkflow('lint', $argv);
|
$lint_workflow = $this->buildChildWorkflow('lint', $argv);
|
||||||
$this->lintWorkflow = $lint_workflow;
|
|
||||||
|
|
||||||
if ($this->shouldAmend()) {
|
if ($this->shouldAmend()) {
|
||||||
// TODO: We should offer to create a checkpoint commit.
|
// TODO: We should offer to create a checkpoint commit.
|
||||||
|
@ -1183,8 +1176,8 @@ EOTEXT
|
||||||
$argv[] = '--rev';
|
$argv[] = '--rev';
|
||||||
$argv[] = $repository_api->getRelativeCommit();
|
$argv[] = $repository_api->getRelativeCommit();
|
||||||
}
|
}
|
||||||
$this->unitWorkflow = $this->buildChildWorkflow('unit', $argv);
|
$unit_workflow = $this->buildChildWorkflow('unit', $argv);
|
||||||
$unit_result = $this->unitWorkflow->run();
|
$unit_result = $unit_workflow->run();
|
||||||
|
|
||||||
switch ($unit_result) {
|
switch ($unit_result) {
|
||||||
case ArcanistUnitWorkflow::RESULT_OKAY:
|
case ArcanistUnitWorkflow::RESULT_OKAY:
|
||||||
|
@ -1208,7 +1201,7 @@ EOTEXT
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->testResults = $this->unitWorkflow->getTestResults();
|
$this->testResults = $unit_workflow->getTestResults();
|
||||||
|
|
||||||
return $unit_result;
|
return $unit_result;
|
||||||
} catch (ArcanistNoEngineException $ex) {
|
} catch (ArcanistNoEngineException $ex) {
|
||||||
|
|
|
@ -271,13 +271,6 @@ EOTEXT
|
||||||
return $this->testResults;
|
return $this->testResults;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setDifferentialDiffID($id) {
|
|
||||||
if ($this->engine) {
|
|
||||||
$this->engine->setDifferentialDiffID($id);
|
|
||||||
}
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static function formatTestDuration($seconds) {
|
private static function formatTestDuration($seconds) {
|
||||||
// Very carefully define inclusive upper bounds on acceptable unit test
|
// Very carefully define inclusive upper bounds on acceptable unit test
|
||||||
// durations. Times are in milliseconds and are in increasing order.
|
// durations. Times are in milliseconds and are in increasing order.
|
||||||
|
|
Loading…
Add table
Reference in a new issue