16
16
from utils import *
17
17
18
18
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
118
177
119
178
if __name__ == "__main__" :
120
- run_test ()
179
+ run_test ()
0 commit comments