return children;
}
- public int RunTest(string executable, string outputFile, string errorFile, string category, string testBinaryBase)
+ public int RunTest(string executable, string outputFile, string errorFile, string category, string testBinaryBase, string outputDir)
{
Debug.Assert(outputFile != errorFile);
process.StartInfo.RedirectStandardError = true;
process.StartInfo.EnvironmentVariables.Add("__Category", category);
process.StartInfo.EnvironmentVariables.Add("__TestBinaryBase", testBinaryBase);
+ process.StartInfo.EnvironmentVariables.Add("__OutputDir", outputDir);
DateTime startTime = DateTime.Now;
process.Start();
<PackageReference Include="Microsoft.DotNet.XUnitConsoleRunner" Version="$(MicrosoftDotNetXUnitConsoleRunnerVersion)" />
</ItemGroup>
+ <ItemGroup>
+ <Content Include="xunit.runner.json" CopyToOutputDirectory="PreserveNewest" />
+ </ItemGroup>
+
<Import Sdk="Microsoft.NET.Sdk" Project="Sdk.targets" />
</Project>
]]>
</XunitWrapperGenCsProj>
+ <XunitRunnerConfig>
+ <![CDATA[
+{
+ "diagnosticMessages": true,
+ "longRunningTestSeconds": 120,
+ "shadowCopy": false,
+ "preEnumerateTheories": false
+}
+]]>
+ </XunitRunnerConfig>
</PropertyGroup>
<!-- <Exec Command="md" -->
File="$(XunitWrapperSrcDir)\$(XunitWrapper).csproj"
Lines="$(XunitWrapperGenCsProj)"
Overwrite="true" />
+
+ <!-- Write the file -->
+ <WriteLinesToFile
+ File="$(XunitWrapperSrcDir)\xunit.runner.json"
+ Lines="$(XunitRunnerConfig)"
+ Overwrite="true" />
</Target>
<Target Name="BuildXunitWrapper">
internal static string testBinaryBase%3B
internal static string coreRoot%3B
internal static string category%3B
+ internal static string helixUploadRoot%3B
static _Global()
{
testBinaryBase = System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)%3B
coreRoot = System.Environment.GetEnvironmentVariable(%22CORE_ROOT%22)%3B
category = "$([System.String]::Copy($(Category)).Replace(".","_").Replace("\","").Replace("-","_"))"%3B
+ helixUploadRoot = System.Environment.GetEnvironmentVariable(%22HELIX_WORKITEM_UPLOAD_ROOT%22)%3B
+ if (!String.IsNullOrEmpty(helixUploadRoot)) {
+ reportBase = System.IO.Path.Combine(System.IO.Path.GetFullPath(helixUploadRoot), "Reports")%3B
+ }
if (String.IsNullOrEmpty(reportBase)) {
reportBase = System.IO.Path.Combine(testBinaryBase, "Reports")%3B
string outputFile = null%3B
string errorFile = null%3B
string testExecutable = null%3B
+ string outputDir = null%3B
Exception infraEx = null%3B
try
errorFile = System.IO.Path.GetFullPath(_Global.reportBase + testSubfolder + @"%(AllCMDs.FileName).error.txt")%3B
testExecutable = System.IO.Path.GetFullPath(_Global.testBinaryBase + @"$([System.String]::Copy('%(AllCMDs.FullPath)').Replace("$(_CMDDIR)",''))")%3B
$(TestExecutableReplacement)
+ outputDir = System.IO.Path.GetDirectoryName(outputFile)%3B
if (!_Global.runningInWindows) {
testExecutable = testExecutable.Replace(".cmd", ".sh")%3B
System.IO.Directory.CreateDirectory(_Global.reportBase + testSubfolder)%3B
- ret = wrapper.RunTest(testExecutable, outputFile, errorFile, _Global.category, _Global.testBinaryBase)%3B
+ ret = wrapper.RunTest(testExecutable, outputFile, errorFile, _Global.category, _Global.testBinaryBase, outputDir)%3B
}
catch (Exception ex)
{
// Add Android app running log to testOutput
if (ret != CoreclrTestWrapperLib.EXIT_SUCCESS_CODE)
{
- string androidLogFile = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(testExecutable), "adb-logcat-net.dot." + _Global.category + ".log")%3B
+ string androidLogFile = System.IO.Path.Combine(outputDir, "adb-logcat-net.dot." + _Global.category + "-net.dot.MonoRunner.log")%3B
if(File.Exists(androidLogFile))
{
testOutput.AddRange(System.IO.File.ReadAllLines(androidLogFile))%3B