]>
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 | # | |
8a7c4efd | 18 | # This script must remain compatible with Python 3.6+. |
6e72a5b9 | 19 | # |
e4a3297a BB |
20 | |
21 | import os | |
22 | import re | |
23 | import sys | |
2320e6eb | 24 | import argparse |
e4a3297a BB |
25 | |
26 | # | |
27 | # This script parses the stdout of zfstest, which has this format: | |
28 | # | |
29 | # Test: /path/to/testa (run as root) [00:00] [PASS] | |
30 | # Test: /path/to/testb (run as jkennedy) [00:00] [PASS] | |
31 | # Test: /path/to/testc (run as root) [00:00] [FAIL] | |
32 | # [...many more results...] | |
33 | # | |
34 | # Results Summary | |
35 | # FAIL 22 | |
36 | # SKIP 32 | |
37 | # PASS 1156 | |
38 | # | |
39 | # Running Time: 02:50:31 | |
40 | # Percent passed: 95.5% | |
41 | # Log directory: /var/tmp/test_results/20180615T205926 | |
42 | # | |
43 | ||
44 | # | |
45 | # Common generic reasons for a test or test group to be skipped. | |
46 | # | |
47 | # Some test cases are known to fail in ways which are not harmful or dangerous. | |
48 | # In these cases simply mark the test as a known failure until it can be | |
49 | # updated and the issue resolved. Note that it's preferable to open a unique | |
50 | # issue on the GitHub issue tracker for each test case failure. | |
51 | # | |
52 | known_reason = 'Known issue' | |
53 | ||
54 | # | |
55 | # Some tests require that a test user be able to execute the zfs utilities. | |
56 | # This may not be possible when testing in-tree due to the default permissions | |
57 | # on the user's home directory. When testing this can be resolved by granting | |
58 | # group read access. | |
59 | # | |
60 | # chmod 0750 $HOME | |
61 | # | |
62 | exec_reason = 'Test user execute permissions required for utilities' | |
63 | ||
dbf6108b AS |
64 | # |
65 | # Some tests require that the kernel supports renameat2 syscall. | |
66 | # | |
67 | renameat2_reason = 'Kernel renameat2 support required' | |
68 | ||
e4a3297a BB |
69 | # |
70 | # Some tests require the O_TMPFILE flag which was first introduced in the | |
71 | # 3.11 kernel. | |
72 | # | |
73 | tmpfile_reason = 'Kernel O_TMPFILE support required' | |
74 | ||
8ae86e2e RM |
75 | # |
76 | # Some tests require the statx(2) system call on Linux which was first | |
77 | # introduced in the 4.11 kernel. | |
78 | # | |
79 | statx_reason = 'Kernel statx(2) system call required on Linux' | |
80 | ||
e4a3297a BB |
81 | # |
82 | # Some tests require that the lsattr utility support the project id feature. | |
83 | # | |
84 | project_id_reason = 'lsattr with set/show project ID required' | |
85 | ||
86 | # | |
87 | # Some tests require that the kernel support user namespaces. | |
88 | # | |
89 | user_ns_reason = 'Kernel user namespace support required' | |
90 | ||
91 | # | |
92 | # Some rewind tests can fail since nothing guarantees that old MOS blocks | |
93 | # are not overwritten. Snapshots protect datasets and data files but not | |
94 | # the MOS. Reasonable efforts are made in the test case to increase the | |
95 | # odds that some txgs will have their MOS data left untouched, but it is | |
96 | # never a sure thing. | |
97 | # | |
98 | rewind_reason = 'Arbitrary pool rewind is not guaranteed' | |
99 | ||
a584ef26 BB |
100 | # |
101 | # Some tests require a minimum version of the fio benchmark utility. | |
102 | # Older distributions such as CentOS 6.x only provide fio-2.0.13. | |
103 | # | |
104 | fio_reason = 'Fio v2.3 or newer required' | |
105 | ||
1b939560 BB |
106 | # |
107 | # Some tests require that the DISKS provided support the discard operation. | |
108 | # Normally this is not an issue because loop back devices are used for DISKS | |
109 | # and they support discard (TRIM/UNMAP). | |
110 | # | |
111 | trim_reason = 'DISKS must support discard (TRIM/UNMAP)' | |
112 | ||
c3cb57ae KHN |
113 | # |
114 | # Some tests on FreeBSD require the fspacectl(2) system call and the | |
115 | # truncate(1) utility supporting the -d option. The system call was first | |
116 | # introduced in FreeBSD version 1400032. | |
117 | # | |
118 | fspacectl_reason = 'fspacectl(2) and truncate -d support required' | |
119 | ||
e4a3297a | 120 | # |
4b06d052 BB |
121 | # Some tests are not applicable to a platform or need to be updated to operate |
122 | # in the manor required by the platform. Any tests which are skipped for this | |
e4a3297a BB |
123 | # reason will be suppressed in the final analysis output. |
124 | # | |
4b06d052 | 125 | na_reason = "Not applicable" |
e4a3297a | 126 | |
9eee7fce GM |
127 | # |
128 | # Some test cases doesn't have all requirements to run on Github actions CI. | |
129 | # | |
130 | ci_reason = 'CI runner doesn\'t have all requirements' | |
131 | ||
2a068a13 YY |
132 | # |
133 | # Idmapped mount is only supported in kernel version >= 5.12 | |
134 | # | |
135 | idmap_reason = 'Idmapped mount needs kernel 5.12+' | |
e4a3297a | 136 | |
48d0e946 RN |
137 | # |
138 | # copy_file_range() is not supported by all kernels | |
139 | # | |
140 | cfr_reason = 'Kernel copy_file_range support required' | |
141 | cfr_cross_reason = 'copy_file_range(2) cross-filesystem needs kernel 5.3+' | |
142 | ||
e4a3297a BB |
143 | # |
144 | # These tests are known to fail, thus we use this list to prevent these | |
145 | # failures from failing the job as a whole; only unexpected failures | |
146 | # bubble up to cause this script to exit with a non-zero exit status. | |
147 | # | |
148 | # Format: { 'test-name': ['expected result', 'issue-number | reason'] } | |
149 | # | |
150 | # For each known failure it is recommended to link to a GitHub issue by | |
151 | # setting the reason to the issue number. Alternately, one of the generic | |
152 | # reasons listed above can be used. | |
153 | # | |
154 | known = { | |
e78b7a73 AZ |
155 | 'casenorm/mixed_none_lookup_ci': ['FAIL', 7633], |
156 | 'casenorm/mixed_formd_lookup_ci': ['FAIL', 7633], | |
14ba514a BB |
157 | 'cli_root/zpool_import/import_rewind_device_replaced': |
158 | ['FAIL', rewind_reason], | |
e4a3297a BB |
159 | 'cli_user/misc/zfs_share_001_neg': ['SKIP', na_reason], |
160 | 'cli_user/misc/zfs_unshare_001_neg': ['SKIP', na_reason], | |
6db4ed51 | 161 | 'pool_checkpoint/checkpoint_discard_busy': ['SKIP', 12053], |
e4a3297a BB |
162 | 'privilege/setup': ['SKIP', na_reason], |
163 | 'refreserv/refreserv_004_pos': ['FAIL', known_reason], | |
e4a3297a | 164 | 'rootpool/setup': ['SKIP', na_reason], |
e78b7a73 | 165 | 'rsend/rsend_008_pos': ['SKIP', 6066], |
e4a3297a | 166 | 'vdev_zaps/vdev_zaps_007_pos': ['FAIL', known_reason], |
e4a3297a BB |
167 | } |
168 | ||
4b06d052 BB |
169 | if sys.platform.startswith('freebsd'): |
170 | known.update({ | |
19229e5f BB |
171 | 'cli_root/zfs_receive/receive-o-x_props_override': |
172 | ['FAIL', known_reason], | |
20494d47 BB |
173 | 'cli_root/zpool_resilver/zpool_resilver_concurrent': |
174 | ['SKIP', na_reason], | |
788398c5 RM |
175 | 'cli_root/zpool_wait/zpool_wait_trim_basic': ['SKIP', trim_reason], |
176 | 'cli_root/zpool_wait/zpool_wait_trim_cancel': ['SKIP', trim_reason], | |
177 | 'cli_root/zpool_wait/zpool_wait_trim_flag': ['SKIP', trim_reason], | |
88d5580e | 178 | 'cli_root/zfs_unshare/zfs_unshare_008_pos': ['SKIP', na_reason], |
4b06d052 | 179 | 'link_count/link_count_001': ['SKIP', na_reason], |
533aef2b | 180 | 'casenorm/mixed_create_failure': ['FAIL', 13215], |
411f4a01 | 181 | 'mmap/mmap_sync_001_pos': ['SKIP', na_reason], |
e32e326c | 182 | 'rsend/send_raw_ashift': ['SKIP', 14961], |
4b06d052 | 183 | }) |
d3fe62cb RM |
184 | elif sys.platform.startswith('linux'): |
185 | known.update({ | |
e78b7a73 AZ |
186 | 'casenorm/mixed_formd_lookup': ['FAIL', 7633], |
187 | 'casenorm/mixed_formd_delete': ['FAIL', 7633], | |
188 | 'casenorm/sensitive_formd_lookup': ['FAIL', 7633], | |
189 | 'casenorm/sensitive_formd_delete': ['FAIL', 7633], | |
d3fe62cb | 190 | 'removal/removal_with_zdb': ['SKIP', known_reason], |
6b261643 | 191 | 'cli_root/zfs_unshare/zfs_unshare_002_pos': ['SKIP', na_reason], |
d3fe62cb RM |
192 | }) |
193 | ||
4b06d052 | 194 | |
e4a3297a BB |
195 | # |
196 | # These tests may occasionally fail or be skipped. We want there failures | |
197 | # to be reported but only unexpected failures should bubble up to cause | |
198 | # this script to exit with a non-zero exit status. | |
199 | # | |
200 | # Format: { 'test-name': ['expected result', 'issue-number | reason'] } | |
201 | # | |
202 | # For each known failure it is recommended to link to a GitHub issue by | |
203 | # setting the reason to the issue number. Alternately, one of the generic | |
204 | # reasons listed above can be used. | |
205 | # | |
206 | maybe = { | |
60f86a2b | 207 | 'append/threadsappend_001_pos': ['FAIL', 6136], |
e4a3297a | 208 | 'chattr/setup': ['SKIP', exec_reason], |
8ae86e2e | 209 | 'crtime/crtime_001_pos': ['SKIP', statx_reason], |
e4a3297a | 210 | 'cli_root/zdb/zdb_006_pos': ['FAIL', known_reason], |
7d07d1be BB |
211 | 'cli_root/zfs_destroy/zfs_destroy_dev_removal_condense': |
212 | ['FAIL', known_reason], | |
e4a3297a | 213 | 'cli_root/zfs_get/zfs_get_004_pos': ['FAIL', known_reason], |
e78b7a73 | 214 | 'cli_root/zfs_get/zfs_get_009_pos': ['SKIP', 5479], |
7d07d1be BB |
215 | 'cli_root/zfs_rollback/zfs_rollback_001_pos': ['FAIL', known_reason], |
216 | 'cli_root/zfs_rollback/zfs_rollback_002_pos': ['FAIL', known_reason], | |
87725534 | 217 | 'cli_root/zfs_share/zfs_share_concurrent_shares': ['FAIL', known_reason], |
e4a3297a | 218 | 'cli_root/zfs_snapshot/zfs_snapshot_002_neg': ['FAIL', known_reason], |
3886e708 | 219 | 'cli_root/zfs_unshare/zfs_unshare_006_pos': ['SKIP', na_reason], |
e4a3297a | 220 | 'cli_root/zpool_add/zpool_add_004_pos': ['FAIL', known_reason], |
e78b7a73 AZ |
221 | 'cli_root/zpool_destroy/zpool_destroy_001_pos': ['SKIP', 6145], |
222 | 'cli_root/zpool_import/zpool_import_missing_003_pos': ['SKIP', 6839], | |
b1f73412 | 223 | 'cli_root/zpool_initialize/zpool_initialize_import_export': |
e78b7a73 | 224 | ['FAIL', 11948], |
7d07d1be BB |
225 | 'cli_root/zpool_labelclear/zpool_labelclear_removed': |
226 | ['FAIL', known_reason], | |
1b939560 | 227 | 'cli_root/zpool_trim/setup': ['SKIP', trim_reason], |
e78b7a73 | 228 | 'cli_root/zpool_upgrade/zpool_upgrade_004_pos': ['FAIL', 6141], |
e4a3297a | 229 | 'delegate/setup': ['SKIP', exec_reason], |
c3cb57ae | 230 | 'fallocate/fallocate_punch-hole': ['SKIP', fspacectl_reason], |
e78b7a73 AZ |
231 | 'history/history_004_pos': ['FAIL', 7026], |
232 | 'history/history_005_neg': ['FAIL', 6680], | |
233 | 'history/history_006_neg': ['FAIL', 5657], | |
e4a3297a BB |
234 | 'history/history_008_pos': ['FAIL', known_reason], |
235 | 'history/history_010_pos': ['SKIP', exec_reason], | |
a584ef26 | 236 | 'io/mmap': ['SKIP', fio_reason], |
e4a3297a | 237 | 'largest_pool/largest_pool_001_pos': ['FAIL', known_reason], |
f1b81537 | 238 | 'mmp/mmp_on_uberblocks': ['FAIL', known_reason], |
60f86a2b | 239 | 'pam/setup': ['SKIP', "pamtester might be not available"], |
e78b7a73 | 240 | 'pool_checkpoint/checkpoint_discard_busy': ['FAIL', 11946], |
e4a3297a | 241 | 'projectquota/setup': ['SKIP', exec_reason], |
7d07d1be | 242 | 'removal/removal_condense_export': ['FAIL', known_reason], |
dbf6108b | 243 | 'renameat2/setup': ['SKIP', renameat2_reason], |
e78b7a73 AZ |
244 | 'reservation/reservation_008_pos': ['FAIL', 7741], |
245 | 'reservation/reservation_018_pos': ['FAIL', 5642], | |
e4a3297a | 246 | 'snapshot/clone_001_pos': ['FAIL', known_reason], |
e78b7a73 AZ |
247 | 'snapshot/snapshot_009_pos': ['FAIL', 7961], |
248 | 'snapshot/snapshot_010_pos': ['FAIL', 7961], | |
249 | 'snapused/snapused_004_pos': ['FAIL', 5513], | |
e4a3297a | 250 | 'tmpfile/setup': ['SKIP', tmpfile_reason], |
1b939560 | 251 | 'trim/setup': ['SKIP', trim_reason], |
e4a3297a BB |
252 | 'upgrade/upgrade_projectquota_001_pos': ['SKIP', project_id_reason], |
253 | 'user_namespace/setup': ['SKIP', user_ns_reason], | |
254 | 'userquota/setup': ['SKIP', exec_reason], | |
60f86a2b | 255 | 'vdev_zaps/vdev_zaps_004_pos': ['FAIL', known_reason], |
e78b7a73 | 256 | 'zvol/zvol_ENOSPC/zvol_ENOSPC_001_pos': ['FAIL', 5848], |
e4a3297a BB |
257 | } |
258 | ||
d3fe62cb RM |
259 | if sys.platform.startswith('freebsd'): |
260 | maybe.update({ | |
261 | 'cli_root/zfs_copies/zfs_copies_002_pos': ['FAIL', known_reason], | |
9f0a21e6 | 262 | 'cli_root/zfs_inherit/zfs_inherit_001_neg': ['FAIL', known_reason], |
f1b81537 | 263 | 'cli_root/zpool_import/zpool_import_012_pos': ['FAIL', known_reason], |
d3fe62cb | 264 | 'delegate/zfs_allow_003_pos': ['FAIL', known_reason], |
e78b7a73 | 265 | 'inheritance/inherit_001_pos': ['FAIL', 11829], |
d3fe62cb | 266 | 'resilver/resilver_restart_001': ['FAIL', known_reason], |
e78b7a73 AZ |
267 | 'pool_checkpoint/checkpoint_big_rewind': ['FAIL', 12622], |
268 | 'pool_checkpoint/checkpoint_indirect': ['FAIL', 12623], | |
245f4a34 | 269 | 'snapshot/snapshot_002_pos': ['FAIL', '14831'], |
d3fe62cb | 270 | }) |
745ace3f BB |
271 | elif sys.platform.startswith('linux'): |
272 | maybe.update({ | |
745ace3f | 273 | 'cli_root/zfs_rename/zfs_rename_002_pos': ['FAIL', known_reason], |
745ace3f | 274 | 'cli_root/zpool_reopen/zpool_reopen_003_pos': ['FAIL', known_reason], |
60f86a2b | 275 | 'fault/auto_online_002_pos': ['FAIL', 11889], |
5b3b6e95 | 276 | 'fault/auto_replace_001_pos': ['FAIL', 14851], |
60f86a2b | 277 | 'fault/auto_spare_002_pos': ['FAIL', 11889], |
3d149db1 | 278 | 'fault/auto_spare_multiple': ['FAIL', 11889], |
60f86a2b BB |
279 | 'fault/auto_spare_shared': ['FAIL', 11889], |
280 | 'fault/decompress_fault': ['FAIL', 11889], | |
716408f5 | 281 | 'io/io_uring': ['SKIP', 'io_uring support required'], |
e862b7ec BB |
282 | 'limits/filesystem_limit': ['SKIP', known_reason], |
283 | 'limits/snapshot_limit': ['SKIP', known_reason], | |
7d07d1be | 284 | 'mmp/mmp_active_import': ['FAIL', known_reason], |
d60c0dbd BB |
285 | 'mmp/mmp_exported_import': ['FAIL', known_reason], |
286 | 'mmp/mmp_inactive_import': ['FAIL', known_reason], | |
e78b7a73 | 287 | 'zvol/zvol_misc/zvol_misc_snapdev': ['FAIL', 12621], |
380b0724 | 288 | 'zvol/zvol_misc/zvol_misc_volmode': ['FAIL', known_reason], |
e085e98d BB |
289 | 'zvol/zvol_misc/zvol_misc_fua': ['SKIP', 14872], |
290 | 'zvol/zvol_misc/zvol_misc_trim': ['SKIP', 14872], | |
2a068a13 YY |
291 | 'idmap_mount/idmap_mount_001': ['SKIP', idmap_reason], |
292 | 'idmap_mount/idmap_mount_002': ['SKIP', idmap_reason], | |
293 | 'idmap_mount/idmap_mount_003': ['SKIP', idmap_reason], | |
294 | 'idmap_mount/idmap_mount_004': ['SKIP', idmap_reason], | |
f224eddf | 295 | 'idmap_mount/idmap_mount_005': ['SKIP', idmap_reason], |
48d0e946 RN |
296 | 'block_cloning/block_cloning_disabled_copyfilerange': |
297 | ['SKIP', cfr_reason], | |
298 | 'block_cloning/block_cloning_copyfilerange': | |
299 | ['SKIP', cfr_reason], | |
300 | 'block_cloning/block_cloning_copyfilerange_partial': | |
301 | ['SKIP', cfr_reason], | |
ead3eea3 RN |
302 | 'block_cloning/block_cloning_copyfilerange_fallback': |
303 | ['SKIP', cfr_reason], | |
48d0e946 RN |
304 | 'block_cloning/block_cloning_copyfilerange_cross_dataset': |
305 | ['SKIP', cfr_cross_reason], | |
cae502c1 RN |
306 | 'block_cloning/block_cloning_copyfilerange_fallback_same_txg': |
307 | ['SKIP', cfr_cross_reason], | |
c7b61192 KP |
308 | 'block_cloning/block_cloning_cross_enc_dataset': |
309 | ['SKIP', cfr_cross_reason], | |
745ace3f | 310 | }) |
d3fe62cb | 311 | |
e4a3297a | 312 | |
9eee7fce GM |
313 | # Not all Github actions runners have scsi_debug module, so we may skip |
314 | # some tests which use it. | |
315 | if os.environ.get('CI') == 'true': | |
316 | known.update({ | |
317 | 'cli_root/zpool_expand/zpool_expand_001_pos': ['SKIP', ci_reason], | |
318 | 'cli_root/zpool_expand/zpool_expand_003_neg': ['SKIP', ci_reason], | |
319 | 'cli_root/zpool_expand/zpool_expand_005_pos': ['SKIP', ci_reason], | |
320 | 'cli_root/zpool_reopen/setup': ['SKIP', ci_reason], | |
321 | 'cli_root/zpool_reopen/zpool_reopen_001_pos': ['SKIP', ci_reason], | |
322 | 'cli_root/zpool_reopen/zpool_reopen_002_pos': ['SKIP', ci_reason], | |
323 | 'cli_root/zpool_reopen/zpool_reopen_003_pos': ['SKIP', ci_reason], | |
324 | 'cli_root/zpool_reopen/zpool_reopen_004_pos': ['SKIP', ci_reason], | |
325 | 'cli_root/zpool_reopen/zpool_reopen_005_pos': ['SKIP', ci_reason], | |
326 | 'cli_root/zpool_reopen/zpool_reopen_006_neg': ['SKIP', ci_reason], | |
327 | 'cli_root/zpool_reopen/zpool_reopen_007_pos': ['SKIP', ci_reason], | |
328 | 'cli_root/zpool_split/zpool_split_wholedisk': ['SKIP', ci_reason], | |
329 | 'fault/auto_offline_001_pos': ['SKIP', ci_reason], | |
330 | 'fault/auto_online_001_pos': ['SKIP', ci_reason], | |
cfc564f9 | 331 | 'fault/auto_online_002_pos': ['SKIP', ci_reason], |
9eee7fce | 332 | 'fault/auto_replace_001_pos': ['SKIP', ci_reason], |
f0f330e1 | 333 | 'fault/auto_replace_002_pos': ['SKIP', ci_reason], |
9eee7fce GM |
334 | 'fault/auto_spare_ashift': ['SKIP', ci_reason], |
335 | 'fault/auto_spare_shared': ['SKIP', ci_reason], | |
336 | 'procfs/pool_state': ['SKIP', ci_reason], | |
337 | }) | |
338 | ||
339 | maybe.update({ | |
e78b7a73 | 340 | 'events/events_002_pos': ['FAIL', 11546], |
9eee7fce GM |
341 | }) |
342 | ||
343 | ||
e4a3297a BB |
344 | def process_results(pathname): |
345 | try: | |
346 | f = open(pathname) | |
3ed2fbcc | 347 | except IOError as e: |
7b6c4cbb | 348 | print('Error opening file:', e) |
e4a3297a BB |
349 | sys.exit(1) |
350 | ||
b0657a59 | 351 | prefix = '/zfs-tests/tests/(?:functional|perf/regression)/' |
b74f48fe | 352 | pattern = \ |
54aefa6a | 353 | r'^Test(?:\s+\(\S+\))?:' + \ |
7b6c4cbb AZ |
354 | rf'\s*\S*{prefix}(\S+)' + \ |
355 | r'\s*\(run as (\S+)\)\s*\[(\S+)\]\s*\[(\S+)\]' | |
b74f48fe | 356 | pattern_log = r'^\s*Log directory:\s*(\S*)' |
e4a3297a BB |
357 | |
358 | d = {} | |
7b6c4cbb | 359 | logdir = 'Could not determine log directory.' |
c87f9586 BB |
360 | for line in f.readlines(): |
361 | m = re.match(pattern, line) | |
e4a3297a | 362 | if m and len(m.groups()) == 4: |
e4a3297a BB |
363 | d[m.group(1)] = m.group(4) |
364 | continue | |
365 | ||
c87f9586 | 366 | m = re.match(pattern_log, line) |
e4a3297a | 367 | if m: |
7b6c4cbb | 368 | logdir = m.group(1) |
e4a3297a | 369 | |
7b6c4cbb | 370 | return d, logdir |
e4a3297a BB |
371 | |
372 | ||
2320e6eb PD |
373 | class ListMaybesAction(argparse.Action): |
374 | def __init__(self, | |
375 | option_strings, | |
376 | dest="SUPPRESS", | |
377 | default="SUPPRESS", | |
378 | help="list flaky tests and exit"): | |
379 | super(ListMaybesAction, self).__init__( | |
380 | option_strings=option_strings, | |
381 | dest=dest, | |
382 | default=default, | |
383 | nargs=0, | |
384 | help=help) | |
385 | ||
386 | def __call__(self, parser, namespace, values, option_string=None): | |
387 | for test in maybe: | |
388 | print(test) | |
389 | sys.exit(0) | |
390 | ||
391 | ||
e4a3297a | 392 | if __name__ == "__main__": |
2320e6eb PD |
393 | parser = argparse.ArgumentParser(description='Analyze ZTS logs') |
394 | parser.add_argument('logfile') | |
395 | parser.add_argument('--list-maybes', action=ListMaybesAction) | |
396 | parser.add_argument('--no-maybes', action='store_false', dest='maybes') | |
397 | args = parser.parse_args() | |
398 | ||
7b6c4cbb | 399 | results, logdir = process_results(args.logfile) |
e4a3297a | 400 | |
7b6c4cbb | 401 | if not results: |
3ed2fbcc | 402 | print("\n\nNo test results were found.") |
7b6c4cbb | 403 | print("Log directory:", logdir) |
e4a3297a BB |
404 | sys.exit(0) |
405 | ||
406 | expected = [] | |
407 | unexpected = [] | |
2320e6eb | 408 | all_maybes = True |
e4a3297a | 409 | |
3ed2fbcc | 410 | for test in list(results.keys()): |
e4a3297a BB |
411 | if results[test] == "PASS": |
412 | continue | |
413 | ||
414 | setup = test.replace(os.path.basename(test), "setup") | |
415 | if results[test] == "SKIP" and test != setup: | |
416 | if setup in known and known[setup][0] == "SKIP": | |
417 | continue | |
418 | if setup in maybe and maybe[setup][0] == "SKIP": | |
419 | continue | |
420 | ||
2320e6eb | 421 | if (test in known and results[test] in known[test][0]): |
e4a3297a | 422 | expected.append(test) |
2320e6eb PD |
423 | elif test in maybe and results[test] in maybe[test][0]: |
424 | if results[test] == 'SKIP' or args.maybes: | |
425 | expected.append(test) | |
426 | elif not args.maybes: | |
427 | unexpected.append(test) | |
428 | else: | |
429 | unexpected.append(test) | |
430 | all_maybes = False | |
e4a3297a | 431 | |
3ed2fbcc | 432 | print("\nTests with results other than PASS that are expected:") |
e4a3297a | 433 | for test in sorted(expected): |
1289fbb5 | 434 | issue_url = 'https://github.com/openzfs/zfs/issues/' |
e4a3297a BB |
435 | |
436 | # Include the reason why the result is expected, given the following: | |
4b06d052 | 437 | # 1. Suppress test results which set the "Not applicable" reason. |
e4a3297a BB |
438 | # 2. Numerical reasons are assumed to be GitHub issue numbers. |
439 | # 3. When an entire test group is skipped only report the setup reason. | |
440 | if test in known: | |
441 | if known[test][1] == na_reason: | |
442 | continue | |
e78b7a73 AZ |
443 | elif isinstance(known[test][1], int): |
444 | expect = f"{issue_url}{known[test][1]}" | |
e4a3297a BB |
445 | else: |
446 | expect = known[test][1] | |
447 | elif test in maybe: | |
e78b7a73 AZ |
448 | if isinstance(maybe[test][1], int): |
449 | expect = f"{issue_url}{maybe[test][1]}" | |
e4a3297a BB |
450 | else: |
451 | expect = maybe[test][1] | |
452 | elif setup in known and known[setup][0] == "SKIP" and setup != test: | |
453 | continue | |
454 | elif setup in maybe and maybe[setup][0] == "SKIP" and setup != test: | |
455 | continue | |
456 | else: | |
457 | expect = "UNKNOWN REASON" | |
7b6c4cbb | 458 | print(f" {results[test]} {test} ({expect})") |
e4a3297a | 459 | |
3ed2fbcc | 460 | print("\nTests with result of PASS that are unexpected:") |
e4a3297a BB |
461 | for test in sorted(known.keys()): |
462 | # We probably should not be silently ignoring the case | |
463 | # where "test" is not in "results". | |
464 | if test not in results or results[test] != "PASS": | |
465 | continue | |
7b6c4cbb | 466 | print(f" {results[test]} {test} (expected {known[test][0]})") |
e4a3297a | 467 | |
3ed2fbcc | 468 | print("\nTests with results other than PASS that are unexpected:") |
e4a3297a BB |
469 | for test in sorted(unexpected): |
470 | expect = "PASS" if test not in known else known[test][0] | |
7b6c4cbb | 471 | print(f" {results[test]} {test} (expected {expect})") |
e4a3297a BB |
472 | |
473 | if len(unexpected) == 0: | |
474 | sys.exit(0) | |
2320e6eb PD |
475 | elif not args.maybes and all_maybes: |
476 | sys.exit(2) | |
e4a3297a BB |
477 | else: |
478 | sys.exit(1) |