Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F18623062
D7594.id17136.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
4 KB
Referenced Files
None
Subscribers
None
D7594.id17136.diff
View Options
Index: src/unit/engine/CSharpToolsTestEngine.php
===================================================================
--- src/unit/engine/CSharpToolsTestEngine.php
+++ src/unit/engine/CSharpToolsTestEngine.php
@@ -128,6 +128,9 @@
}
}
}
+ if (count($assemblies_to_instrument) === 0) {
+ return parent::buildTestFuture($test_assembly);
+ }
$future = new ExecFuture(
"%C -o %s -c %s -a %s -w %s %Ls",
trim($this->runtimeEngine." ".$this->coverEngine),
Index: src/unit/engine/XUnitTestEngine.php
===================================================================
--- src/unit/engine/XUnitTestEngine.php
+++ src/unit/engine/XUnitTestEngine.php
@@ -319,17 +319,22 @@
// FIXME: Can't use TempFile here as xUnit doesn't like
// UNIX-style full paths. It sees the leading / as the
// start of an option flag, even when quoted.
- $xunit_temp = $test_assembly.".results.xml";
+ $xunit_temp = basename($test_assembly.".".time().".results.xml");
if (file_exists($xunit_temp)) {
unlink($xunit_temp);
}
$future = new ExecFuture(
- "%C %s /xml %s /silent",
+ "%C %s /xml %s",
trim($this->runtimeEngine." ".$this->testEngine),
- $test_assembly."/bin/Debug/".$test_assembly.".dll",
+ $test_assembly."/bin/Debug/".basename($test_assembly).".dll",
$xunit_temp);
- $future->setCWD(Filesystem::resolvePath($this->projectRoot));
- return array($future, $xunit_temp, null);
+ $folder = Filesystem::resolvePath($this->projectRoot);
+ $future->setCWD($folder);
+ $combined = $folder."/".$xunit_temp;
+ if (phutil_is_windows()) {
+ $combined = $folder."\\".$xunit_temp;
+ }
+ return array($future, $combined, null);
}
/**
@@ -342,37 +347,57 @@
private function testAssemblies(array $test_assemblies) {
$results = array();
+ $remaining = array();
// Build the futures for running the tests.
$futures = array();
$outputs = array();
$coverages = array();
foreach ($test_assemblies as $test_assembly) {
- list($future, $xunit_temp, $coverage) =
+ list($future_r, $xunit_temp, $coverage) =
$this->buildTestFuture($test_assembly);
- $futures[$test_assembly] = $future;
+ $futures[$test_assembly] = $future_r;
$outputs[$test_assembly] = $xunit_temp;
$coverages[$test_assembly] = $coverage;
}
// Run all of the tests.
- foreach (Futures($futures) as $test_assembly => $future) {
- $future->resolve();
-
- if (file_exists($outputs[$test_assembly])) {
- $result = $this->parseTestResult(
- $outputs[$test_assembly],
- $coverages[$test_assembly]);
- $results[] = $result;
- unlink($outputs[$test_assembly]);
- } else {
- $result = new ArcanistUnitTestResult();
- $result->setName("(execute) ".$test_assembly);
- $result->setResult(ArcanistUnitTestResult::RESULT_BROKEN);
- $result->setUserData($outputs[$test_assembly]." not found on disk.");
- $results[] = array($result);
+ do {
+ $remaining = array();
+
+ foreach (Futures($futures) as $test_assembly => $future) {
+ list($err, $stdout, $stderr) = $future->resolve();
+
+ if (file_exists($outputs[$test_assembly])) {
+ $result = $this->parseTestResult(
+ $outputs[$test_assembly],
+ $coverages[$test_assembly]);
+ $results[] = $result;
+ unlink($outputs[$test_assembly]);
+ } else {
+ $remaining[] = $test_assembly;
+ }
}
- }
+
+ // Observed some strange behaviour by xUnit.NET where the
+ // command completes successfully, but the XML file doesn't
+ // end up on disk. It seems to be completely random. If we
+ // keep retrying, eventually the XML file is written after
+ // the command exits, so just do that.
+ if (count($remaining) > 0) {
+ $futures = array();
+ $outputs = array();
+ $coverages = array();
+
+ foreach ($remaining as $test_assembly) {
+ list($future, $xunit_temp, $coverage) =
+ $this->buildTestFuture($test_assembly);
+ $futures[$test_assembly] = $future;
+ $outputs[$test_assembly] = $xunit_temp;
+ $coverages[$test_assembly] = $coverage;
+ }
+ }
+ } while (count($remaining) > 0);
return array_mergev($results);
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Sep 16, 2:07 PM (14 h, 4 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
11741803
Default Alt Text
D7594.id17136.diff (4 KB)
Attached To
Mode
D7594: Fix issues in C# unit test engine
Attached
Detach File
Event Timeline
Log In to Comment