Changeset View
Changeset View
Standalone View
Standalone View
src/unit/engine/XUnitTestEngine.php
Show First 20 Lines • Show All 98 Lines • ▼ Show 20 Lines | class XUnitTestEngine extends ArcanistUnitTestEngine { | ||||
* and test based on the files that have changed. | * and test based on the files that have changed. | ||||
* | * | ||||
* @return array Array of test results. | * @return array Array of test results. | ||||
*/ | */ | ||||
public function run() { | public function run() { | ||||
$this->loadEnvironment(); | $this->loadEnvironment(); | ||||
if ($this->getRunAllTests()) { | if ($this->getRunAllTests()) { | ||||
$paths = id(new FileFinder($this->projectRoot))->find(); | $paths = (new FileFinder($this->projectRoot))->find(); | ||||
} else { | } else { | ||||
$paths = $this->getPaths(); | $paths = $this->getPaths(); | ||||
} | } | ||||
return $this->runAllTests($this->mapPathsToResults($paths)); | return $this->runAllTests($this->mapPathsToResults($paths)); | ||||
} | } | ||||
/** | /** | ||||
▲ Show 20 Lines • Show All 167 Lines • ▼ Show 20 Lines | foreach ($test_assemblies as $test_assembly) { | ||||
$build_future = new ExecFuture( | $build_future = new ExecFuture( | ||||
'%C %s', | '%C %s', | ||||
$this->buildEngine, | $this->buildEngine, | ||||
'/p:SkipTestsOnBuild=True'); | '/p:SkipTestsOnBuild=True'); | ||||
$build_future->setCWD(Filesystem::resolvePath( | $build_future->setCWD(Filesystem::resolvePath( | ||||
dirname($test_assembly['project']))); | dirname($test_assembly['project']))); | ||||
$build_futures[$test_assembly['project']] = $build_future; | $build_futures[$test_assembly['project']] = $build_future; | ||||
} | } | ||||
$iterator = id(new FutureIterator($build_futures))->limit(1); | $iterator = (new FutureIterator($build_futures))->limit(1); | ||||
foreach ($iterator as $test_assembly => $future) { | foreach ($iterator as $test_assembly => $future) { | ||||
$result = new ArcanistUnitTestResult(); | $result = new ArcanistUnitTestResult(); | ||||
$result->setName('(build) '.$test_assembly); | $result->setName('(build) '.$test_assembly); | ||||
try { | try { | ||||
$future->resolvex(); | $future->resolvex(); | ||||
$result->setResult(ArcanistUnitTestResult::RESULT_PASS); | $result->setResult(ArcanistUnitTestResult::RESULT_PASS); | ||||
} catch (CommandException $exc) { | } catch (CommandException $exc) { | ||||
▲ Show 20 Lines • Show All 59 Lines • ▼ Show 20 Lines | foreach ($test_assemblies as $test_assembly) { | ||||
list($future_r, $xunit_temp, $coverage) = | list($future_r, $xunit_temp, $coverage) = | ||||
$this->buildTestFuture($test_assembly['assembly']); | $this->buildTestFuture($test_assembly['assembly']); | ||||
$futures[$test_assembly['assembly']] = $future_r; | $futures[$test_assembly['assembly']] = $future_r; | ||||
$outputs[$test_assembly['assembly']] = $xunit_temp; | $outputs[$test_assembly['assembly']] = $xunit_temp; | ||||
$coverages[$test_assembly['assembly']] = $coverage; | $coverages[$test_assembly['assembly']] = $coverage; | ||||
} | } | ||||
// Run all of the tests. | // Run all of the tests. | ||||
$futures = id(new FutureIterator($futures)) | $futures = (new FutureIterator($futures)) | ||||
->limit(8); | ->limit(8); | ||||
foreach ($futures as $test_assembly => $future) { | foreach ($futures as $test_assembly => $future) { | ||||
list($err, $stdout, $stderr) = $future->resolve(); | list($err, $stdout, $stderr) = $future->resolve(); | ||||
if (file_exists($outputs[$test_assembly])) { | if (file_exists($outputs[$test_assembly])) { | ||||
$result = $this->parseTestResult( | $result = $this->parseTestResult( | ||||
$outputs[$test_assembly], | $outputs[$test_assembly], | ||||
$coverages[$test_assembly]); | $coverages[$test_assembly]); | ||||
▲ Show 20 Lines • Show All 90 Lines • Show Last 20 Lines |
Content licensed under Creative Commons Attribution-ShareAlike 4.0 (CC-BY-SA) unless otherwise noted; code licensed under Apache 2.0 or other open source licenses. · CC BY-SA 4.0 · Apache 2.0