Skip to content

Commit 30d9c38

Browse files
committed
Resolve test artifacts path on macOS (/tmp/ symlink)
1 parent 9db7f5c commit 30d9c38

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/installer/tests/TestUtils/TestContext.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,18 @@ static TestContext()
4444

4545
TestAssetsOutput = GetTestContextVariable("TEST_ASSETS_OUTPUT");
4646
TestArtifactsPath = GetTestContextVariable("TEST_ARTIFACTS");
47+
48+
// On macOS, /tmp/ is a symlink. Running apps out of it will resolve the path, so determine the resolved path here.
49+
if (OperatingSystem.IsMacOS())
50+
{
51+
string tmpPath = "/tmp/";
52+
DirectoryInfo tmp = new DirectoryInfo(tmpPath[..^1]); // No trailing slash in order to properly check the link target
53+
if (tmp.LinkTarget != null && TestArtifactsPath.StartsWith(tmpPath))
54+
{
55+
TestArtifactsPath = Path.Combine(tmp.ResolveLinkTarget(true).FullName, TestArtifactsPath[tmpPath.Length..]);
56+
}
57+
}
58+
4759
Directory.CreateDirectory(TestArtifactsPath);
4860

4961
// Create an empty global.json, so running tests from test artifacts is not affected

0 commit comments

Comments
 (0)