diff options
author | Martin Matuska <mm@FreeBSD.org> | 2021-06-26 00:21:11 +0000 |
---|---|---|
committer | Martin Matuska <mm@FreeBSD.org> | 2021-06-26 00:21:11 +0000 |
commit | 33b8c039a960bcff3471baf5929558c4d1500727 (patch) | |
tree | 9627538080dac1f018cb190aa9a245cabce277ed /sys/contrib/openzfs/tests/zfs-tests/tests | |
parent | ec8004dd419d8c8acfc9025dd050f141c949d53a (diff) | |
parent | 5e2c8338bf17d31b44eb1dbbb3c9b6a0f64e96ee (diff) | |
download | src-33b8c039a960bcff3471baf5929558c4d1500727.tar.gz src-33b8c039a960bcff3471baf5929558c4d1500727.zip |
zfs: merge openzfs/zfs@5e2c8338b (master) into main
Notable upstream pull request merges:
#12183 Optimize small random numbers generation
#12227 Revert Consolidate arc_buf allocation checks
#12266 Fix flag copying in resume case
#12273 zfs_metaslab_mem_limit should be 25 instead of 75
#12276 Update cache file when setting compatibility property
#12280 Help compiller optimize out abd_verify()
#12282 FreeBSD: fix compilation of FreeBSD world after 29274c9f6
Obtained from: OpenZFS
OpenZFS commit: 5e2c8338bf17d31b44eb1dbbb3c9b6a0f64e96ee
Diffstat (limited to 'sys/contrib/openzfs/tests/zfs-tests/tests')
7 files changed, 113 insertions, 20 deletions
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_create/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_create/Makefile.am index 5e9e83f0db91..5ffaae5b152c 100644 --- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_create/Makefile.am +++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_create/Makefile.am @@ -39,6 +39,7 @@ dist_pkgdata_SCRIPTS = \ zpool_create_features_006_pos.ksh \ zpool_create_features_007_pos.ksh \ zpool_create_features_008_pos.ksh \ + zpool_create_features_009_pos.ksh \ create-o_ashift.ksh \ zpool_create_tempname.ksh \ zpool_create_dryrun_output.ksh diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_features_009_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_features_009_pos.ksh new file mode 100755 index 000000000000..052c18dcee2b --- /dev/null +++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_features_009_pos.ksh @@ -0,0 +1,92 @@ +#!/bin/ksh -p +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. +# +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +# or http://www.opensolaris.org/os/licensing. +# See the License for the specific language governing permissions +# and limitations under the License. +# +# When distributing Covered Code, include this CDDL HEADER in each +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. +# If applicable, add the following below this CDDL HEADER, with the +# fields enclosed by brackets "[]" replaced with your own identifying +# information: Portions Copyright [yyyy] [name of copyright owner] +# +# CDDL HEADER END +# + +# +# Copyright (c) 2021 Lawrence Livermore National Security, LLC. +# + +. $STF_SUITE/include/libtest.shlib + +# +# DESCRIPTION: +# Verify '-o compatibility' property is updated in both the +# pool config MOS object and the cache file. +# +# STRATEGY: +# 1. Create a pool with '-o compatibility=legacy', then verify +# the property exists in the MOS config and cache file. +# 2. Create a pool, set the 'compatibility=off' property, then +# verify the property exists in the MOS config and cache file. +# + +verify_runnable "global" + +function cleanup +{ + datasetexists $TESTPOOL && log_must zpool destroy $TESTPOOL + rm -f $CACHE_FILE +} + +function check_config +{ + typeset propval=$1 + + poolval="$(zpool get -H -o value compatibility $TESTPOOL)" + if [ "$poolval" != "$propval" ]; then + log_fail "compatibility property set incorrectly $curval" + fi + + if ! zdb -C -U $CACHE_FILE | grep "compatibility: '$propval'"; then + log_fail "compatibility property missing in cache file" + fi + + if ! zdb -C -U $CACHE_FILE $TESTPOOL | grep "compatibility: '$propval'"; then + log_fail "compatibility property missing from MOS object" + fi +} + +log_onexit cleanup + +log_assert "verify '-o compatibility' in MOS object and cache file" + +CACHE_FILE=$TEST_BASE_DIR/cachefile.$$ + +# 1. Create a pool with '-o compatibility=legacy', then verify +# the property exists in the MOS config and cache file. +log_must zpool create -f -o cachefile=$CACHE_FILE -o compatibility=legacy $TESTPOOL $DISKS +log_must check_config legacy +log_must zpool export -F $TESTPOOL +log_must zpool import -c $CACHE_FILE $TESTPOOL +log_must check_config legacy +log_must zpool destroy -f $TESTPOOL + +# 2. Create a pool, set the 'compatibility=off' property, then +# verify the property exists in the MOS config and cache file. +log_must zpool create -f -o cachefile=$CACHE_FILE $TESTPOOL $DISKS +log_must zpool set compatibility=legacy $TESTPOOL +log_must check_config legacy +log_must zpool export -F $TESTPOOL +log_must zpool import -c $CACHE_FILE $TESTPOOL +log_must check_config legacy +log_must zpool destroy -f $TESTPOOL + +log_pass "verify '-o compatibility' in MOS object and cache file" diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/redacted_send/redacted_embedded.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/redacted_send/redacted_embedded.ksh index 94937a2f79ab..1c5b503a9be5 100755 --- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/redacted_send/redacted_embedded.ksh +++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/redacted_send/redacted_embedded.ksh @@ -65,7 +65,7 @@ for recsize in 512 1024 2048 4096 8192 16384; do grep -q "EMBEDDED" $tmpdir/recv.zdb || \ log_fail "Obj $recv_obj not embedded in $recvfs" - cat $stream | zstreamdump -v | log_must grep -q \ + cat $stream | zstream dump -v | log_must grep -q \ "WRITE_EMBEDDED object = $send_obj offset = 0" done @@ -96,7 +96,7 @@ for recsize in 1024 4096 16384; do grep -q "EMBEDDED" $tmpdir/recv.zdb || \ log_fail "Obj $recv_obj not embedded in $recvfs" - cat $stream | zstreamdump -v | log_must grep -q \ + cat $stream | zstream dump -v | log_must grep -q \ "WRITE_EMBEDDED object = $send_obj offset = 0" done diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/rsend/rsend.kshlib b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/rsend/rsend.kshlib index 26755e87d0a5..d06bd39b4d49 100644 --- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/rsend/rsend.kshlib +++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/rsend/rsend.kshlib @@ -584,13 +584,13 @@ function mess_send_file # The random offset might truncate the send stream to be # smaller than the DRR_BEGIN record. If this happens, then # the receiving system won't have enough info to create the - # partial dataset at all. We use zstreamdump to check for + # partial dataset at all. We use zstream dump to check for # this and retry in this case. - nr_begins=$(head -c $offset $file | zstreamdump | \ + nr_begins=$(head -c $offset $file | zstream dump | \ grep DRR_BEGIN | awk '{ print $5 }') while [ "$nr_begins" -eq 0 ]; do offset=$(($RANDOM * $RANDOM % $filesize)) - nr_begins=$(head -c $offset $file | zstreamdump | \ + nr_begins=$(head -c $offset $file | zstream dump | \ grep DRR_BEGIN | awk '{ print $5 }') done @@ -741,7 +741,7 @@ function stream_has_features shift [[ -f $file ]] || log_fail "Couldn't find file: $file" - typeset flags=$(cat $file | zstreamdump | \ + typeset flags=$(cat $file | zstream dump | \ awk '/features =/ {features = $3} END {print features}') typeset -A feature feature[dedup]="1" @@ -774,7 +774,7 @@ function stream_has_features # comparing. This function does not currently handle incremental streams # that remove data. # -# $1 The zstreamdump output file +# $1 The zstream dump output file # $2 The dataset to compare against # This can be a source of a send or recv target (fs, not snapshot) # $3 The percentage below which verification is deemed a failure @@ -791,7 +791,7 @@ function verify_stream_size [[ -f $stream ]] || log_fail "No such file: $stream" datasetexists $ds || log_fail "No such dataset: $ds" - typeset stream_size=$(cat $stream | zstreamdump | sed -n \ + typeset stream_size=$(cat $stream | zstream dump | sed -n \ 's/ Total payload size = \(.*\) (0x.*)/\1/p') typeset inc_size=0 diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/rsend/send-c_embedded_blocks.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/rsend/send-c_embedded_blocks.ksh index 70f79b3173b7..3dce217d8955 100755 --- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/rsend/send-c_embedded_blocks.ksh +++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/rsend/send-c_embedded_blocks.ksh @@ -63,17 +63,17 @@ for recsize in "${recsize_prop_vals[@]}"; do fi done -# Generate the streams and zstreamdump output. +# Generate the streams and zstream dump output. log_must zfs snapshot $sendfs@now log_must eval "zfs send -c $sendfs@now >$stream" -log_must eval "zstreamdump -v <$stream >$dump" +log_must eval "zstream dump -v <$stream >$dump" log_must eval "zfs recv -d $recvfs <$stream" cmp_ds_cont $sendfs $recvfs verify_stream_size $stream $sendfs log_mustnot stream_has_features $stream embed_data log_must eval "zfs send -c -e $sendfs@now >$stream2" -log_must eval "zstreamdump -v <$stream2 >$dump2" +log_must eval "zstream dump -v <$stream2 >$dump2" log_must eval "zfs recv -d $recvfs2 <$stream2" cmp_ds_cont $sendfs $recvfs2 verify_stream_size $stream2 $sendfs @@ -101,9 +101,9 @@ for recsize in "${recsize_prop_vals[@]}"; do log_fail "Obj $recv2_obj not embedded in $recvfs2" grep -q "WRITE_EMBEDDED object = $send_obj offset = 0" $dump && \ - log_fail "Obj $obj embedded in zstreamdump output" + log_fail "Obj $obj embedded in zstream dump output" grep -q "WRITE_EMBEDDED object = $send_obj offset = 0" $dump2 || \ - log_fail "Obj $obj not embedded in zstreamdump output" + log_fail "Obj $obj not embedded in zstream dump output" done log_pass "Compressed streams can contain embedded blocks." diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/rsend/send-c_zstreamdump.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/rsend/send-c_zstreamdump.ksh index b4dc00cec4e7..5b9939c6a64c 100755 --- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/rsend/send-c_zstreamdump.ksh +++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/rsend/send-c_zstreamdump.ksh @@ -21,12 +21,12 @@ # # Description: -# Verify compression features show up in zstreamdump +# Verify compression features show up in zstream dump # # Strategy: # 1. Create a full compressed send stream -# 2. Verify zstreamdump shows this stream has the relevant features -# 3. Verify zstreamdump's accounting of logical and compressed size is correct +# 2. Verify zstream dump shows this stream has the relevant features +# 3. Verify zstream dump's accounting of logical and compressed size is correct # 4. Verify the toname from a resume token # 5. Verify it fails with corrupted resume token # 6. Verify it fails with missing resume token @@ -34,7 +34,7 @@ verify_runnable "both" -log_assert "Verify zstreamdump correctly interprets compressed send streams." +log_assert "Verify zstream dump correctly interprets compressed send streams." log_onexit cleanup_pool $POOL2 typeset sendfs=$POOL2/fs @@ -49,7 +49,7 @@ log_must zfs snapshot $sendfs@full log_must eval "zfs send -c $sendfs@full >$BACKDIR/full" log_must stream_has_features $BACKDIR/full lz4 compressed -cat $BACKDIR/full | zstreamdump -v > $BACKDIR/dump.out +cat $BACKDIR/full | zstream dump -v > $BACKDIR/dump.out lsize=$(awk '/^WRITE [^0]/ {lsize += $24} END {printf("%d", lsize)}' \ $BACKDIR/dump.out) @@ -72,4 +72,4 @@ bad_resume_token="1-1162e8285b-100789c6360" log_mustnot eval "zstream token $bad_resume_token 2>&1" log_mustnot eval "zstream token 2>&1" -log_pass "zstreamdump correctly interprets compressed send streams." +log_pass "zstream dump correctly interprets compressed send streams." diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/rsend/send-cpL_varied_recsize.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/rsend/send-cpL_varied_recsize.ksh index e1ac00c79c96..e2810651a60e 100755 --- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/rsend/send-cpL_varied_recsize.ksh +++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/rsend/send-cpL_varied_recsize.ksh @@ -134,7 +134,7 @@ function check [[ -f $stream ]] && log_must rm $stream log_must eval "zfs send $flags $send_snap >$stream" $verify eval "zfs recv $recv_ds <$stream" - typeset stream_size=$(cat $stream | zstreamdump | sed -n \ + typeset stream_size=$(cat $stream | zstream dump | sed -n \ 's/ Total write size = \(.*\) (0x.*)/\1/p') # |