Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,13 @@ public TestRunDirectories(string rootDirectory, string? firstTestSource, bool is
RootDeploymentDirectory = rootDirectory;
InDirectory = Path.Combine(RootDeploymentDirectory, DeploymentInDirectorySuffix);

OutDirectory = isAppDomainCreationDisabled && firstTestSource is not null
? Path.GetDirectoryName(firstTestSource)!
: Path.Combine(RootDeploymentDirectory, DeploymentOutDirectorySuffix);
string? testSourceDirectory = isAppDomainCreationDisabled && !StringEx.IsNullOrEmpty(firstTestSource)
Comment thread
Evangelink marked this conversation as resolved.
? Path.GetDirectoryName(firstTestSource)
: null;

OutDirectory = StringEx.IsNullOrEmpty(testSourceDirectory)
? Path.Combine(RootDeploymentDirectory, DeploymentOutDirectorySuffix)
: testSourceDirectory;

InMachineNameDirectory = Path.Combine(InDirectory, Environment.MachineName);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,19 @@ public void OutDirectoryShouldReturnCorrectDirectory()

public void InMachineNameDirectoryShouldReturnMachineSpecificDeploymentDirectory()
=> _testRunDirectories.InMachineNameDirectory.Should().Be(Path.Combine(@"C:\temp\In", Environment.MachineName));

public void OutDirectoryShouldFallBackWhenFirstTestSourceIsEmpty()
{
// Simulates Android CoreCLR where Assembly.Location returns "" (before synthetic path).
var directories = new TestRunDirectories(@"C:\temp", firstTestSource: string.Empty, isAppDomainCreationDisabled: true);
directories.OutDirectory.Should().Be(@"C:\temp\Out");
}

public void OutDirectoryShouldFallBackWhenFirstTestSourceIsRelativePath()
{
// Simulates Android MonoVM / CoreCLR after PR #7772 where Assembly.Location
// is a relative filename like "MyTests.dll" with no directory component.
var directories = new TestRunDirectories(@"C:\temp", firstTestSource: "MyTests.dll", isAppDomainCreationDisabled: true);
directories.OutDirectory.Should().Be(@"C:\temp\Out");
}
}