Skip to content

Commit 14de8ce

Browse files
committed
Added code to detect micro architecture
- zlinux version detection - add tests Signed-off-by: Anna Babu Palathingal <[email protected]>
1 parent 2326826 commit 14de8ce

File tree

5 files changed

+295
-136
lines changed

5 files changed

+295
-136
lines changed

examples/platformRequirements/playlist.xml

+69-1
Original file line numberDiff line numberDiff line change
@@ -107,5 +107,73 @@
107107
$(TEST_STATUS)</command>
108108
<platformRequirements>^os.linux.ubuntu.20+</platformRequirements>
109109
</test>
110+
<test>
111+
<testCaseName>test_not_arch_390</testCaseName>
112+
<command>echo "test on none arch.390"; \
113+
$(TEST_STATUS)</command>
114+
<platformRequirements>^arch.390</platformRequirements>
115+
</test>
116+
117+
<test>
118+
<testCaseName>test_arch_x86_skylake</testCaseName>
119+
<command>echo "test arch.x86.skylake"; \
120+
$(TEST_STATUS)</command>
121+
<platformRequirementsList>
122+
<platformRequirements>arch.x86.skylake</platformRequirements>
123+
</platformRequirementsList>
124+
</test>
125+
126+
<test>
127+
<testCaseName>test_arch_390_z15plus</testCaseName>
128+
<command>echo "test arch.390.z15+"; \
129+
$(TEST_STATUS)</command>
130+
<platformRequirementsList>
131+
<platformRequirements>arch.390.z15+</platformRequirements>
132+
</platformRequirementsList>
133+
</test>
134+
135+
<test>
136+
<testCaseName>test_arch_390_z15</testCaseName>
137+
<command>echo "test arch.390.z15"; \
138+
$(TEST_STATUS)</command>
139+
<platformRequirementsList>
140+
<platformRequirements>arch.390.z15</platformRequirements>
141+
</platformRequirementsList>
142+
</test>
143+
<test>
144+
<testCaseName>test_arch_390_z14plus</testCaseName>
145+
<command>echo "test arch.390.z14+"; \
146+
$(TEST_STATUS)</command>
147+
<platformRequirementsList>
148+
<platformRequirements>arch.390.z14+</platformRequirements>
149+
</platformRequirementsList>
150+
</test>
151+
152+
<test>
153+
<testCaseName>test_arch_390_z14</testCaseName>
154+
<command>echo "test arch.390.z14"; \
155+
$(TEST_STATUS)</command>
156+
<platformRequirementsList>
157+
<platformRequirements>arch.390.z14</platformRequirements>
158+
</platformRequirementsList>
159+
</test>
160+
161+
<test>
162+
<testCaseName>test_arch_390_z13plus</testCaseName>
163+
<command>echo "test arch.390.z13+"; \
164+
$(TEST_STATUS)</command>
165+
<platformRequirementsList>
166+
<platformRequirements>arch.390.z13+</platformRequirements>
167+
</platformRequirementsList>
168+
</test>
169+
170+
<test>
171+
<testCaseName>test_arch_390_z13</testCaseName>
172+
<command>echo "test arch.390.z13"; \
173+
$(TEST_STATUS)</command>
174+
<platformRequirementsList>
175+
<platformRequirements>arch.390.z13</platformRequirements>
176+
</platformRequirementsList>
177+
</test>
110178

111-
</playlist>
179+
</playlist>

makeGen.mk

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ autoconfig:
4242
perl scripts$(D)configure.pl
4343

4444
autogen: autoconfig
45-
${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)
45+
${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)
4646

4747
AUTOGEN_FILES = $(wildcard $(CURRENT_DIR)$(D)jvmTest.mk)
4848
AUTOGEN_FILES += $(wildcard $(CURRENT_DIR)$(D)machineConfigure.mk)

scripts/testTKG/test_platformRequirements.py

+159-100
Original file line numberDiff line numberDiff line change
@@ -16,105 +16,164 @@
1616
from utils import *
1717

1818
def run_test():
19-
rt = True
20-
printTestheader("platformRequirements")
21-
22-
buildList = "TKG/examples/platformRequirements"
23-
command = "make _all"
24-
print(f"\t{command}")
25-
result = subprocess.run(f"{EXPORT_BUILDLIST}={buildList}; {CD_TKG}; {MAKE_CLEAN}; {MAKE_COMPILE}; {command}", stderr=subprocess.PIPE, stdout=subprocess.PIPE, shell=True, check=False)
26-
27-
stdout = result.stdout.decode()
28-
specStr = re.search(r"set SPEC to (.*)", stdout)
29-
30-
if specStr is not None:
31-
spec = specStr.group(1)
32-
else:
33-
printError("Could not parse spec from output.")
34-
return False
35-
36-
passed = set()
37-
skipped = set()
38-
39-
if 'linux' in spec:
40-
skipped.add('test_not_linux_arch_x86_0')
41-
else:
42-
if 'x86' in spec:
43-
passed.add('test_not_linux_arch_x86_0')
44-
else:
45-
skipped.add('test_not_linux_arch_x86_0')
46-
47-
if 'x86' in spec:
48-
passed.add('test_arch_x86_0')
49-
skipped.add('test_arch_nonx86_0')
50-
else:
51-
passed.add('test_arch_nonx86_0')
52-
skipped.add('test_arch_x86_0')
53-
54-
if '64' in spec:
55-
passed.add('test_bits_64_0')
56-
else:
57-
skipped.add('test_bits_64_0')
58-
59-
if 'osx' in spec:
60-
passed.add('test_os_osx_0')
61-
else:
62-
skipped.add('test_os_osx_0')
63-
64-
if 'osx_x86-64' in spec:
65-
passed.add('test_osx_x86-64_0')
66-
else:
67-
skipped.add('test_osx_x86-64_0')
68-
69-
if 'x86' in spec or '390' in spec:
70-
passed.add('test_arch_x86_390_0')
71-
else:
72-
skipped.add('test_arch_x86_390_0')
73-
74-
if 'osx_x86-64' in spec or ('win_x86' in spec and 'win_x86-64' not in spec) or 'aix_ppc-64' in spec:
75-
passed.add('test_osx_x86-64_win_x86_aix_ppc-64_0')
76-
else:
77-
skipped.add('test_osx_x86-64_win_x86_aix_ppc-64_0')
78-
79-
os_label = re.search(r"set OS_LABEL to (.*)", stdout)
80-
if os_label is not None:
81-
os_label = os_label.group(1)
82-
label_str = os_label.split(".")
83-
# os_label example: ubuntu.22
84-
try:
85-
ver = int(label_str[1],10)
86-
if label_str[0] == "ubuntu":
87-
if ver >= 22:
88-
passed.add('test_os_linux_ubuntu22_0')
89-
if ver >= 20:
90-
passed.add('test_os_linux_ubuntu20plus_0')
91-
passed.add('test_os_linux_ubuntu20plus_rhel8plus_0')
92-
if ver < 20:
93-
passed.add('test_not_os_linux_ubuntu20plus_0')
94-
95-
if label_str[0] == "rhel":
96-
if ver >= 8:
97-
passed.add('test_os_linux_ubuntu20plus_rhel8plus_0')
98-
except ValueError as ve:
99-
print ("warning: os version value failed to convert to an integer")
100-
passed.add('test_not_os_linux_ubuntu20plus_0')
101-
else:
102-
passed.add('test_not_os_linux_ubuntu20plus_0')
103-
104-
if 'test_os_linux_ubuntu20plus_0' not in passed:
105-
skipped.add('test_os_linux_ubuntu20plus_0')
106-
107-
if 'test_os_linux_ubuntu22_0' not in passed:
108-
skipped.add('test_os_linux_ubuntu22_0')
109-
110-
if 'test_os_linux_ubuntu20plus_rhel8plus_0' not in passed:
111-
skipped.add('test_os_linux_ubuntu20plus_rhel8plus_0')
112-
113-
if 'test_not_os_linux_ubuntu20plus_0' not in passed:
114-
skipped.add('test_not_os_linux_ubuntu20plus_0')
115-
116-
rt &= checkResult(result, passed, set(), set(), skipped)
117-
return rt
19+
rt = True
20+
printTestheader("platformRequirements")
21+
22+
buildList = "TKG/examples/platformRequirements"
23+
command = "make _all"
24+
print(f"\t{command}")
25+
result = subprocess.run(f"{EXPORT_BUILDLIST}={buildList}; {CD_TKG}; {MAKE_CLEAN}; {MAKE_COMPILE}; {command}", stderr=subprocess.PIPE, stdout=subprocess.PIPE, shell=True, check=False)
26+
27+
stdout = result.stdout.decode()
28+
specStr = re.search(r"set SPEC to (.*)", stdout)
29+
30+
if specStr is not None:
31+
spec = specStr.group(1)
32+
else:
33+
printError("Could not parse spec from output.")
34+
return False
35+
36+
passed = set()
37+
skipped = set()
38+
39+
if 'linux' in spec:
40+
skipped.add('test_not_linux_arch_x86_0')
41+
else:
42+
if 'x86' in spec:
43+
passed.add('test_not_linux_arch_x86_0')
44+
else:
45+
skipped.add('test_not_linux_arch_x86_0')
46+
47+
if 'x86' in spec:
48+
passed.add('test_arch_x86_0')
49+
skipped.add('test_arch_nonx86_0')
50+
else:
51+
passed.add('test_arch_nonx86_0')
52+
skipped.add('test_arch_x86_0')
53+
54+
if '64' in spec:
55+
passed.add('test_bits_64_0')
56+
else:
57+
skipped.add('test_bits_64_0')
58+
59+
if 'osx' in spec:
60+
passed.add('test_os_osx_0')
61+
else:
62+
skipped.add('test_os_osx_0')
63+
64+
if 'osx_x86-64' in spec:
65+
passed.add('test_osx_x86-64_0')
66+
else:
67+
skipped.add('test_osx_x86-64_0')
68+
69+
if 'x86' in spec or '390' in spec:
70+
passed.add('test_arch_x86_390_0')
71+
else:
72+
skipped.add('test_arch_x86_390_0')
73+
74+
if 'osx_x86-64' in spec or ('win_x86' in spec and 'win_x86-64' not in spec) or 'aix_ppc-64' in spec:
75+
passed.add('test_osx_x86-64_win_x86_aix_ppc-64_0')
76+
else:
77+
skipped.add('test_osx_x86-64_win_x86_aix_ppc-64_0')
78+
79+
os_label = re.search(r"set OS_LABEL to (.*)", stdout)
80+
print("os_label in : {}".format(os_label))
81+
if os_label is not None:
82+
os_label = os_label.group(1)
83+
label_str = os_label.split(".")
84+
# os_label example: ubuntu.22
85+
try:
86+
ver = int(label_str[1],10)
87+
if label_str[0] == "ubuntu":
88+
if ver >= 22:
89+
passed.add('test_os_linux_ubuntu22_0')
90+
if ver >= 20:
91+
passed.add('test_os_linux_ubuntu20plus_0')
92+
passed.add('test_os_linux_ubuntu20plus_rhel8plus_0')
93+
if ver < 20:
94+
passed.add('test_not_os_linux_ubuntu20plus_0')
95+
96+
if label_str[0] == "rhel":
97+
if ver >= 8:
98+
passed.add('test_os_linux_ubuntu20plus_rhel8plus_0')
99+
except ValueError as ve:
100+
print ("warning: os version value failed to convert to an integer")
101+
passed.add('test_not_os_linux_ubuntu20plus_0')
102+
else:
103+
passed.add('test_not_os_linux_ubuntu20plus_0')
104+
105+
if 'test_os_linux_ubuntu20plus_0' not in passed:
106+
skipped.add('test_os_linux_ubuntu20plus_0')
107+
108+
if 'test_os_linux_ubuntu22_0' not in passed:
109+
skipped.add('test_os_linux_ubuntu22_0')
110+
111+
if 'test_os_linux_ubuntu20plus_rhel8plus_0' not in passed:
112+
skipped.add('test_os_linux_ubuntu20plus_rhel8plus_0')
113+
114+
if 'test_not_os_linux_ubuntu20plus_0' not in passed:
115+
skipped.add('test_not_os_linux_ubuntu20plus_0')
116+
117+
micro_arch = re.search(r"set MICROARCH to (.*)", stdout)
118+
# micro_arch = "set MICROARCH to z14"
119+
print("micro_arch in platform req: {}".format(micro_arch))
120+
pattern = r"set MICROARCH to (.*)"
121+
# micro_arch = re.search(pattern, micro_arch)
122+
if micro_arch is not None:
123+
print(micro_arch)
124+
micro_arch = micro_arch.group(1)
125+
label_str = micro_arch
126+
print("Label_str:",label_str)
127+
# micro_arch example: skylake
128+
try:
129+
ver = int(''.join(filter(str.isdigit, micro_arch.split()[-1])))
130+
print("ver:",ver)
131+
if label_str == "skylake":
132+
passed.add('test_arch_x86_skylake_0')
133+
if ver == 13:
134+
passed.add('test_arch_390_z13_0')
135+
elif ver > 13:
136+
passed.add('test_arch_390_z13plus_0')
137+
if ver == 14:
138+
passed.add('test_arch_390_z14_0')
139+
elif ver > 14:
140+
passed.add('test_arch_390_z14plus_0')
141+
if ver == 15:
142+
passed.add('test_arch_390_z15_0')
143+
elif ver > 15:
144+
passed.add('test_arch_390_z15plus_0')
145+
else:
146+
skipped.add('test_not_arch_390_0')
147+
except ValueError as ve:
148+
print("warning: microarch version value failed to convert to an integer")
149+
skipped.add('test_not_arch_390_0')
150+
else:
151+
passed.add('test_not_arch_390_0')
152+
153+
if 'test_arch_390_z15_0' not in passed:
154+
skipped.add('test_arch_390_z15_0')
155+
156+
if 'test_arch_390_z14_0' not in passed:
157+
skipped.add('test_arch_390_z14_0')
158+
159+
if 'test_arch_390_z13_0' not in passed:
160+
skipped.add('test_arch_390_z13_0')
161+
162+
if 'test_arch_390_z15plus_0' not in passed:
163+
skipped.add('test_arch_390_z15plus_0')
164+
165+
if 'test_arch_390_z14plus_0' not in passed:
166+
skipped.add('test_arch_390_z14plus_0')
167+
168+
if 'test_arch_390_z13plus_0' not in passed:
169+
skipped.add('test_arch_390_z13plus_0')
170+
171+
if 'test_arch_x86_skylake_0' not in passed:
172+
skipped.add('test_arch_x86_skylake_0')
173+
174+
175+
rt &= checkResult(result, passed, set(), set(), skipped)
176+
return rt
118177

119178
if __name__ == "__main__":
120-
run_test()
179+
run_test()

0 commit comments

Comments
 (0)