Preserve functional test logs on CI (dotnet/extensions#2819)
* Add option to preserve function test logs
* Upload test logs as artifacts
* Preserve binlogs
* Add target to ensure all functional test logs preserved
\n\nCommit migrated from 08aa4560e5
This commit is contained in:
parent
3ab9051a11
commit
d65b7239a6
|
|
@ -295,6 +295,7 @@ namespace Microsoft.AspNetCore.Testing
|
||||||
public string TestName { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
|
public string TestName { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
|
||||||
public static string GetAssemblyBaseDirectory(System.Reflection.Assembly assembly, string baseDirectory = null) { throw null; }
|
public static string GetAssemblyBaseDirectory(System.Reflection.Assembly assembly, string baseDirectory = null) { throw null; }
|
||||||
public static string GetOutputDirectory(System.Reflection.Assembly assembly) { throw null; }
|
public static string GetOutputDirectory(System.Reflection.Assembly assembly) { throw null; }
|
||||||
|
public static bool GetPreserveExistingLogsInOutput(System.Reflection.Assembly assembly) { throw null; }
|
||||||
public static string GetTestClassName(System.Type type) { throw null; }
|
public static string GetTestClassName(System.Type type) { throw null; }
|
||||||
public static string GetTestMethodName(System.Reflection.MethodInfo method, object[] arguments) { throw null; }
|
public static string GetTestMethodName(System.Reflection.MethodInfo method, object[] arguments) { throw null; }
|
||||||
public string GetUniqueFileName(string prefix, string extension) { throw null; }
|
public string GetUniqueFileName(string prefix, string extension) { throw null; }
|
||||||
|
|
@ -307,8 +308,9 @@ namespace Microsoft.AspNetCore.Testing
|
||||||
[System.AttributeUsageAttribute(System.AttributeTargets.Assembly, AllowMultiple=false, Inherited=true)]
|
[System.AttributeUsageAttribute(System.AttributeTargets.Assembly, AllowMultiple=false, Inherited=true)]
|
||||||
public partial class TestOutputDirectoryAttribute : System.Attribute
|
public partial class TestOutputDirectoryAttribute : System.Attribute
|
||||||
{
|
{
|
||||||
public TestOutputDirectoryAttribute(string targetFramework, string baseDirectory = null) { }
|
public TestOutputDirectoryAttribute(string preserveExistingLogsInOutput, string targetFramework, string baseDirectory = null) { }
|
||||||
public string BaseDirectory { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
|
public string BaseDirectory { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
|
||||||
|
public bool PreserveExistingLogsInOutput { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
|
||||||
public string TargetFramework { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
|
public string TargetFramework { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
|
||||||
}
|
}
|
||||||
[System.ObsoleteAttribute("This API is obsolete and the pattern its usage encouraged should not be used anymore. See https://github.com/aspnet/Extensions/issues/1697 for details.")]
|
[System.ObsoleteAttribute("This API is obsolete and the pattern its usage encouraged should not be used anymore. See https://github.com/aspnet/Extensions/issues/1697 for details.")]
|
||||||
|
|
|
||||||
|
|
@ -295,6 +295,7 @@ namespace Microsoft.AspNetCore.Testing
|
||||||
public string TestName { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
|
public string TestName { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
|
||||||
public static string GetAssemblyBaseDirectory(System.Reflection.Assembly assembly, string baseDirectory = null) { throw null; }
|
public static string GetAssemblyBaseDirectory(System.Reflection.Assembly assembly, string baseDirectory = null) { throw null; }
|
||||||
public static string GetOutputDirectory(System.Reflection.Assembly assembly) { throw null; }
|
public static string GetOutputDirectory(System.Reflection.Assembly assembly) { throw null; }
|
||||||
|
public static bool GetPreserveExistingLogsInOutput(System.Reflection.Assembly assembly) { throw null; }
|
||||||
public static string GetTestClassName(System.Type type) { throw null; }
|
public static string GetTestClassName(System.Type type) { throw null; }
|
||||||
public static string GetTestMethodName(System.Reflection.MethodInfo method, object[] arguments) { throw null; }
|
public static string GetTestMethodName(System.Reflection.MethodInfo method, object[] arguments) { throw null; }
|
||||||
public string GetUniqueFileName(string prefix, string extension) { throw null; }
|
public string GetUniqueFileName(string prefix, string extension) { throw null; }
|
||||||
|
|
@ -307,8 +308,9 @@ namespace Microsoft.AspNetCore.Testing
|
||||||
[System.AttributeUsageAttribute(System.AttributeTargets.Assembly, AllowMultiple=false, Inherited=true)]
|
[System.AttributeUsageAttribute(System.AttributeTargets.Assembly, AllowMultiple=false, Inherited=true)]
|
||||||
public partial class TestOutputDirectoryAttribute : System.Attribute
|
public partial class TestOutputDirectoryAttribute : System.Attribute
|
||||||
{
|
{
|
||||||
public TestOutputDirectoryAttribute(string targetFramework, string baseDirectory = null) { }
|
public TestOutputDirectoryAttribute(string preserveExistingLogsInOutput, string targetFramework, string baseDirectory = null) { }
|
||||||
public string BaseDirectory { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
|
public string BaseDirectory { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
|
||||||
|
public bool PreserveExistingLogsInOutput { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
|
||||||
public string TargetFramework { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
|
public string TargetFramework { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
|
||||||
}
|
}
|
||||||
[System.ObsoleteAttribute("This API is obsolete and the pattern its usage encouraged should not be used anymore. See https://github.com/aspnet/Extensions/issues/1697 for details.")]
|
[System.ObsoleteAttribute("This API is obsolete and the pattern its usage encouraged should not be used anymore. See https://github.com/aspnet/Extensions/issues/1697 for details.")]
|
||||||
|
|
|
||||||
|
|
@ -93,6 +93,12 @@ namespace Microsoft.AspNetCore.Testing
|
||||||
return Path.Combine(baseDirectory, assembly.GetName().Name, attribute.TargetFramework);
|
return Path.Combine(baseDirectory, assembly.GetName().Name, attribute.TargetFramework);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static bool GetPreserveExistingLogsInOutput(Assembly assembly)
|
||||||
|
{
|
||||||
|
var attribute = assembly.GetCustomAttributes().OfType<TestOutputDirectoryAttribute>().FirstOrDefault();
|
||||||
|
return attribute.PreserveExistingLogsInOutput;
|
||||||
|
}
|
||||||
|
|
||||||
public static string GetTestClassName(Type type)
|
public static string GetTestClassName(Type type)
|
||||||
{
|
{
|
||||||
var shortNameAttribute =
|
var shortNameAttribute =
|
||||||
|
|
|
||||||
|
|
@ -8,13 +8,15 @@ namespace Microsoft.AspNetCore.Testing
|
||||||
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = false, Inherited = true)]
|
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = false, Inherited = true)]
|
||||||
public class TestOutputDirectoryAttribute : Attribute
|
public class TestOutputDirectoryAttribute : Attribute
|
||||||
{
|
{
|
||||||
public TestOutputDirectoryAttribute(string targetFramework, string baseDirectory = null)
|
public TestOutputDirectoryAttribute(string preserveExistingLogsInOutput, string targetFramework, string baseDirectory = null)
|
||||||
{
|
{
|
||||||
TargetFramework = targetFramework;
|
TargetFramework = targetFramework;
|
||||||
BaseDirectory = baseDirectory;
|
BaseDirectory = baseDirectory;
|
||||||
|
PreserveExistingLogsInOutput = bool.Parse(preserveExistingLogsInOutput);
|
||||||
}
|
}
|
||||||
|
|
||||||
public string BaseDirectory { get; }
|
public string BaseDirectory { get; }
|
||||||
public string TargetFramework { get; }
|
public string TargetFramework { get; }
|
||||||
|
public bool PreserveExistingLogsInOutput { get; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue