Skip to content

Commit

Permalink
Merge pull request adoptium#477 from annaibm/support_zlinux_471
Browse files Browse the repository at this point in the history
zlinux micro architecture detection
  • Loading branch information
LongyuZhang authored Apr 17, 2024
2 parents bc04ef1 + 14de8ce commit 8e4a2d4
Show file tree
Hide file tree
Showing 5 changed files with 295 additions and 136 deletions.
70 changes: 69 additions & 1 deletion examples/platformRequirements/playlist.xml
Original file line number Diff line number Diff line change
Expand Up @@ -107,5 +107,73 @@
$(TEST_STATUS)</command>
<platformRequirements>^os.linux.ubuntu.20+</platformRequirements>
</test>
<test>
<testCaseName>test_not_arch_390</testCaseName>
<command>echo "test on none arch.390"; \
$(TEST_STATUS)</command>
<platformRequirements>^arch.390</platformRequirements>
</test>

<test>
<testCaseName>test_arch_x86_skylake</testCaseName>
<command>echo "test arch.x86.skylake"; \
$(TEST_STATUS)</command>
<platformRequirementsList>
<platformRequirements>arch.x86.skylake</platformRequirements>
</platformRequirementsList>
</test>

<test>
<testCaseName>test_arch_390_z15plus</testCaseName>
<command>echo "test arch.390.z15+"; \
$(TEST_STATUS)</command>
<platformRequirementsList>
<platformRequirements>arch.390.z15+</platformRequirements>
</platformRequirementsList>
</test>

<test>
<testCaseName>test_arch_390_z15</testCaseName>
<command>echo "test arch.390.z15"; \
$(TEST_STATUS)</command>
<platformRequirementsList>
<platformRequirements>arch.390.z15</platformRequirements>
</platformRequirementsList>
</test>
<test>
<testCaseName>test_arch_390_z14plus</testCaseName>
<command>echo "test arch.390.z14+"; \
$(TEST_STATUS)</command>
<platformRequirementsList>
<platformRequirements>arch.390.z14+</platformRequirements>
</platformRequirementsList>
</test>

<test>
<testCaseName>test_arch_390_z14</testCaseName>
<command>echo "test arch.390.z14"; \
$(TEST_STATUS)</command>
<platformRequirementsList>
<platformRequirements>arch.390.z14</platformRequirements>
</platformRequirementsList>
</test>

<test>
<testCaseName>test_arch_390_z13plus</testCaseName>
<command>echo "test arch.390.z13+"; \
$(TEST_STATUS)</command>
<platformRequirementsList>
<platformRequirements>arch.390.z13+</platformRequirements>
</platformRequirementsList>
</test>

<test>
<testCaseName>test_arch_390_z13</testCaseName>
<command>echo "test arch.390.z13"; \
$(TEST_STATUS)</command>
<platformRequirementsList>
<platformRequirements>arch.390.z13</platformRequirements>
</platformRequirementsList>
</test>

</playlist>
</playlist>
2 changes: 1 addition & 1 deletion makeGen.mk
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ autoconfig:
perl scripts$(D)configure.pl

autogen: autoconfig
${TEST_JDK_HOME}/bin/java -cp $(Q)$(TKG_JAR)$(P)$(JSON_SIMPLE)$(Q) org.testKitGen.MainRunner --mode=$(MODE) --spec=$(SPEC) --microArch=$(MICROARCH) --osLabel=$(Q)$(OS_LABEL)$(Q) --jdkVersion=$(JDK_VERSION) --impl=$(JDK_IMPL) --vendor=$(Q)$(JDK_VENDOR)$(Q) --buildList=${BUILD_LIST} --iterations=$(TKG_ITERATIONS) --aotIterations=$(AOT_ITERATIONS) --testFlag=$(TEST_FLAG) --testTarget=$(TESTTARGET) --testList=$(TESTLIST) --numOfMachines=$(NUM_MACHINES) --testTime=$(TEST_TIME) --TRSSURL=$(TRSS_URL) $(OPTS)
${TEST_JDK_HOME}/bin/java -cp $(Q)$(TKG_JAR)$(P)$(JSON_SIMPLE)$(Q) org.testKitGen.MainRunner --mode=$(MODE) --spec=$(SPEC) --microArch=$(Q)$(MICROARCH)$(Q) --osLabel=$(Q)$(OS_LABEL)$(Q) --jdkVersion=$(JDK_VERSION) --impl=$(JDK_IMPL) --vendor=$(Q)$(JDK_VENDOR)$(Q) --buildList=${BUILD_LIST} --iterations=$(TKG_ITERATIONS) --aotIterations=$(AOT_ITERATIONS) --testFlag=$(TEST_FLAG) --testTarget=$(TESTTARGET) --testList=$(TESTLIST) --numOfMachines=$(NUM_MACHINES) --testTime=$(TEST_TIME) --TRSSURL=$(TRSS_URL) $(OPTS)

AUTOGEN_FILES = $(wildcard $(CURRENT_DIR)$(D)jvmTest.mk)
AUTOGEN_FILES += $(wildcard $(CURRENT_DIR)$(D)machineConfigure.mk)
Expand Down
259 changes: 159 additions & 100 deletions scripts/testTKG/test_platformRequirements.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,105 +16,164 @@
from utils import *

def run_test():
rt = True
printTestheader("platformRequirements")

buildList = "TKG/examples/platformRequirements"
command = "make _all"
print(f"\t{command}")
result = subprocess.run(f"{EXPORT_BUILDLIST}={buildList}; {CD_TKG}; {MAKE_CLEAN}; {MAKE_COMPILE}; {command}", stderr=subprocess.PIPE, stdout=subprocess.PIPE, shell=True, check=False)

stdout = result.stdout.decode()
specStr = re.search(r"set SPEC to (.*)", stdout)

if specStr is not None:
spec = specStr.group(1)
else:
printError("Could not parse spec from output.")
return False

passed = set()
skipped = set()

if 'linux' in spec:
skipped.add('test_not_linux_arch_x86_0')
else:
if 'x86' in spec:
passed.add('test_not_linux_arch_x86_0')
else:
skipped.add('test_not_linux_arch_x86_0')

if 'x86' in spec:
passed.add('test_arch_x86_0')
skipped.add('test_arch_nonx86_0')
else:
passed.add('test_arch_nonx86_0')
skipped.add('test_arch_x86_0')

if '64' in spec:
passed.add('test_bits_64_0')
else:
skipped.add('test_bits_64_0')

if 'osx' in spec:
passed.add('test_os_osx_0')
else:
skipped.add('test_os_osx_0')

if 'osx_x86-64' in spec:
passed.add('test_osx_x86-64_0')
else:
skipped.add('test_osx_x86-64_0')

if 'x86' in spec or '390' in spec:
passed.add('test_arch_x86_390_0')
else:
skipped.add('test_arch_x86_390_0')

if 'osx_x86-64' in spec or ('win_x86' in spec and 'win_x86-64' not in spec) or 'aix_ppc-64' in spec:
passed.add('test_osx_x86-64_win_x86_aix_ppc-64_0')
else:
skipped.add('test_osx_x86-64_win_x86_aix_ppc-64_0')

os_label = re.search(r"set OS_LABEL to (.*)", stdout)
if os_label is not None:
os_label = os_label.group(1)
label_str = os_label.split(".")
# os_label example: ubuntu.22
try:
ver = int(label_str[1],10)
if label_str[0] == "ubuntu":
if ver >= 22:
passed.add('test_os_linux_ubuntu22_0')
if ver >= 20:
passed.add('test_os_linux_ubuntu20plus_0')
passed.add('test_os_linux_ubuntu20plus_rhel8plus_0')
if ver < 20:
passed.add('test_not_os_linux_ubuntu20plus_0')

if label_str[0] == "rhel":
if ver >= 8:
passed.add('test_os_linux_ubuntu20plus_rhel8plus_0')
except ValueError as ve:
print ("warning: os version value failed to convert to an integer")
passed.add('test_not_os_linux_ubuntu20plus_0')
else:
passed.add('test_not_os_linux_ubuntu20plus_0')

if 'test_os_linux_ubuntu20plus_0' not in passed:
skipped.add('test_os_linux_ubuntu20plus_0')

if 'test_os_linux_ubuntu22_0' not in passed:
skipped.add('test_os_linux_ubuntu22_0')

if 'test_os_linux_ubuntu20plus_rhel8plus_0' not in passed:
skipped.add('test_os_linux_ubuntu20plus_rhel8plus_0')

if 'test_not_os_linux_ubuntu20plus_0' not in passed:
skipped.add('test_not_os_linux_ubuntu20plus_0')

rt &= checkResult(result, passed, set(), set(), skipped)
return rt
rt = True
printTestheader("platformRequirements")

buildList = "TKG/examples/platformRequirements"
command = "make _all"
print(f"\t{command}")
result = subprocess.run(f"{EXPORT_BUILDLIST}={buildList}; {CD_TKG}; {MAKE_CLEAN}; {MAKE_COMPILE}; {command}", stderr=subprocess.PIPE, stdout=subprocess.PIPE, shell=True, check=False)

stdout = result.stdout.decode()
specStr = re.search(r"set SPEC to (.*)", stdout)

if specStr is not None:
spec = specStr.group(1)
else:
printError("Could not parse spec from output.")
return False

passed = set()
skipped = set()

if 'linux' in spec:
skipped.add('test_not_linux_arch_x86_0')
else:
if 'x86' in spec:
passed.add('test_not_linux_arch_x86_0')
else:
skipped.add('test_not_linux_arch_x86_0')

