]>
Commit | Line | Data |
---|---|---|
38e2e9ce | 1 | #!/usr/bin/env @PYTHON_SHEBANG@ |
e4a3297a BB |
2 | |
3 | # | |
4 | # This file and its contents are supplied under the terms of the | |
5 | # Common Development and Distribution License ("CDDL"), version 1.0. | |
6 | # You may only use this file in accordance with the terms of version | |
7 | # 1.0 of the CDDL. | |
8 | # | |
9 | # A full copy of the text of the CDDL should have accompanied this | |
10 | # source. A copy of the CDDL is also available via the Internet at | |
11 | # http://www.illumos.org/license/CDDL. | |
12 | # | |
13 | ||
14 | # | |
15 | # Copyright (c) 2017 by Delphix. All rights reserved. | |
16 | # Copyright (c) 2018 by Lawrence Livermore National Security, LLC. | |
17 | # | |
6e72a5b9 BB |
18 | # This script must remain compatible with Python 2.6+ and Python 3.4+. |
19 | # | |
e4a3297a BB |
20 | |
21 | import os | |
22 | import re | |
23 | import sys | |
24 | ||
25 | # | |
26 | # This script parses the stdout of zfstest, which has this format: | |
27 | # | |
28 | # Test: /path/to/testa (run as root) [00:00] [PASS] | |
29 | # Test: /path/to/testb (run as jkennedy) [00:00] [PASS] | |
30 | # Test: /path/to/testc (run as root) [00:00] [FAIL] | |
31 | # [...many more results...] | |
32 | # | |
33 | # Results Summary | |
34 | # FAIL 22 | |
35 | # SKIP 32 | |
36 | # PASS 1156 | |
37 | # | |
38 | # Running Time: 02:50:31 | |
39 | # Percent passed: 95.5% | |
40 | # Log directory: /var/tmp/test_results/20180615T205926 | |
41 | # | |
42 | ||
43 | # | |
44 | # Common generic reasons for a test or test group to be skipped. | |
45 | # | |
46 | # Some test cases are known to fail in ways which are not harmful or dangerous. | |
47 | # In these cases simply mark the test as a known failure until it can be | |
48 | # updated and the issue resolved. Note that it's preferable to open a unique | |
49 | # issue on the GitHub issue tracker for each test case failure. | |
50 | # | |
51 | known_reason = 'Known issue' | |
52 | ||
53 | # | |
54 | # Some tests require that a test user be able to execute the zfs utilities. | |
55 | # This may not be possible when testing in-tree due to the default permissions | |
56 | # on the user's home directory. When testing this can be resolved by granting | |
57 | # group read access. | |
58 | # | |
59 | # chmod 0750 $HOME | |
60 | # | |
61 | exec_reason = 'Test user execute permissions required for utilities' | |
62 | ||
e4a3297a BB |
63 | # |
64 | # Some tests require a minimum python version of 3.5 and will be skipped when | |
65 | # the default system version is too old. There may also be tests which require | |
66 | # additional python modules be installed, for example python-cffi is required | |
67 | # by the pyzfs tests. | |
68 | # | |
69 | python_reason = 'Python v3.5 or newer required' | |
70 | python_deps_reason = 'Python modules missing: python-cffi' | |
71 | ||
72 | # | |
73 | # Some tests require the O_TMPFILE flag which was first introduced in the | |
74 | # 3.11 kernel. | |
75 | # | |
76 | tmpfile_reason = 'Kernel O_TMPFILE support required' | |
77 | ||
78 | # | |
79 | # Some tests require that the NFS client and server utilities be installed. | |
80 | # | |
81 | share_reason = 'NFS client and server utilities required' | |
82 | ||
83 | # | |
84 | # Some tests require that the lsattr utility support the project id feature. | |
85 | # | |
86 | project_id_reason = 'lsattr with set/show project ID required' | |
87 | ||
88 | # | |
89 | # Some tests require that the kernel support user namespaces. | |
90 | # | |
91 | user_ns_reason = 'Kernel user namespace support required' | |
92 | ||
93 | # | |
94 | # Some rewind tests can fail since nothing guarantees that old MOS blocks | |
95 | # are not overwritten. Snapshots protect datasets and data files but not | |
96 | # the MOS. Reasonable efforts are made in the test case to increase the | |
97 | # odds that some txgs will have their MOS data left untouched, but it is | |
98 | # never a sure thing. | |
99 | # | |
100 | rewind_reason = 'Arbitrary pool rewind is not guaranteed' | |
101 | ||
e03a41a6 BB |
102 | # |
103 | # Some tests may by structured in a way that relies on exact knowledge | |
104 | # of how much free space in available in a pool. These tests cannot be | |
105 | # made completely reliable because the internal details of how free space | |
106 | # is managed are not exposed to user space. | |
107 | # | |
108 | enospc_reason = 'Exact free space reporting is not guaranteed' | |
109 | ||
a584ef26 BB |
110 | # |
111 | # Some tests require a minimum version of the fio benchmark utility. | |
112 | # Older distributions such as CentOS 6.x only provide fio-2.0.13. | |
113 | # | |
114 | fio_reason = 'Fio v2.3 or newer required' | |
115 | ||
1b939560 BB |
116 | # |
117 | # Some tests require that the DISKS provided support the discard operation. | |
118 | # Normally this is not an issue because loop back devices are used for DISKS | |
119 | # and they support discard (TRIM/UNMAP). | |
120 | # | |
121 | trim_reason = 'DISKS must support discard (TRIM/UNMAP)' | |
122 | ||
e4a3297a | 123 | # |
4b06d052 BB |
124 | # Some tests are not applicable to a platform or need to be updated to operate |
125 | # in the manor required by the platform. Any tests which are skipped for this | |
e4a3297a BB |
126 | # reason will be suppressed in the final analysis output. |
127 | # | |
4b06d052 | 128 | na_reason = "Not applicable" |
e4a3297a BB |
129 | |
130 | summary = { | |
131 | 'total': float(0), | |
132 | 'passed': float(0), | |
133 | 'logfile': "Could not determine logfile location." | |
134 | } | |
135 | ||
136 | # | |
137 | # These tests are known to fail, thus we use this list to prevent these | |
138 | # failures from failing the job as a whole; only unexpected failures | |
139 | # bubble up to cause this script to exit with a non-zero exit status. | |
140 | # | |
141 | # Format: { 'test-name': ['expected result', 'issue-number | reason'] } | |
142 | # | |
143 | # For each known failure it is recommended to link to a GitHub issue by | |
144 | # setting the reason to the issue number. Alternately, one of the generic | |
145 | # reasons listed above can be used. | |
146 | # | |
147 | known = { | |
e4a3297a | 148 | 'casenorm/mixed_none_lookup_ci': ['FAIL', '7633'], |
e4a3297a | 149 | 'casenorm/mixed_formd_lookup_ci': ['FAIL', '7633'], |
e4a3297a BB |
150 | 'cli_root/zfs_unshare/zfs_unshare_002_pos': ['SKIP', na_reason], |
151 | 'cli_root/zfs_unshare/zfs_unshare_006_pos': ['SKIP', na_reason], | |
e4a3297a BB |
152 | 'cli_user/misc/zfs_share_001_neg': ['SKIP', na_reason], |
153 | 'cli_user/misc/zfs_unshare_001_neg': ['SKIP', na_reason], | |
e4a3297a BB |
154 | 'privilege/setup': ['SKIP', na_reason], |
155 | 'refreserv/refreserv_004_pos': ['FAIL', known_reason], | |
e4a3297a BB |
156 | 'rootpool/setup': ['SKIP', na_reason], |
157 | 'rsend/rsend_008_pos': ['SKIP', '6066'], | |
158 | 'vdev_zaps/vdev_zaps_007_pos': ['FAIL', known_reason], | |
e4a3297a BB |
159 | } |
160 | ||
4b06d052 BB |
161 | if sys.platform.startswith('freebsd'): |
162 | known.update({ | |
788398c5 RM |
163 | 'cli_root/zpool_wait/zpool_wait_trim_basic': ['SKIP', trim_reason], |
164 | 'cli_root/zpool_wait/zpool_wait_trim_cancel': ['SKIP', trim_reason], | |
165 | 'cli_root/zpool_wait/zpool_wait_trim_flag': ['SKIP', trim_reason], | |
4b06d052 | 166 | 'link_count/link_count_001': ['SKIP', na_reason], |
4b06d052 | 167 | }) |
d3fe62cb RM |
168 | elif sys.platform.startswith('linux'): |
169 | known.update({ | |
170 | 'casenorm/mixed_formd_lookup': ['FAIL', '7633'], | |
171 | 'casenorm/mixed_formd_delete': ['FAIL', '7633'], | |
172 | 'casenorm/sensitive_formd_lookup': ['FAIL', '7633'], | |
173 | 'casenorm/sensitive_formd_delete': ['FAIL', '7633'], | |
d3fe62cb RM |
174 | 'removal/removal_with_zdb': ['SKIP', known_reason], |
175 | }) | |
176 | ||
4b06d052 | 177 | |
e4a3297a BB |
178 | # |
179 | # These tests may occasionally fail or be skipped. We want there failures | |
180 | # to be reported but only unexpected failures should bubble up to cause | |
181 | # this script to exit with a non-zero exit status. | |
182 | # | |
183 | # Format: { 'test-name': ['expected result', 'issue-number | reason'] } | |
184 | # | |
185 | # For each known failure it is recommended to link to a GitHub issue by | |
186 | # setting the reason to the issue number. Alternately, one of the generic | |
187 | # reasons listed above can be used. | |
188 | # | |
189 | maybe = { | |
cdbc34fc RM |
190 | 'alloc_class/alloc_class_012_pos': ['FAIL', '9142'], |
191 | 'alloc_class/alloc_class_013_pos': ['FAIL', '9142'], | |
e4a3297a | 192 | 'chattr/setup': ['SKIP', exec_reason], |
e4a3297a BB |
193 | 'cli_root/zdb/zdb_006_pos': ['FAIL', known_reason], |
194 | 'cli_root/zfs_get/zfs_get_004_pos': ['FAIL', known_reason], | |
195 | 'cli_root/zfs_get/zfs_get_009_pos': ['SKIP', '5479'], | |
e4a3297a BB |
196 | 'cli_root/zfs_share/setup': ['SKIP', share_reason], |
197 | 'cli_root/zfs_snapshot/zfs_snapshot_002_neg': ['FAIL', known_reason], | |
198 | 'cli_root/zfs_unshare/setup': ['SKIP', share_reason], | |
e4a3297a | 199 | 'cli_root/zpool_add/zpool_add_004_pos': ['FAIL', known_reason], |
e4a3297a | 200 | 'cli_root/zpool_destroy/zpool_destroy_001_pos': ['SKIP', '6145'], |
e4a3297a BB |
201 | 'cli_root/zpool_import/import_rewind_device_replaced': |
202 | ['FAIL', rewind_reason], | |
203 | 'cli_root/zpool_import/import_rewind_config_changed': | |
204 | ['FAIL', rewind_reason], | |
205 | 'cli_root/zpool_import/zpool_import_missing_003_pos': ['SKIP', '6839'], | |
1b939560 | 206 | 'cli_root/zpool_trim/setup': ['SKIP', trim_reason], |
e4a3297a | 207 | 'cli_root/zpool_upgrade/zpool_upgrade_004_pos': ['FAIL', '6141'], |
e4a3297a | 208 | 'delegate/setup': ['SKIP', exec_reason], |
e4a3297a BB |
209 | 'history/history_004_pos': ['FAIL', '7026'], |
210 | 'history/history_005_neg': ['FAIL', '6680'], | |
211 | 'history/history_006_neg': ['FAIL', '5657'], | |
212 | 'history/history_008_pos': ['FAIL', known_reason], | |
213 | 'history/history_010_pos': ['SKIP', exec_reason], | |
a584ef26 | 214 | 'io/mmap': ['SKIP', fio_reason], |
e4a3297a | 215 | 'largest_pool/largest_pool_001_pos': ['FAIL', known_reason], |
f1b81537 | 216 | 'mmp/mmp_on_uberblocks': ['FAIL', known_reason], |
e4a3297a | 217 | 'pyzfs/pyzfs_unittest': ['SKIP', python_deps_reason], |
e03a41a6 | 218 | 'no_space/enospc_002_pos': ['FAIL', enospc_reason], |
e4a3297a | 219 | 'projectquota/setup': ['SKIP', exec_reason], |
94b197a0 | 220 | 'redundancy/redundancy_004_neg': ['FAIL', '7290'], |
b2255edc | 221 | 'redundancy/redundancy_draid_spare3': ['SKIP', known_reason], |
e106a7ba | 222 | 'reservation/reservation_008_pos': ['FAIL', '7741'], |
e4a3297a BB |
223 | 'reservation/reservation_018_pos': ['FAIL', '5642'], |
224 | 'rsend/rsend_019_pos': ['FAIL', '6086'], | |
225 | 'rsend/rsend_020_pos': ['FAIL', '6446'], | |
226 | 'rsend/rsend_021_pos': ['FAIL', '6446'], | |
227 | 'rsend/rsend_024_pos': ['FAIL', '5665'], | |
228 | 'rsend/send-c_volume': ['FAIL', '6087'], | |
f1b81537 | 229 | 'rsend/send_partial_dataset': ['FAIL', known_reason], |
e4a3297a | 230 | 'snapshot/clone_001_pos': ['FAIL', known_reason], |
838bd5ff BB |
231 | 'snapshot/snapshot_009_pos': ['FAIL', '7961'], |
232 | 'snapshot/snapshot_010_pos': ['FAIL', '7961'], | |
e4a3297a BB |
233 | 'snapused/snapused_004_pos': ['FAIL', '5513'], |
234 | 'tmpfile/setup': ['SKIP', tmpfile_reason], | |
235 | 'threadsappend/threadsappend_001_pos': ['FAIL', '6136'], | |
1b939560 | 236 | 'trim/setup': ['SKIP', trim_reason], |
e4a3297a BB |
237 | 'upgrade/upgrade_projectquota_001_pos': ['SKIP', project_id_reason], |
238 | 'user_namespace/setup': ['SKIP', user_ns_reason], | |
239 | 'userquota/setup': ['SKIP', exec_reason], | |
240 | 'vdev_zaps/vdev_zaps_004_pos': ['FAIL', '6935'], | |
e4a3297a | 241 | 'zvol/zvol_ENOSPC/zvol_ENOSPC_001_pos': ['FAIL', '5848'], |
221e6704 | 242 | 'pam/setup': ['SKIP', "pamtester might be not available"], |
e4a3297a BB |
243 | } |
244 | ||
d3fe62cb RM |
245 | if sys.platform.startswith('freebsd'): |
246 | maybe.update({ | |
247 | 'cli_root/zfs_copies/zfs_copies_002_pos': ['FAIL', known_reason], | |
9f0a21e6 | 248 | 'cli_root/zfs_inherit/zfs_inherit_001_neg': ['FAIL', known_reason], |
c15d36c6 GW |
249 | 'cli_root/zfs_share/zfs_share_011_pos': ['FAIL', known_reason], |
250 | 'cli_root/zfs_share/zfs_share_concurrent_shares': | |
251 | ['FAIL', known_reason], | |
f1b81537 | 252 | 'cli_root/zpool_import/zpool_import_012_pos': ['FAIL', known_reason], |
d3fe62cb | 253 | 'delegate/zfs_allow_003_pos': ['FAIL', known_reason], |
9f0a21e6 MM |
254 | 'removal/removal_condense_export': ['FAIL', known_reason], |
255 | 'removal/removal_with_export': ['FAIL', known_reason], | |
d3fe62cb | 256 | 'resilver/resilver_restart_001': ['FAIL', known_reason], |
18c62430 | 257 | 'zvol/zvol_misc/zvol_misc_volmode': ['FAIL', known_reason], |
d3fe62cb | 258 | }) |
745ace3f BB |
259 | elif sys.platform.startswith('linux'): |
260 | maybe.update({ | |
261 | 'alloc_class/alloc_class_009_pos': ['FAIL', known_reason], | |
262 | 'alloc_class/alloc_class_010_pos': ['FAIL', known_reason], | |
f1b81537 | 263 | 'alloc_class/alloc_class_011_neg': ['FAIL', known_reason], |
745ace3f BB |
264 | 'cli_root/zfs_rename/zfs_rename_002_pos': ['FAIL', known_reason], |
265 | 'cli_root/zpool_expand/zpool_expand_001_pos': ['FAIL', known_reason], | |
266 | 'cli_root/zpool_expand/zpool_expand_005_pos': ['FAIL', known_reason], | |
267 | 'cli_root/zpool_reopen/zpool_reopen_003_pos': ['FAIL', known_reason], | |
e862b7ec BB |
268 | 'limits/filesystem_limit': ['SKIP', known_reason], |
269 | 'limits/snapshot_limit': ['SKIP', known_reason], | |
d60c0dbd BB |
270 | 'mmp/mmp_exported_import': ['FAIL', known_reason], |
271 | 'mmp/mmp_inactive_import': ['FAIL', known_reason], | |
745ace3f BB |
272 | 'refreserv/refreserv_raidz': ['FAIL', known_reason], |
273 | 'rsend/rsend_007_pos': ['FAIL', known_reason], | |
274 | 'rsend/rsend_010_pos': ['FAIL', known_reason], | |
275 | 'rsend/rsend_011_pos': ['FAIL', known_reason], | |
276 | 'snapshot/rollback_003_pos': ['FAIL', known_reason], | |
277 | }) | |
d3fe62cb | 278 | |
e4a3297a BB |
279 | |
280 | def usage(s): | |
3ed2fbcc | 281 | print(s) |
e4a3297a BB |
282 | sys.exit(1) |
283 | ||
284 | ||
285 | def process_results(pathname): | |
286 | try: | |
287 | f = open(pathname) | |
3ed2fbcc GK |
288 | except IOError as e: |
289 | print('Error opening file: %s' % e) | |
e4a3297a BB |
290 | sys.exit(1) |
291 | ||
292 | prefix = '/zfs-tests/tests/functional/' | |
b74f48fe | 293 | pattern = \ |
54aefa6a RM |
294 | r'^Test(?:\s+\(\S+\))?:' + \ |
295 | r'\s*\S*%s(\S+)\s*\(run as (\S+)\)\s*\[(\S+)\]\s*\[(\S+)\]' \ | |
e4a3297a | 296 | % prefix |
b74f48fe | 297 | pattern_log = r'^\s*Log directory:\s*(\S*)' |
e4a3297a BB |
298 | |
299 | d = {} | |
c87f9586 BB |
300 | for line in f.readlines(): |
301 | m = re.match(pattern, line) | |
e4a3297a BB |
302 | if m and len(m.groups()) == 4: |
303 | summary['total'] += 1 | |
304 | if m.group(4) == "PASS": | |
305 | summary['passed'] += 1 | |
306 | d[m.group(1)] = m.group(4) | |
307 | continue | |
308 | ||
c87f9586 | 309 | m = re.match(pattern_log, line) |
e4a3297a BB |
310 | if m: |
311 | summary['logfile'] = m.group(1) | |
312 | ||
313 | return d | |
314 | ||
315 | ||
316 | if __name__ == "__main__": | |
cca14128 | 317 | if len(sys.argv) != 2: |
e4a3297a BB |
318 | usage('usage: %s <pathname>' % sys.argv[0]) |
319 | results = process_results(sys.argv[1]) | |
320 | ||
321 | if summary['total'] == 0: | |
3ed2fbcc GK |
322 | print("\n\nNo test results were found.") |
323 | print("Log directory: %s" % summary['logfile']) | |
e4a3297a BB |
324 | sys.exit(0) |
325 | ||
326 | expected = [] | |
327 | unexpected = [] | |
328 | ||
3ed2fbcc | 329 | for test in list(results.keys()): |
e4a3297a BB |
330 | if results[test] == "PASS": |
331 | continue | |
332 | ||
333 | setup = test.replace(os.path.basename(test), "setup") | |
334 | if results[test] == "SKIP" and test != setup: | |
335 | if setup in known and known[setup][0] == "SKIP": | |
336 | continue | |
337 | if setup in maybe and maybe[setup][0] == "SKIP": | |
338 | continue | |
339 | ||
340 | if ((test not in known or results[test] not in known[test][0]) and | |
341 | (test not in maybe or results[test] not in maybe[test][0])): | |
342 | unexpected.append(test) | |
343 | else: | |
344 | expected.append(test) | |
345 | ||
3ed2fbcc | 346 | print("\nTests with results other than PASS that are expected:") |
e4a3297a | 347 | for test in sorted(expected): |
1289fbb5 | 348 | issue_url = 'https://github.com/openzfs/zfs/issues/' |
e4a3297a BB |
349 | |
350 | # Include the reason why the result is expected, given the following: | |
4b06d052 | 351 | # 1. Suppress test results which set the "Not applicable" reason. |
e4a3297a BB |
352 | # 2. Numerical reasons are assumed to be GitHub issue numbers. |
353 | # 3. When an entire test group is skipped only report the setup reason. | |
354 | if test in known: | |
355 | if known[test][1] == na_reason: | |
356 | continue | |
357 | elif known[test][1].isdigit(): | |
358 | expect = issue_url + known[test][1] | |
359 | else: | |
360 | expect = known[test][1] | |
361 | elif test in maybe: | |
362 | if maybe[test][1].isdigit(): | |
363 | expect = issue_url + maybe[test][1] | |
364 | else: | |
365 | expect = maybe[test][1] | |
366 | elif setup in known and known[setup][0] == "SKIP" and setup != test: | |
367 | continue | |
368 | elif setup in maybe and maybe[setup][0] == "SKIP" and setup != test: | |
369 | continue | |
370 | else: | |
371 | expect = "UNKNOWN REASON" | |
3ed2fbcc | 372 | print(" %s %s (%s)" % (results[test], test, expect)) |
e4a3297a | 373 | |
3ed2fbcc | 374 | print("\nTests with result of PASS that are unexpected:") |
e4a3297a BB |
375 | for test in sorted(known.keys()): |
376 | # We probably should not be silently ignoring the case | |
377 | # where "test" is not in "results". | |
378 | if test not in results or results[test] != "PASS": | |
379 | continue | |
3ed2fbcc GK |
380 | print(" %s %s (expected %s)" % (results[test], test, |
381 | known[test][0])) | |
e4a3297a | 382 | |
3ed2fbcc | 383 | print("\nTests with results other than PASS that are unexpected:") |
e4a3297a BB |
384 | for test in sorted(unexpected): |
385 | expect = "PASS" if test not in known else known[test][0] | |
3ed2fbcc | 386 | print(" %s %s (expected %s)" % (results[test], test, expect)) |
e4a3297a BB |
387 | |
388 | if len(unexpected) == 0: | |
389 | sys.exit(0) | |
390 | else: | |
391 | sys.exit(1) |