]> git.proxmox.com Git - mirror_zfs.git/blame - tests/test-runner/bin/zts-report.py
dmu_objset_from_ds must be called with dp_config_rwlock held
[mirror_zfs.git] / tests / test-runner / bin / zts-report.py
CommitLineData
4f342e45 1#!/usr/bin/env python3
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
21import os
22import re
23import 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#
51known_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#
61exec_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#
69python_reason = 'Python v3.5 or newer required'
70python_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#
76tmpfile_reason = 'Kernel O_TMPFILE support required'
77
78#
79# Some tests require that the NFS client and server utilities be installed.
80#
81share_reason = 'NFS client and server utilities required'
82
83#
84# Some tests require that the lsattr utility support the project id feature.
85#
86project_id_reason = 'lsattr with set/show project ID required'
87
88#
89# Some tests require that the kernel support user namespaces.
90#
91user_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#
100rewind_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#
108enospc_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#
114fio_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#
121trim_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 128na_reason = "Not applicable"
e4a3297a
BB
129
130summary = {
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#
147known = {
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
161if 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
BB
167 })
168
e4a3297a
BB
169#
170# These tests may occasionally fail or be skipped. We want there failures
171# to be reported but only unexpected failures should bubble up to cause
172# this script to exit with a non-zero exit status.
173#
174# Format: { 'test-name': ['expected result', 'issue-number | reason'] }
175#
176# For each known failure it is recommended to link to a GitHub issue by
177# setting the reason to the issue number. Alternately, one of the generic
178# reasons listed above can be used.
179#
180maybe = {
cdbc34fc
RM
181 'alloc_class/alloc_class_012_pos': ['FAIL', '9142'],
182 'alloc_class/alloc_class_013_pos': ['FAIL', '9142'],
e4a3297a 183 'cache/cache_010_neg': ['FAIL', known_reason],
abef6998
RM
184 'casenorm/mixed_formd_lookup': ['FAIL', '7633'],
185 'casenorm/mixed_formd_delete': ['FAIL', '7633'],
186 'casenorm/sensitive_formd_lookup': ['FAIL', '7633'],
187 'casenorm/sensitive_formd_delete': ['FAIL', '7633'],
e4a3297a 188 'chattr/setup': ['SKIP', exec_reason],
e4a3297a
BB
189 'cli_root/zdb/zdb_006_pos': ['FAIL', known_reason],
190 'cli_root/zfs_get/zfs_get_004_pos': ['FAIL', known_reason],
191 'cli_root/zfs_get/zfs_get_009_pos': ['SKIP', '5479'],
e4a3297a
BB
192 'cli_root/zfs_share/setup': ['SKIP', share_reason],
193 'cli_root/zfs_snapshot/zfs_snapshot_002_neg': ['FAIL', known_reason],
194 'cli_root/zfs_unshare/setup': ['SKIP', share_reason],
e4a3297a 195 'cli_root/zpool_add/zpool_add_004_pos': ['FAIL', known_reason],
e4a3297a 196 'cli_root/zpool_destroy/zpool_destroy_001_pos': ['SKIP', '6145'],
e4a3297a
BB
197 'cli_root/zpool_import/import_rewind_device_replaced':
198 ['FAIL', rewind_reason],
199 'cli_root/zpool_import/import_rewind_config_changed':
200 ['FAIL', rewind_reason],
201 'cli_root/zpool_import/zpool_import_missing_003_pos': ['SKIP', '6839'],
1b939560 202 'cli_root/zpool_trim/setup': ['SKIP', trim_reason],
e4a3297a
BB
203 'cli_root/zpool_upgrade/zpool_upgrade_004_pos': ['FAIL', '6141'],
204 'cli_user/misc/arc_summary3_001_pos': ['SKIP', python_reason],
205 'delegate/setup': ['SKIP', exec_reason],
e4a3297a
BB
206 'history/history_004_pos': ['FAIL', '7026'],
207 'history/history_005_neg': ['FAIL', '6680'],
208 'history/history_006_neg': ['FAIL', '5657'],
209 'history/history_008_pos': ['FAIL', known_reason],
210 'history/history_010_pos': ['SKIP', exec_reason],
a584ef26 211 'io/mmap': ['SKIP', fio_reason],
e4a3297a 212 'largest_pool/largest_pool_001_pos': ['FAIL', known_reason],
d16c029f
BB
213 'limits/filesystem_limit': ['FAIL', '8226'],
214 'limits/snapshot_limit': ['FAIL', '8226'],
e4a3297a 215 'pyzfs/pyzfs_unittest': ['SKIP', python_deps_reason],
e03a41a6 216 'no_space/enospc_002_pos': ['FAIL', enospc_reason],
e4a3297a 217 'projectquota/setup': ['SKIP', exec_reason],
94b197a0 218 'redundancy/redundancy_004_neg': ['FAIL', '7290'],
4b06d052 219 'removal/removal_with_zdb': ['SKIP', known_reason],
e106a7ba 220 'reservation/reservation_008_pos': ['FAIL', '7741'],
e4a3297a
BB
221 'reservation/reservation_018_pos': ['FAIL', '5642'],
222 'rsend/rsend_019_pos': ['FAIL', '6086'],
223 'rsend/rsend_020_pos': ['FAIL', '6446'],
224 'rsend/rsend_021_pos': ['FAIL', '6446'],
225 'rsend/rsend_024_pos': ['FAIL', '5665'],
226 'rsend/send-c_volume': ['FAIL', '6087'],
e4a3297a 227 'snapshot/clone_001_pos': ['FAIL', known_reason],
838bd5ff
BB
228 'snapshot/snapshot_009_pos': ['FAIL', '7961'],
229 'snapshot/snapshot_010_pos': ['FAIL', '7961'],
e4a3297a
BB
230 'snapused/snapused_004_pos': ['FAIL', '5513'],
231 'tmpfile/setup': ['SKIP', tmpfile_reason],
232 'threadsappend/threadsappend_001_pos': ['FAIL', '6136'],
1b939560 233 'trim/setup': ['SKIP', trim_reason],
e4a3297a
BB
234 'upgrade/upgrade_projectquota_001_pos': ['SKIP', project_id_reason],
235 'user_namespace/setup': ['SKIP', user_ns_reason],
236 'userquota/setup': ['SKIP', exec_reason],
237 'vdev_zaps/vdev_zaps_004_pos': ['FAIL', '6935'],
e4a3297a
BB
238 'zvol/zvol_ENOSPC/zvol_ENOSPC_001_pos': ['FAIL', '5848'],
239}
240
241
242def usage(s):
3ed2fbcc 243 print(s)
e4a3297a
BB
244 sys.exit(1)
245
246
247def process_results(pathname):
248 try:
249 f = open(pathname)
3ed2fbcc
GK
250 except IOError as e:
251 print('Error opening file: %s' % e)
e4a3297a
BB
252 sys.exit(1)
253
254 prefix = '/zfs-tests/tests/functional/'
b74f48fe 255 pattern = \
54aefa6a
RM
256 r'^Test(?:\s+\(\S+\))?:' + \
257 r'\s*\S*%s(\S+)\s*\(run as (\S+)\)\s*\[(\S+)\]\s*\[(\S+)\]' \
e4a3297a 258 % prefix
b74f48fe 259 pattern_log = r'^\s*Log directory:\s*(\S*)'
e4a3297a
BB
260
261 d = {}
262 for l in f.readlines():
263 m = re.match(pattern, l)
264 if m and len(m.groups()) == 4:
265 summary['total'] += 1
266 if m.group(4) == "PASS":
267 summary['passed'] += 1
268 d[m.group(1)] = m.group(4)
269 continue
270
271 m = re.match(pattern_log, l)
272 if m:
273 summary['logfile'] = m.group(1)
274
275 return d
276
277
278if __name__ == "__main__":
cca14128 279 if len(sys.argv) != 2:
e4a3297a
BB
280 usage('usage: %s <pathname>' % sys.argv[0])
281 results = process_results(sys.argv[1])
282
283 if summary['total'] == 0:
3ed2fbcc
GK
284 print("\n\nNo test results were found.")
285 print("Log directory: %s" % summary['logfile'])
e4a3297a
BB
286 sys.exit(0)
287
288 expected = []
289 unexpected = []
290
3ed2fbcc 291 for test in list(results.keys()):
e4a3297a
BB
292 if results[test] == "PASS":
293 continue
294
295 setup = test.replace(os.path.basename(test), "setup")
296 if results[test] == "SKIP" and test != setup:
297 if setup in known and known[setup][0] == "SKIP":
298 continue
299 if setup in maybe and maybe[setup][0] == "SKIP":
300 continue
301
302 if ((test not in known or results[test] not in known[test][0]) and
303 (test not in maybe or results[test] not in maybe[test][0])):
304 unexpected.append(test)
305 else:
306 expected.append(test)
307
3ed2fbcc 308 print("\nTests with results other than PASS that are expected:")
e4a3297a 309 for test in sorted(expected):
1289fbb5 310 issue_url = 'https://github.com/openzfs/zfs/issues/'
e4a3297a
BB
311
312 # Include the reason why the result is expected, given the following:
4b06d052 313 # 1. Suppress test results which set the "Not applicable" reason.
e4a3297a
BB
314 # 2. Numerical reasons are assumed to be GitHub issue numbers.
315 # 3. When an entire test group is skipped only report the setup reason.
316 if test in known:
317 if known[test][1] == na_reason:
318 continue
319 elif known[test][1].isdigit():
320 expect = issue_url + known[test][1]
321 else:
322 expect = known[test][1]
323 elif test in maybe:
324 if maybe[test][1].isdigit():
325 expect = issue_url + maybe[test][1]
326 else:
327 expect = maybe[test][1]
328 elif setup in known and known[setup][0] == "SKIP" and setup != test:
329 continue
330 elif setup in maybe and maybe[setup][0] == "SKIP" and setup != test:
331 continue
332 else:
333 expect = "UNKNOWN REASON"
3ed2fbcc 334 print(" %s %s (%s)" % (results[test], test, expect))
e4a3297a 335
3ed2fbcc 336 print("\nTests with result of PASS that are unexpected:")
e4a3297a
BB
337 for test in sorted(known.keys()):
338 # We probably should not be silently ignoring the case
339 # where "test" is not in "results".
340 if test not in results or results[test] != "PASS":
341 continue
3ed2fbcc
GK
342 print(" %s %s (expected %s)" % (results[test], test,
343 known[test][0]))
e4a3297a 344
3ed2fbcc 345 print("\nTests with results other than PASS that are unexpected:")
e4a3297a
BB
346 for test in sorted(unexpected):
347 expect = "PASS" if test not in known else known[test][0]
3ed2fbcc 348 print(" %s %s (expected %s)" % (results[test], test, expect))
e4a3297a
BB
349
350 if len(unexpected) == 0:
351 sys.exit(0)
352 else:
353 sys.exit(1)