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 31log_assert "Verify zdb accurately counts feature refcounts." 32log_onexit cleanup 33 34typeset errstr="feature refcount mismatch" 35typeset tmpfile="$TEST_BASE_DIR/zdb-feature-mismatch" 36function cleanup 37{ 38 datasetexists $TESTPOOL && destroy_pool $TESTPOOL 39 grep "$errstr" $tmpfile 40 rm -f $tmpfile 41} 42 43for 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 49done 50 51log_pass "zdb accurately counts feature refcounts." 52