Skip to content

Commit ed9abdd

Browse files
committed
Mock Java 8 toolchain so sibling test works on arm runners
1 parent 287fb80 commit ed9abdd

File tree

1 file changed

+8
-0
lines changed
  • java/ql/integration-tests/all-platforms/java/buildless-sibling-projects

1 file changed

+8
-0
lines changed

java/ql/integration-tests/all-platforms/java/buildless-sibling-projects/test.py

+8
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,19 @@
1414
toolchains_dir = tempfile.mkdtemp(prefix="integration-tests-toolchains-")
1515
toolchains_file = os.path.join(toolchains_dir, "toolchains.xml")
1616

17+
def none_or_blank(s):
18+
return s is None or s == ""
19+
1720
with open(toolchains_file, "w") as f:
1821
f.write('<?xml version="1.0" encoding="UTF-8"?>\n<toolchains>\n')
1922

2023
for v in [8, 11, 17, 21]:
2124
homedir = os.getenv("JAVA_HOME_%d_X64" % v)
25+
if none_or_blank(homedir):
26+
homedir = os.getenv("JAVA_HOME_%d_arm64" % v)
27+
if none_or_blank(homedir) and v == 8 and not none_or_blank(os.getenv("JAVA_HOME_11_arm64")):
28+
print("Mocking a toolchain entry using Java 11 install as a fake Java 8 entry, so this test behaves the same on x64 and arm64 runners", file = sys.stderr)
29+
homedir = os.getenv("JAVA_HOME_11_arm64")
2230
if homedir is not None and homedir != "":
2331
f.write("""
2432
<toolchain>

0 commit comments

Comments
 (0)