1 #!/usr/bin/env @PYTHON_SHEBANG@
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
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.
15 # Copyright (c) 2017 by Delphix. All rights reserved.
16 # Copyright (c) 2018 by Lawrence Livermore National Security, LLC.
18 # This script must remain compatible with Python 2.6+ and Python 3.4+.
26 # This script parses the stdout of zfstest, which has this format:
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...]
38 # Running Time: 02:50:31
39 # Percent passed: 95.5%
40 # Log directory: /var/tmp/test_results/20180615T205926
44 # Common generic reasons for a test or test group to be skipped.
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.
51 known_reason = 'Known issue'
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
61 exec_reason = 'Test user execute permissions required for utilities'
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
69 python_reason = 'Python v3.5 or newer required'
70 python_deps_reason = 'Python modules missing: python-cffi'
73 # Some tests require the O_TMPFILE flag which was first introduced in the
76 tmpfile_reason = 'Kernel O_TMPFILE support required'
79 # Some tests require that the NFS client and server utilities be installed.
81 share_reason = 'NFS client and server utilities required'
84 # Some tests require that the lsattr utility support the project id feature.
86 project_id_reason = 'lsattr with set/show project ID required'
89 # Some tests require that the kernel support user namespaces.
91 user_ns_reason = 'Kernel user namespace support required'
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
100 rewind_reason = 'Arbitrary pool rewind is not guaranteed'
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.
108 enospc_reason = 'Exact free space reporting is not guaranteed'
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.
114 fio_reason = 'Fio v2.3 or newer required'
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).
121 trim_reason = 'DISKS must support discard (TRIM/UNMAP)'
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
126 # reason will be suppressed in the final analysis output.
128 na_reason = "Not applicable"
131 # Some test cases doesn't have all requirements to run on Github actions CI.
133 ci_reason = 'CI runner doesn\'t have all requirements'
138 'logfile': "Could not determine logfile location."
142 # These tests are known to fail, thus we use this list to prevent these
143 # failures from failing the job as a whole; only unexpected failures
144 # bubble up to cause this script to exit with a non-zero exit status.
146 # Format: { 'test-name': ['expected result', 'issue-number | reason'] }
148 # For each known failure it is recommended to link to a GitHub issue by
149 # setting the reason to the issue number. Alternately, one of the generic
150 # reasons listed above can be used.
153 'casenorm/mixed_none_lookup_ci': ['FAIL', '7633'],
154 'casenorm/mixed_formd_lookup_ci': ['FAIL', '7633'],
155 'cli_root/zfs_unshare/zfs_unshare_002_pos': ['SKIP', na_reason],
156 'cli_root/zfs_unshare/zfs_unshare_006_pos': ['SKIP', na_reason],
157 'cli_user/misc/zfs_share_001_neg': ['SKIP', na_reason],
158 'cli_user/misc/zfs_unshare_001_neg': ['SKIP', na_reason],
159 'privilege/setup': ['SKIP', na_reason],
160 'refreserv/refreserv_004_pos': ['FAIL', known_reason],
161 'rootpool/setup': ['SKIP', na_reason],
162 'rsend/rsend_008_pos': ['SKIP', '6066'],
163 'vdev_zaps/vdev_zaps_007_pos': ['FAIL', known_reason],
166 if sys.platform.startswith('freebsd'):
168 'cli_root/zpool_wait/zpool_wait_trim_basic': ['SKIP', trim_reason],
169 'cli_root/zpool_wait/zpool_wait_trim_cancel': ['SKIP', trim_reason],
170 'cli_root/zpool_wait/zpool_wait_trim_flag': ['SKIP', trim_reason],
171 'link_count/link_count_001': ['SKIP', na_reason],
173 elif sys.platform.startswith('linux'):
175 'casenorm/mixed_formd_lookup': ['FAIL', '7633'],
176 'casenorm/mixed_formd_delete': ['FAIL', '7633'],
177 'casenorm/sensitive_formd_lookup': ['FAIL', '7633'],
178 'casenorm/sensitive_formd_delete': ['FAIL', '7633'],
179 'removal/removal_with_zdb': ['SKIP', known_reason],
184 # These tests may occasionally fail or be skipped. We want there failures
185 # to be reported but only unexpected failures should bubble up to cause
186 # this script to exit with a non-zero exit status.
188 # Format: { 'test-name': ['expected result', 'issue-number | reason'] }
190 # For each known failure it is recommended to link to a GitHub issue by
191 # setting the reason to the issue number. Alternately, one of the generic
192 # reasons listed above can be used.
195 'chattr/setup': ['SKIP', exec_reason],
196 'cli_root/zdb/zdb_006_pos': ['FAIL', known_reason],
197 'cli_root/zfs_get/zfs_get_004_pos': ['FAIL', known_reason],
198 'cli_root/zfs_get/zfs_get_009_pos': ['SKIP', '5479'],
199 'cli_root/zfs_share/setup': ['SKIP', share_reason],
200 'cli_root/zfs_snapshot/zfs_snapshot_002_neg': ['FAIL', known_reason],
201 'cli_root/zfs_unshare/setup': ['SKIP', share_reason],
202 'cli_root/zpool_add/zpool_add_004_pos': ['FAIL', known_reason],
203 'cli_root/zpool_destroy/zpool_destroy_001_pos': ['SKIP', '6145'],
204 'cli_root/zpool_import/import_rewind_device_replaced':
205 ['FAIL', rewind_reason],
206 'cli_root/zpool_import/import_rewind_config_changed':
207 ['FAIL', rewind_reason],
208 'cli_root/zpool_import/zpool_import_missing_003_pos': ['SKIP', '6839'],
209 'cli_root/zpool_trim/setup': ['SKIP', trim_reason],
210 'cli_root/zpool_upgrade/zpool_upgrade_004_pos': ['FAIL', '6141'],
211 'delegate/setup': ['SKIP', exec_reason],
212 'history/history_004_pos': ['FAIL', '7026'],
213 'history/history_005_neg': ['FAIL', '6680'],
214 'history/history_006_neg': ['FAIL', '5657'],
215 'history/history_008_pos': ['FAIL', known_reason],
216 'history/history_010_pos': ['SKIP', exec_reason],
217 'io/mmap': ['SKIP', fio_reason],
218 'l2arc/persist_l2arc_007_pos': ['FAIL', '11887'],
219 'largest_pool/largest_pool_001_pos': ['FAIL', known_reason],
220 'mmp/mmp_on_uberblocks': ['FAIL', known_reason],
221 'pyzfs/pyzfs_unittest': ['SKIP', python_deps_reason],
222 'no_space/enospc_002_pos': ['FAIL', enospc_reason],
223 'projectquota/setup': ['SKIP', exec_reason],
224 'redundancy/redundancy_004_neg': ['FAIL', '7290'],
225 'redundancy/redundancy_draid_spare3': ['SKIP', known_reason],
226 'reservation/reservation_008_pos': ['FAIL', '7741'],
227 'reservation/reservation_018_pos': ['FAIL', '5642'],
228 'rsend/rsend_019_pos': ['FAIL', '6086'],
229 'rsend/rsend_020_pos': ['FAIL', '6446'],
230 'rsend/rsend_021_pos': ['FAIL', '6446'],
231 'rsend/rsend_024_pos': ['FAIL', '5665'],
232 'rsend/send-c_volume': ['FAIL', '6087'],
233 'rsend/send_partial_dataset': ['FAIL', known_reason],
234 'snapshot/clone_001_pos': ['FAIL', known_reason],
235 'snapshot/snapshot_009_pos': ['FAIL', '7961'],
236 'snapshot/snapshot_010_pos': ['FAIL', '7961'],
237 'snapused/snapused_004_pos': ['FAIL', '5513'],
238 'tmpfile/setup': ['SKIP', tmpfile_reason],
239 'threadsappend/threadsappend_001_pos': ['FAIL', '6136'],
240 'trim/setup': ['SKIP', trim_reason],
241 'upgrade/upgrade_projectquota_001_pos': ['SKIP', project_id_reason],
242 'user_namespace/setup': ['SKIP', user_ns_reason],
243 'userquota/setup': ['SKIP', exec_reason],
244 'vdev_zaps/vdev_zaps_004_pos': ['FAIL', '6935'],
245 'zvol/zvol_ENOSPC/zvol_ENOSPC_001_pos': ['FAIL', '5848'],
246 'pam/setup': ['SKIP', "pamtester might be not available"],
249 if sys.platform.startswith('freebsd'):
251 'cli_root/zfs_copies/zfs_copies_002_pos': ['FAIL', known_reason],
252 'cli_root/zfs_inherit/zfs_inherit_001_neg': ['FAIL', known_reason],
253 'cli_root/zfs_share/zfs_share_011_pos': ['FAIL', known_reason],
254 'cli_root/zfs_share/zfs_share_concurrent_shares':
255 ['FAIL', known_reason],
256 'cli_root/zpool_import/zpool_import_012_pos': ['FAIL', known_reason],
257 'cli_root/zpool_import/zpool_import_features_001_pos':
259 'cli_root/zpool_import/zpool_import_features_002_neg':
261 'cli_root/zpool_import/zpool_import_features_003_pos':
263 'delegate/zfs_allow_003_pos': ['FAIL', known_reason],
264 'inheritance/inherit_001_pos': ['FAIL', '11829'],
265 'pool_checkpoint/checkpoint_zhack_feat': ['FAIL', '11854'],
266 'resilver/resilver_restart_001': ['FAIL', known_reason],
267 'zvol/zvol_misc/zvol_misc_volmode': ['FAIL', known_reason],
269 elif sys.platform.startswith('linux'):
271 'alloc_class/alloc_class_009_pos': ['FAIL', known_reason],
272 'alloc_class/alloc_class_010_pos': ['FAIL', known_reason],
273 'alloc_class/alloc_class_011_neg': ['FAIL', known_reason],
274 'alloc_class/alloc_class_013_pos': ['FAIL', '11888'],
275 'cli_root/zfs_rename/zfs_rename_002_pos': ['FAIL', known_reason],
276 'cli_root/zpool_expand/zpool_expand_001_pos': ['FAIL', known_reason],
277 'cli_root/zpool_expand/zpool_expand_005_pos': ['FAIL', known_reason],
278 'cli_root/zpool_reopen/zpool_reopen_003_pos': ['FAIL', known_reason],
279 'fault/auto_spare_shared': ['FAIL', '11889'],
280 'io/io_uring': ['SKIP', 'io_uring support required'],
281 'limits/filesystem_limit': ['SKIP', known_reason],
282 'limits/snapshot_limit': ['SKIP', known_reason],
283 'mmp/mmp_exported_import': ['FAIL', known_reason],
284 'mmp/mmp_inactive_import': ['FAIL', known_reason],
285 'refreserv/refreserv_raidz': ['FAIL', known_reason],
286 'rsend/rsend_007_pos': ['FAIL', known_reason],
287 'rsend/rsend_010_pos': ['FAIL', known_reason],
288 'rsend/rsend_011_pos': ['FAIL', known_reason],
289 'snapshot/rollback_003_pos': ['FAIL', known_reason],
293 # Not all Github actions runners have scsi_debug module, so we may skip
294 # some tests which use it.
295 if os.environ.get('CI') == 'true':
297 'cli_root/zpool_expand/zpool_expand_001_pos': ['SKIP', ci_reason],
298 'cli_root/zpool_expand/zpool_expand_003_neg': ['SKIP', ci_reason],
299 'cli_root/zpool_expand/zpool_expand_005_pos': ['SKIP', ci_reason],
300 'cli_root/zpool_reopen/setup': ['SKIP', ci_reason],
301 'cli_root/zpool_reopen/zpool_reopen_001_pos': ['SKIP', ci_reason],
302 'cli_root/zpool_reopen/zpool_reopen_002_pos': ['SKIP', ci_reason],
303 'cli_root/zpool_reopen/zpool_reopen_003_pos': ['SKIP', ci_reason],
304 'cli_root/zpool_reopen/zpool_reopen_004_pos': ['SKIP', ci_reason],
305 'cli_root/zpool_reopen/zpool_reopen_005_pos': ['SKIP', ci_reason],
306 'cli_root/zpool_reopen/zpool_reopen_006_neg': ['SKIP', ci_reason],
307 'cli_root/zpool_reopen/zpool_reopen_007_pos': ['SKIP', ci_reason],
308 'cli_root/zpool_split/zpool_split_wholedisk': ['SKIP', ci_reason],
309 'fault/auto_offline_001_pos': ['SKIP', ci_reason],
310 'fault/auto_online_001_pos': ['SKIP', ci_reason],
311 'fault/auto_replace_001_pos': ['SKIP', ci_reason],
312 'fault/auto_spare_ashift': ['SKIP', ci_reason],
313 'fault/auto_spare_shared': ['SKIP', ci_reason],
314 'procfs/pool_state': ['SKIP', ci_reason],
318 'events/events_002_pos': ['FAIL', '11546'],
327 def process_results(pathname):
331 print('Error opening file: %s' % e)
334 prefix = '/zfs-tests/tests/functional/'
336 r'^Test(?:\s+\(\S+\))?:' + \
337 r'\s*\S*%s(\S+)\s*\(run as (\S+)\)\s*\[(\S+)\]\s*\[(\S+)\]' \
339 pattern_log = r'^\s*Log directory:\s*(\S*)'
342 for line in f.readlines():
343 m = re.match(pattern, line)
344 if m and len(m.groups()) == 4:
345 summary['total'] += 1
346 if m.group(4) == "PASS":
347 summary['passed'] += 1
348 d[m.group(1)] = m.group(4)
351 m = re.match(pattern_log, line)
353 summary['logfile'] = m.group(1)
358 if __name__ == "__main__":
359 if len(sys.argv) != 2:
360 usage('usage: %s <pathname>' % sys.argv[0])
361 results = process_results(sys.argv[1])
363 if summary['total'] == 0:
364 print("\n\nNo test results were found.")
365 print("Log directory: %s" % summary['logfile'])
371 for test in list(results.keys()):
372 if results[test] == "PASS":
375 setup = test.replace(os.path.basename(test), "setup")
376 if results[test] == "SKIP" and test != setup:
377 if setup in known and known[setup][0] == "SKIP":
379 if setup in maybe and maybe[setup][0] == "SKIP":
382 if ((test not in known or results[test] not in known[test][0]) and
383 (test not in maybe or results[test] not in maybe[test][0])):
384 unexpected.append(test)
386 expected.append(test)
388 print("\nTests with results other than PASS that are expected:")
389 for test in sorted(expected):
390 issue_url = 'https://github.com/openzfs/zfs/issues/'
392 # Include the reason why the result is expected, given the following:
393 # 1. Suppress test results which set the "Not applicable" reason.
394 # 2. Numerical reasons are assumed to be GitHub issue numbers.
395 # 3. When an entire test group is skipped only report the setup reason.
397 if known[test][1] == na_reason:
399 elif known[test][1].isdigit():
400 expect = issue_url + known[test][1]
402 expect = known[test][1]
404 if maybe[test][1].isdigit():
405 expect = issue_url + maybe[test][1]
407 expect = maybe[test][1]
408 elif setup in known and known[setup][0] == "SKIP" and setup != test:
410 elif setup in maybe and maybe[setup][0] == "SKIP" and setup != test:
413 expect = "UNKNOWN REASON"
414 print(" %s %s (%s)" % (results[test], test, expect))
416 print("\nTests with result of PASS that are unexpected:")
417 for test in sorted(known.keys()):
418 # We probably should not be silently ignoring the case
419 # where "test" is not in "results".
420 if test not in results or results[test] != "PASS":
422 print(" %s %s (expected %s)" % (results[test], test,
425 print("\nTests with results other than PASS that are unexpected:")
426 for test in sorted(unexpected):
427 expect = "PASS" if test not in known else known[test][0]
428 print(" %s %s (expected %s)" % (results[test], test, expect))
430 if len(unexpected) == 0: