From owner-svn-src-projects@freebsd.org Wed Dec 16 00:22:16 2015 Return-Path: Delivered-To: svn-src-projects@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 02332A491F7 for ; Wed, 16 Dec 2015 00:22:16 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BC57415F4; Wed, 16 Dec 2015 00:22:15 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBG0MEaP053089; Wed, 16 Dec 2015 00:22:14 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBG0MEUM053087; Wed, 16 Dec 2015 00:22:14 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201512160022.tBG0MEUM053087@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Wed, 16 Dec 2015 00:22:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r292305 - projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zfs_set X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Dec 2015 00:22:16 -0000 Author: asomers Date: Wed Dec 16 00:22:14 2015 New Revision: 292305 URL: https://svnweb.freebsd.org/changeset/base/292305 Log: Fix the ro_props_001_pos test, which has spuriously failing for a while. tests/sys/cddl/zfs/tests/cli_root/zfs_set/ro_props_001_pos.ksh: - This test runs through many different ZFS property settings, checking that read-only properties can't be changed from the 'zfs set' command. However, the test reported that the 'used' property changed. - The root cause is because, when a ZFS command is issued that changes the pool configuration (e.g. create filesystem or snapshot), the action gets recorded in the pool history. However, the history logging is asynchronous, and its syncing can change the 'used' value for the pool dataset. - When the initial setup is complete, grab the pool history before continuing. This will force the outstanding history to be synced to disk before returning. tests/sys/cddl/zfs/tests/cli_root/zfs_set/zfs_set_common.kshlib: - Clean up set_n_check_prop() while here so it provides better feedback on error and is easier to understand. Submitted by: Will Sponsored by: Spectra Logic Corporation Modified: projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zfs_set/ro_props_001_pos.ksh projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zfs_set/zfs_set_common.kshlib Modified: projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zfs_set/ro_props_001_pos.ksh ============================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zfs_set/ro_props_001_pos.ksh Wed Dec 16 00:21:21 2015 (r292304) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zfs_set/ro_props_001_pos.ksh Wed Dec 16 00:22:14 2015 (r292305) @@ -89,6 +89,12 @@ log_onexit cleanup create_snapshot $TESTPOOL/$TESTFS $TESTSNAP create_snapshot $TESTPOOL/$TESTVOL $TESTSNAP +# Make sure any history logs have been synced. They're asynchronously +# pushed to the syncing context, and could influence the value of some +# properties on $TESTPOOL, like 'used'. Fetching it here forces the sync, +# per spa_history.c:spa_history_get(). +log_must $ZPOOL history $TESTPOOL + typeset -i i=0 typeset -i j=0 typeset cur_value="" @@ -126,4 +132,4 @@ while (( i < ${#dataset[@]} )); do (( i += 1 )) done -log_pass "Setting uneditable properties should failed. It passed." +log_pass "Setting uneditable properties fail, as required." Modified: projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zfs_set/zfs_set_common.kshlib ============================================================================== --- projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zfs_set/zfs_set_common.kshlib Wed Dec 16 00:21:21 2015 (r292304) +++ projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zfs_set/zfs_set_common.kshlib Wed Dec 16 00:22:14 2015 (r292305) @@ -52,50 +52,33 @@ function set_n_check_prop typeset dataset=$3 typeset expect_result=${4:-true} - typeset old_value="" - typeset cur_value="" - - [[ -n $prop ]] && old_value=$(get_prop $prop $dataset) - - if [[ $expect_result == true ]]; then - [[ -z $prop || -z $dataset ]] && \ - log_fail "property or dataset isn't defined." - + typeset old_value=$(get_prop $prop $dataset) + if [ "$expect_result" = "true" ]; then log_must $ZFS set $prop=$expect_value $dataset - if [[ $expect_value == "gzip-6" ]]; then - expect_value="gzip" - fi - - [[ -n $prop ]] && cur_value=$(get_prop $prop $dataset) - - case $prop in - reservation|reserv|quota ) - if [[ $expect_value == "none" ]]; then - [[ $cur_value != "0" ]] && \ - log_fail "The '$dataset' '$prop' value \ - '$cur_value' is not expected." - elif [[ $cur_value != $expect_value ]]; then - log_fail "The '$dataset' '$prop' value '$cur_value' \ - does not equal the expected value '$expect_value'." - fi - ;; - * ) - if [[ $cur_value != $expect_value ]]; then - log_fail "The '$dataset' '$prop' value '$cur_value' \ - does not equal the expected value '$expect_value'." - fi - ;; - esac - else log_mustnot $ZFS set $prop=$expect_value $dataset + fi + typeset cur_value=$(get_prop $prop $dataset) - [[ -n $prop ]] && cur_value=$(get_prop $prop $dataset) - - if [[ "$expect_value" != "" && "$cur_value" != "$old_value" ]]; - then - log_fail "The '$dataset' '$prop' value '$cur_value' \ - should equal with '$old_value'." + err="ERROR: Dataset '$dataset': '$prop' value '$cur_value'" + if [ "$expect_result" = "true" ]; then + case "$prop" in + reservation|reserv|quota) + if [ "$expect_value" = "none" -a "$cur_value" != "0" ]; then + err="$err should not be set!" + log_fail "$err" + return + fi + ;; + esac + if [ "$cur_value" != "$expect_value" ]; then + err="$err should have changed to '$expect_value'!" + log_fail "$err" + fi + else + if [ "$expect_value" != "" -a "$cur_value" != "$old_value" ]; then + err="$err should be unchanged at '$old_value'!" + log_fail "$err" fi fi }