if 'x86' in spec:
passed.add('test_arch_x86_0')
skipped.add('test_arch_nonx86_0')
else:
passed.add('test_arch_nonx86_0')
skipped.add('test_arch_x86_0')

if '64' in spec:
passed.add('test_bits_64_0')
else:
skipped.add('test_bits_64_0')

if 'osx' in spec:
passed.add('test_os_osx_0')
else:
skipped.add('test_os_osx_0')

if 'osx_x86-64' in spec:
passed.add('test_osx_x86-64_0')
else:
skipped.add('test_osx_x86-64_0')

if 'x86' in spec or '390' in spec:
passed.add('test_arch_x86_390_0')
else:
skipped.add('test_arch_x86_390_0')

if 'osx_x86-64' in spec or ('win_x86' in spec and 'win_x86-64' not in spec) or 'aix_ppc-64' in spec:
passed.add('test_osx_x86-64_win_x86_aix_ppc-64_0')
else:
skipped.add('test_osx_x86-64_win_x86_aix_ppc-64_0')

os_label = re.search(r"set OS_LABEL to (.*)", stdout)
print("os_label in : {}".format(os_label))
if os_label is not None:
os_label = os_label.group(1)
label_str = os_label.split(".")
# os_label example: ubuntu.22
try:
ver = int(label_str[1],10)
if label_str[0] == "ubuntu":
if ver >= 22:
passed.add('test_os_linux_ubuntu22_0')
if ver >= 20:
passed.add('test_os_linux_ubuntu20plus_0')
passed.add('test_os_linux_ubuntu20plus_rhel8plus_0')
if ver < 20:
passed.add('test_not_os_linux_ubuntu20plus_0')

if label_str[0] == "rhel":
if ver >= 8:
passed.add('test_os_linux_ubuntu20plus_rhel8plus_0')
except ValueError as ve:
print ("warning: os version value failed to convert to an integer")
passed.add('test_not_os_linux_ubuntu20plus_0')
else:
passed.add('test_not_os_linux_ubuntu20plus_0')

if 'test_os_linux_ubuntu20plus_0' not in passed:
skipped.add('test_os_linux_ubuntu20plus_0')

if 'test_os_linux_ubuntu22_0' not in passed:
skipped.add('test_os_linux_ubuntu22_0')

if 'test_os_linux_ubuntu20plus_rhel8plus_0' not in passed:
skipped.add('test_os_linux_ubuntu20plus_rhel8plus_0')

if 'test_not_os_linux_ubuntu20plus_0' not in passed:
skipped.add('test_not_os_linux_ubuntu20plus_0')

micro_arch = re.search(r"set MICROARCH to (.*)", stdout)
# micro_arch = "set MICROARCH to z14"
print("micro_arch in platform req: {}".format(micro_arch))
pattern = r"set MICROARCH to (.*)"
# micro_arch = re.search(pattern, micro_arch)
if micro_arch is not None:
print(micro_arch)
micro_arch = micro_arch.group(1)
label_str = micro_arch
print("Label_str:",label_str)
# micro_arch example: skylake
try:
ver = int(''.join(filter(str.isdigit, micro_arch.split()[-1])))
print("ver:",ver)
if label_str == "skylake":
passed.add('test_arch_x86_skylake_0')
if ver == 13:
passed.add('test_arch_390_z13_0')
elif ver > 13:
passed.add('test_arch_390_z13plus_0')
if ver == 14:
passed.add('test_arch_390_z14_0')
elif ver > 14:
passed.add('test_arch_390_z14plus_0')
if ver == 15:
passed.add('test_arch_390_z15_0')
elif ver > 15:
passed.add('test_arch_390_z15plus_0')
else:
skipped.add('test_not_arch_390_0')
except ValueError as ve:
print("warning: microarch version value failed to convert to an integer")
skipped.add('test_not_arch_390_0')
else:
passed.add('test_not_arch_390_0')

if 'test_arch_390_z15_0' not in passed:
skipped.add('test_arch_390_z15_0')

if 'test_arch_390_z14_0' not in passed:
skipped.add('test_arch_390_z14_0')

if 'test_arch_390_z13_0' not in passed:
skipped.add('test_arch_390_z13_0')

if 'test_arch_390_z15plus_0' not in passed:
skipped.add('test_arch_390_z15plus_0')

if 'test_arch_390_z14plus_0' not in passed:
skipped.add('test_arch_390_z14plus_0')

if 'test_arch_390_z13plus_0' not in passed:
skipped.add('test_arch_390_z13plus_0')

if 'test_arch_x86_skylake_0' not in passed:
skipped.add('test_arch_x86_skylake_0')


rt &= checkResult(result, passed, set(), set(), skipped)
return rt

if __name__ == "__main__":
run_test()
run_test()
Loading

0 comments on commit 8e4a2d4

Please sign in to comment.