Skip to content

Commit

Permalink
Make merged test wrappers single file friendly (#86428)
Browse files Browse the repository at this point in the history
Assembly.Location returns an empty string in single file.
  • Loading branch information
MichalStrehovsky authored May 21, 2023
1 parent 72fb58b commit 8f04ae1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/tests/Common/CoreCLRTestLibrary/OutOfProcessTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public static class OutOfProcessTest
static OutOfProcessTest()
{
reportBase = Directory.GetCurrentDirectory();
testBinaryBase = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)!;
testBinaryBase = AppContext.BaseDirectory;
helixUploadRoot = Environment.GetEnvironmentVariable("HELIX_WORKITEM_UPLOAD_ROOT");
if (!String.IsNullOrEmpty(helixUploadRoot))
{
Expand All @@ -49,10 +49,10 @@ static OutOfProcessTest()
&& !OperatingSystem.IsBrowser()
&& !OperatingSystem.IsOSPlatform("Wasi");

public static void RunOutOfProcessTest(string basePath, string assemblyPath)
public static void RunOutOfProcessTest(string assemblyPath)
{
int ret = -100;
string baseDir = Path.GetDirectoryName(basePath);
string baseDir = AppContext.BaseDirectory;
string outputDir = System.IO.Path.GetFullPath(Path.Combine(reportBase, Path.GetDirectoryName(assemblyPath)));
string outputFile = Path.Combine(outputDir, "output.txt");
string errorFile = Path.Combine(outputDir, "error.txt");
Expand Down
2 changes: 1 addition & 1 deletion src/tests/Common/XUnitWrapperGenerator/ITestInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ public OutOfProcessTest(string displayName, string relativeAssemblyPath)
ExecutionStatement.AppendLine("if (TestLibrary.OutOfProcessTest.OutOfProcessTestsSupported)");
using (ExecutionStatement.NewBracesScope())
{
ExecutionStatement.AppendLine($@"TestLibrary.OutOfProcessTest.RunOutOfProcessTest(typeof(Program).Assembly.Location, @""{relativeAssemblyPath}"");");
ExecutionStatement.AppendLine($@"TestLibrary.OutOfProcessTest.RunOutOfProcessTest(@""{relativeAssemblyPath}"");");
}
}

Expand Down

0 comments on commit 8f04ae1

Please sign in to comment.