]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - tests/zfs-tests/tests/functional/cli_root/zdb/zdb_002_pos.ksh
Vendor import of openzfs master @ 184df27eef0abdc7ab2105b21257f753834b936b
[FreeBSD/FreeBSD.git] / tests / zfs-tests / tests / functional / cli_root / zdb / zdb_002_pos.ksh
1 #!/bin/ksh
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) 2015 by Delphix. All rights reserved.
16 #
17
18 . $STF_SUITE/include/libtest.shlib
19
20 #
21 # Description:
22 # zdb will accurately count the feature refcount for pools with and without
23 # features enabled.
24 #
25 # Strategy:
26 # 1. Create a pool, and collect zdb output for the pool.
27 # 2. Verify there are no 'feature refcount mismatch' messages.
28 # 3. Repeat for a pool with features disabled.
29 #
30
31 log_assert "Verify zdb accurately counts feature refcounts."
32 log_onexit cleanup
33
34 typeset errstr="feature refcount mismatch"
35 typeset tmpfile="$TEST_BASE_DIR/zdb-feature-mismatch"
36 function cleanup
37 {
38         datasetexists $TESTPOOL && destroy_pool $TESTPOOL
39         grep "$errstr" $tmpfile
40         rm -f $tmpfile
41 }
42
43 for opt in '' -d; do
44         log_must zpool create -f $opt $TESTPOOL ${DISKS%% *}
45         log_must eval "zdb $TESTPOOL >$tmpfile"
46         grep -q "$errstr" $tmpfile && \
47             log_fail "Found feature refcount mismatches in zdb output."
48         destroy_pool $TESTPOOL
49 done
50
51 log_pass "zdb accurately counts feature refcounts."