Created
April 24, 2015 07:50
-
-
Save kalbasit/27bb67b7428034b32fa4 to your computer and use it in GitHub Desktop.
Phabricator Go Testing.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Go test Wrapper | |
*/ | |
abstract class GoBaseTestEngine extends ArcanistUnitTestEngine { | |
public function run() { | |
$this->affectedTests = array(); | |
foreach ($this->getPaths() as $path) { | |
// Always test the entire folder. | |
if (!is_dir($path)) { | |
// If it's a file but not a go file. Skip this test | |
if (substr($path, -3) != '.go') { | |
continue; | |
} | |
$path = dirname($path); | |
} | |
if (!array_key_exists($path, $this->affectedTests)) { | |
$this->affectedTests[] = $path; | |
} | |
} | |
if (empty($this->affectedTests)) { | |
throw new ArcanistNoEffectException('No tests to run.'); | |
} | |
$parser = new ArcanistGoTestResultParser(); | |
$results = array(); | |
foreach($this->affectedTests as $path) { | |
list($err, $stdout, $stderr) = exec_manual($this->binary . ' test -v ./' . $path); | |
$r = $parser->parseTestResults(null, $stdout . $stderr); | |
$results = array_merge($results, $r); | |
} | |
return $results; | |
} | |
} | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Go test Wrapper | |
*/ | |
final class GodepGoTestEngine extends GoBaseTestEngine { | |
protected $binary = 'godep go'; | |
} | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Go test Wrapper | |
*/ | |
final class GoTestEngine extends GoBaseTestEngine { | |
protected $binary = 'go'; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment