Skip to content

Commit 83f3579

Browse files
committed
Fix detection of GHA
1 parent ed9b99e commit 83f3579

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

test/jdk/tools/jlink/plugins/AddSapMachineToolsTest.java

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,27 @@ public class AddSapMachineToolsTest {
5959

6060
@Test
6161
public void testSapMachineTools() throws IOException {
62+
System.out.println("\n\nSystem properties:");
63+
System.getProperties().forEach((key, value) -> {
64+
System.out.println(key + ": " + value);
65+
});
66+
System.out.println("\n\nEnvironment:");
67+
System.getenv().forEach((key, value) -> {
68+
System.out.println(key + ": " + value);
69+
});
70+
6271
// async profiler is only available on restricted set of platforms and not in Github Actions builds
63-
String gha = System.getenv("GITHUB_ACTIONS");
64-
boolean shouldHaveAsync = (gha == null || !gha.contains("true")) &&
72+
// checking whether we are in GHA environment is hacky, we guess by seeing a path in /Users/runner/work
73+
String testRoot = System.getenv("test.root");
74+
boolean shouldHaveAsync = (testRoot == null || !testRoot.startsWith("/Users/runner/work")) &&
6575
(Platform.isOSX() ||
6676
(Platform.isLinux() && (Platform.isAArch64() || Platform.isPPC() || Platform.isX64()) && !Platform.isMusl()));
6777

78+
System.out.println("\n\nshouldHaveAsync:" + shouldHaveAsync);
79+
if (true) {
80+
throw new RuntimeException("Desired");
81+
}
82+
6883
Path sourceJavaHome = Path.of(System.getProperty("java.home"));
6984

7085
if (!shouldHaveAsync) {

0 commit comments

Comments
 (0)