summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorGeorge Melikov <[email protected]>2017-01-24 19:59:08 +0300
committerBrian Behlendorf <[email protected]>2017-01-24 08:59:08 -0800
commita39ce906602ce721774f4e17671c05bd5c710d1e (patch)
tree3b05a045923234be957126d08b52cd05af458d47 /tests
parente82dbae1ee33170ed3924c5229db651caf384333 (diff)
OpenZFS 6880 - zdb incorrectly reports feature count mismatch when feature is disabled
Authored by: Matthew Ahrens <[email protected]> Reviewed by: George Wilson <[email protected]> Reviewed by: Prakash Surya <[email protected]> Approved by: Robert Mustacchi <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Ported-by: George Melikov <[email protected]> OpenZFS-issue: https://www.illumos.org/issues/6880 OpenZFS-commit: https://github.com/openzfs/openzfs/commit/c5d1600 Closes #5641
Diffstat (limited to 'tests')
-rw-r--r--tests/runfiles/linux.run2
-rw-r--r--tests/zfs-tests/tests/functional/cli_root/zdb/Makefile.am3
-rwxr-xr-xtests/zfs-tests/tests/functional/cli_root/zdb/zdb_002_pos.ksh51
3 files changed, 54 insertions, 2 deletions
diff --git a/tests/runfiles/linux.run b/tests/runfiles/linux.run
index 1dbe8f88b..78a047b9f 100644
--- a/tests/runfiles/linux.run
+++ b/tests/runfiles/linux.run
@@ -71,7 +71,7 @@ tests = [ 'clean_mirror_001_pos', 'clean_mirror_002_pos',
'clean_mirror_003_pos', 'clean_mirror_004_pos']
[tests/functional/cli_root/zdb]
-tests = ['zdb_001_neg']
+tests = ['zdb_001_neg', 'zdb_002_pos']
pre =
post =
diff --git a/tests/zfs-tests/tests/functional/cli_root/zdb/Makefile.am b/tests/zfs-tests/tests/functional/cli_root/zdb/Makefile.am
index 05711c2b6..c5bd009f4 100644
--- a/tests/zfs-tests/tests/functional/cli_root/zdb/Makefile.am
+++ b/tests/zfs-tests/tests/functional/cli_root/zdb/Makefile.am
@@ -1,3 +1,4 @@
pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zdb
dist_pkgdata_SCRIPTS = \
- zdb_001_neg.ksh
+ zdb_001_neg.ksh \
+ zdb_002_pos.ksh
diff --git a/tests/zfs-tests/tests/functional/cli_root/zdb/zdb_002_pos.ksh b/tests/zfs-tests/tests/functional/cli_root/zdb/zdb_002_pos.ksh
new file mode 100755
index 000000000..4f630ad46
--- /dev/null
+++ b/tests/zfs-tests/tests/functional/cli_root/zdb/zdb_002_pos.ksh
@@ -0,0 +1,51 @@
+#!/bin/ksh
+
+#
+# This file and its contents are supplied under the terms of the
+# Common Development and Distribution License ("CDDL"), version 1.0.
+# You may only use this file in accordance with the terms of version
+# 1.0 of the CDDL.
+#
+# A full copy of the text of the CDDL should have accompanied this
+# source. A copy of the CDDL is also available via the Internet at
+# http://www.illumos.org/license/CDDL.
+#
+
+#
+# Copyright (c) 2015 by Delphix. All rights reserved.
+#
+
+. $STF_SUITE/include/libtest.shlib
+
+#
+# Description:
+# zdb will accurately count the feature refcount for pools with and without
+# features enabled.
+#
+# Strategy:
+# 1. Create a pool, and collect zdb output for the pool.
+# 2. Verify there are no 'feature refcount mismatch' messages.
+# 3. Repeat for a pool with features disabled.
+#
+
+log_assert "Verify zdb accurately counts feature refcounts."
+log_onexit cleanup
+
+typeset errstr="feature refcount mismatch"
+typeset tmpfile="/var/tmp/zdb-feature-mismatch"
+function cleanup
+{
+ datasetexists $TESTPOOL && destroy_pool $TESTPOOL
+ grep "$errstr" $tmpfile
+ rm -f $tmpfile
+}
+
+for opt in '' -d; do
+ log_must zpool create -f $opt $TESTPOOL ${DISKS%% *}
+ log_must eval "$ZDB $TESTPOOL >$tmpfile"
+ grep -q "$errstr" $tmpfile && \
+ log_fail "Found feature refcount mismatches in zdb output."
+ destroy_pool $TESTPOOL
+done
+
+log_pass "zdb accurately counts feature refcounts."