Skip to content

Commit 84932a0

Browse files
committed
fix for JDK 17
1 parent 8853ed7 commit 84932a0

File tree

1 file changed

+27
-20
lines changed

1 file changed

+27
-20
lines changed

experiments/wb-exp.py

Lines changed: 27 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -481,34 +481,42 @@ def createOneJob(state, sut, seed, setting, configName):
481481
return code
482482

483483

484+
def getJavaExeByJDK(platform):
485+
486+
if platform == JDK_8:
487+
path = JAVA_HOME_8 +"/bin/java"
488+
elif platform == JDK_11:
489+
path = JAVA_HOME_11 +"/bin/java"
490+
elif platform == JDK_17:
491+
path = JAVA_HOME_17 +"/bin/java"
492+
elif platform == JDK_21:
493+
path = JAVA_HOME_21 +"/bin/java"
494+
else:
495+
raise Exception("ERROR: unhandled JVM version: " + platform)
496+
497+
path = str(pathlib.PurePath(path).as_posix())
498+
499+
# due to possible spaces in Windows folder paths
500+
path = "\"" + path + "\" "
501+
502+
return path
503+
504+
484505
def getJavaExe(sut):
485506

486507
if not isJava(sut):
487508
raise Exception("ERROR: not a recognized JVM SUT: " + sut.platform)
488509

489-
if sut.platform == JDK_8:
490-
JAVA = JAVA_HOME_8 +"/bin/java"
491-
elif sut.platform == JDK_11:
492-
JAVA = JAVA_HOME_11 +"/bin/java"
493-
elif sut.platform == JDK_17:
494-
JAVA = JAVA_HOME_17 +"/bin/java"
495-
elif sut.platform == JDK_21:
496-
JAVA = JAVA_HOME_21 +"/bin/java"
497-
else:
498-
raise Exception("ERROR: unhandled JVM version: " + sut.platform)
499-
500-
JAVA = str(pathlib.PurePath(JAVA).as_posix())
501-
502-
return JAVA
510+
return getJavaExeByJDK(sut.platform)
503511

504512

505513
def getJavaCommand(sut):
506514

507515
JAVA = getJavaExe(sut)
508-
# due to possible spaces in Windows folder paths
509-
JAVA = "\"" + JAVA + "\" "
510-
if sut.platform == JDK_17 or sut.platform == JDK_21:
511-
JAVA = JAVA + " --add-opens java.base/java.net=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED "
516+
517+
# TODO no longer needed?
518+
# if sut.platform == JDK_17 or sut.platform == JDK_21:
519+
# JAVA = JAVA + " --add-opens java.base/java.net=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED "
512520

513521
return JAVA
514522

@@ -609,13 +617,12 @@ def addJobBody(port, sut, seed, setting, configName):
609617
# params += " --enableBasicAssertions=false" # TODO need to deal with flakiness
610618

611619

612-
JAVA = getJavaCommand(sut)
620+
JAVA = getJavaExeByJDK(JDK_21)
613621
command = JAVA + EVOMASTER_JAVA_OPTIONS + params + " >> " + em_log + " 2>&1"
614622

615623
script.write("\n\necho \"Starting EvoMaster with: " + command + "\"\n")
616624
script.write("echo\n\n")
617625

618-
619626
script.write(command + " \n\n")
620627

621628
return script.getvalue()

0 commit comments

Comments
 (0)