]> khamidou — GitHub mirrors - arcanist.git/commitdiff
Depend on events when attaching Diff ID to postponed unit tests
authorvrana <jakubv@fb.com>
Mon, 6 Aug 2012 23:56:11 +0000 (16:56 -0700)
committervrana <jakubv@fb.com>
Wed, 8 Aug 2012 19:04:15 +0000 (12:04 -0700)
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
src/workflow/ArcanistDiffWorkflow.php
src/workflow/ArcanistUnitWorkflow.php

index 2f7473eeb3dd44f3982007b6cf40cf5251ede3f3..1e6734308c92f1e97900056b346336854b1f5285 100644 (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
index 842a0adc561b13a891ce133d680e1407bbb31308..23ac69b0176f295daf8fe4e362d4d2bae4091458 100644 (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) {
index fe28b75448853ca749e67b54797ea5244068da0e..903ed0dec7c8fa99a0295dbb0dbacfcc20b3d8bb 100644 (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.