Skip to content

Commit 5c5e66e

Browse files
authored
Investigate helix error return (#70238)
1 parent 27195f6 commit 5c5e66e

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

eng/testing/xunit/xunit.console.targets

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@
3636
<XunitExcludesTxtFileContent>$(_withoutCategories.Replace(';', '%0dcategory='))</XunitExcludesTxtFileContent>
3737
</PropertyGroup>
3838

39+
<PropertyGroup Condition="'$(TestSingleFile)' == 'true'">
40+
<!-- Pass the results file -->
41+
<RunScriptCommand>$(RunScriptCommand) -xml $(TestResultsName)</RunScriptCommand>
42+
</PropertyGroup>
43+
3944
<ItemGroup Condition="'$(TestSingleFile)' != 'true'">
4045
<PackageReference Include="Microsoft.DotNet.XUnitConsoleRunner"
4146
Version="$(MicrosoftDotNetXUnitConsoleRunnerVersion)"

src/libraries/Common/tests/SingleFileTestRunner/SingleFileTestRunner.cs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
using Xunit.Abstractions;
1616
using Xunit.Sdk;
1717

18+
// @TODO medium-to-longer term, we should try to get rid of the special-unicorn-single-file runner in favor of making the real runner work for single file.
19+
// https://github.com/dotnet/runtime/issues/70432
1820
public class SingleFileTestRunner : XunitTestFramework
1921
{
2022
private SingleFileTestRunner(IMessageSink messageSink)
@@ -58,8 +60,9 @@ public static int Main(string[] args)
5860
discoverer.Find(false, discoverySink, TestFrameworkOptions.ForDiscovery(assemblyConfig));
5961
discoverySink.Finished.WaitOne();
6062

63+
string xmlResultFileName = null;
6164
XunitFilters filters = new XunitFilters();
62-
// Quick hack wo much validation to get no traits passed
65+
// Quick hack wo much validation to get args that are passed (notrait, xml)
6366
Dictionary<string, List<string>> noTraits = new Dictionary<string, List<string>>();
6467
for (int i = 0; i < args.Length; i++)
6568
{
@@ -72,6 +75,10 @@ public static int Main(string[] args)
7275
}
7376
values.Add(traitKeyValue[1]);
7477
}
78+
if (args[i].Equals("-xml", StringComparison.OrdinalIgnoreCase))
79+
{
80+
xmlResultFileName=args[i + 1].Trim();
81+
}
7582
}
7683

7784
foreach (KeyValuePair<string, List<string>> kvp in noTraits)
@@ -85,6 +92,12 @@ public static int Main(string[] args)
8592

8693
resultsSink.Finished.WaitOne();
8794

95+
// Helix need to see results file in the drive to detect if the test has failed or not
96+
if(xmlResultFileName != null)
97+
{
98+
resultsXmlAssembly.Save(xmlResultFileName);
99+
}
100+
88101
var failed = resultsSink.ExecutionSummary.Failed > 0 || resultsSink.ExecutionSummary.Errors > 0;
89102
return failed ? 1 : 0;
90103
}

0 commit comments

Comments
 (0)