From 1c41d8941cb5a76d71930d2af976c376c05ed318 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=BD=D0=B0=D0=B1?= Date: Thu, 10 Mar 2022 20:14:28 +0100 Subject: [PATCH] tests: validate getsubopt(3) expulsion MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Brian Behlendorf Signed-off-by: Ahelenia ZiemiaƄska Closes #12996 --- tests/runfiles/common.run | 5 +++-- tests/runfiles/sanity.run | 2 +- .../cli_root/zfs_get/zfs_get_006_neg.ksh | 3 ++- .../cli_root/zfs_get/zfs_get_007_neg.ksh | 2 +- .../tests/functional/cli_root/zfs_wait/Makefile.am | 3 ++- .../cli_root/zfs_wait/zfs_wait_getsubopt.ksh | 14 ++++++++++++++ .../cli_root/zpool_get/zpool_get_004_neg.ksh | 3 ++- .../cli_root/zpool_wait/zpool_wait_usage.ksh | 2 ++ .../tests/functional/cli_user/zfs_list/Makefile.am | 1 + .../cli_user/zfs_list/zfs_list_005_neg.ksh | 14 ++++++++++++++ 10 files changed, 42 insertions(+), 7 deletions(-) create mode 100755 tests/zfs-tests/tests/functional/cli_root/zfs_wait/zfs_wait_getsubopt.ksh create mode 100755 tests/zfs-tests/tests/functional/cli_user/zfs_list/zfs_list_005_neg.ksh diff --git a/tests/runfiles/common.run b/tests/runfiles/common.run index fdc2172b6..6bc4bb583 100644 --- a/tests/runfiles/common.run +++ b/tests/runfiles/common.run @@ -315,7 +315,7 @@ tests = ['zfs_upgrade_001_pos', 'zfs_upgrade_002_pos', 'zfs_upgrade_003_pos', tags = ['functional', 'cli_root', 'zfs_upgrade'] [tests/functional/cli_root/zfs_wait] -tests = ['zfs_wait_deleteq'] +tests = ['zfs_wait_deleteq', 'zfs_wait_getsubopt'] tags = ['functional', 'cli_root', 'zfs_wait'] [tests/functional/cli_root/zhack] @@ -551,7 +551,8 @@ tags = ['functional', 'cli_user', 'misc'] [tests/functional/cli_user/zfs_list] tests = ['zfs_list_001_pos', 'zfs_list_002_pos', 'zfs_list_003_pos', - 'zfs_list_004_neg', 'zfs_list_007_pos', 'zfs_list_008_neg'] + 'zfs_list_004_neg', 'zfs_list_005_neg', 'zfs_list_007_pos', + 'zfs_list_008_neg'] user = tags = ['functional', 'cli_user', 'zfs_list'] diff --git a/tests/runfiles/sanity.run b/tests/runfiles/sanity.run index 383308bb5..9faf0e4d9 100644 --- a/tests/runfiles/sanity.run +++ b/tests/runfiles/sanity.run @@ -236,7 +236,7 @@ tests = ['zfs_upgrade_001_pos', 'zfs_upgrade_002_pos', 'zfs_upgrade_006_neg', tags = ['functional', 'cli_root', 'zfs_upgrade'] [tests/functional/cli_root/zfs_wait] -tests = ['zfs_wait_deleteq'] +tests = ['zfs_wait_deleteq', 'zfs_wait_getsubopt'] tags = ['functional', 'cli_root', 'zfs_wait'] [tests/functional/cli_root/zpool] diff --git a/tests/zfs-tests/tests/functional/cli_root/zfs_get/zfs_get_006_neg.ksh b/tests/zfs-tests/tests/functional/cli_root/zfs_get/zfs_get_006_neg.ksh index a91685849..e19936ef8 100755 --- a/tests/zfs-tests/tests/functional/cli_root/zfs_get/zfs_get_006_neg.ksh +++ b/tests/zfs-tests/tests/functional/cli_root/zfs_get/zfs_get_006_neg.ksh @@ -47,7 +47,8 @@ log_assert "Verify 'zfs get all' fails with invalid combination scenarios." set -f # Force ksh ignore '?' and '*' set -A bad_combine "ALL" "\-R all" "-P all" "-h all" "-rph all" "-RpH all" "-PrH all" \ - "-o all" "-s all" "-? all" "-* all" "-?* all" "all -r" "all -p" \ + "-o all" "-s all" "-s none=getsubopt" "-t filesystem=getsubopt" \ + "-? all" "-* all" "-?* all" "all -r" "all -p" \ "all -H" "all -rp" "all -rH" "all -ph" "all -rpH" "all -r $TESTPOOL" \ "all -H $TESTPOOL" "all -p $TESTPOOL" "all -r -p -H $TESTPOOL" \ "all -rph $TESTPOOL" "all,available,reservation $TESTPOOL" \ diff --git a/tests/zfs-tests/tests/functional/cli_root/zfs_get/zfs_get_007_neg.ksh b/tests/zfs-tests/tests/functional/cli_root/zfs_get/zfs_get_007_neg.ksh index 9bb00807f..63dfb6a50 100755 --- a/tests/zfs-tests/tests/functional/cli_root/zfs_get/zfs_get_007_neg.ksh +++ b/tests/zfs-tests/tests/functional/cli_root/zfs_get/zfs_get_007_neg.ksh @@ -51,7 +51,7 @@ set -A badargs "o name,property,value,resource" "o name" \ "-o" "-o ,,,,," "-o -o -o -o" "-o NAME,PROPERTY,VALUE,SOURCE" \ "-o name,properTy,value,source" "-o name, property, value,source" \ "-o name:property:value:source" "-o name,property:value,source" \ - "-o name;property;value;source" + "-o name;property;value;source" "-o name=getsubopt" typeset -i i=0 while (( i < ${#badargs[*]} )) diff --git a/tests/zfs-tests/tests/functional/cli_root/zfs_wait/Makefile.am b/tests/zfs-tests/tests/functional/cli_root/zfs_wait/Makefile.am index d401fe68b..5d385d915 100644 --- a/tests/zfs-tests/tests/functional/cli_root/zfs_wait/Makefile.am +++ b/tests/zfs-tests/tests/functional/cli_root/zfs_wait/Makefile.am @@ -2,7 +2,8 @@ pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zfs_wait dist_pkgdata_SCRIPTS = \ setup.ksh \ cleanup.ksh \ - zfs_wait_deleteq.ksh + zfs_wait_deleteq.ksh \ + zfs_wait_getsubopt.ksh dist_pkgdata_DATA = \ zfs_wait.kshlib diff --git a/tests/zfs-tests/tests/functional/cli_root/zfs_wait/zfs_wait_getsubopt.ksh b/tests/zfs-tests/tests/functional/cli_root/zfs_wait/zfs_wait_getsubopt.ksh new file mode 100755 index 000000000..d60aec96b --- /dev/null +++ b/tests/zfs-tests/tests/functional/cli_root/zfs_wait/zfs_wait_getsubopt.ksh @@ -0,0 +1,14 @@ +#!/bin/ksh -p +# SPDX-License-Identifier: 0BSD + +. $STF_SUITE/include/libtest.shlib + +# +# DESCRIPTION: +# zfs wait -t used to accept getsubopt(3)-style deleteq=whatever; +# it doesn't anymore +# + +log_mustnot zfs wait -t deleteq=getsubopt $TESTPOOL + +log_pass "'zfs wait -t' doesn't accept =getsubopt suffixes." diff --git a/tests/zfs-tests/tests/functional/cli_root/zpool_get/zpool_get_004_neg.ksh b/tests/zfs-tests/tests/functional/cli_root/zpool_get/zpool_get_004_neg.ksh index 1edd2ba79..bbdd32933 100755 --- a/tests/zfs-tests/tests/functional/cli_root/zpool_get/zpool_get_004_neg.ksh +++ b/tests/zfs-tests/tests/functional/cli_root/zpool_get/zpool_get_004_neg.ksh @@ -51,7 +51,8 @@ set -A arguments "$TESTPOOL $TESTPOOL" "$TESTPOOL rubbish" "-v $TESTPOOL" \ "nosuchproperty $TESTPOOL" "--$TESTPOOL" "all all" \ "type $TESTPOOL" "usage: $TESTPOOL" "bootfs $TESTPOOL@" \ "bootfs,bootfs $TESTPOOL" "name $TESTPOOL" "t%d%s" \ - "bootfs,delegation $TESTPOOL" "delegation $TESTPOOL@" + "bootfs,delegation $TESTPOOL" "delegation $TESTPOOL@" \ + "-o name=getsubopt allocated $TESTPOOL" for arg in $arguments do diff --git a/tests/zfs-tests/tests/functional/cli_root/zpool_wait/zpool_wait_usage.ksh b/tests/zfs-tests/tests/functional/cli_root/zpool_wait/zpool_wait_usage.ksh index 2d6f89709..05cbfce57 100755 --- a/tests/zfs-tests/tests/functional/cli_root/zpool_wait/zpool_wait_usage.ksh +++ b/tests/zfs-tests/tests/functional/cli_root/zpool_wait/zpool_wait_usage.ksh @@ -43,5 +43,7 @@ zpool wait -t scrub fakepool 2>&1 | grep -i 'no such pool' || \ log_fail "Error message did not contain phrase 'no such pool'." zpool wait -t foo $TESTPOOL 2>&1 | grep -i 'invalid activity' || \ log_fail "Error message did not contain phrase 'invalid activity'." +zpool wait -t scrub=getsubopt $TESTPOOL 2>&1 | grep -i 'invalid activity' || \ + log_fail "getsubopt(3) error message did not contain phrase 'invalid activity'." log_pass "'zpool wait' behaves sensibly when invoked incorrectly." diff --git a/tests/zfs-tests/tests/functional/cli_user/zfs_list/Makefile.am b/tests/zfs-tests/tests/functional/cli_user/zfs_list/Makefile.am index 8393072af..81754f401 100644 --- a/tests/zfs-tests/tests/functional/cli_user/zfs_list/Makefile.am +++ b/tests/zfs-tests/tests/functional/cli_user/zfs_list/Makefile.am @@ -6,6 +6,7 @@ dist_pkgdata_SCRIPTS = \ zfs_list_002_pos.ksh \ zfs_list_003_pos.ksh \ zfs_list_004_neg.ksh \ + zfs_list_005_neg.ksh \ zfs_list_007_pos.ksh \ zfs_list_008_neg.ksh diff --git a/tests/zfs-tests/tests/functional/cli_user/zfs_list/zfs_list_005_neg.ksh b/tests/zfs-tests/tests/functional/cli_user/zfs_list/zfs_list_005_neg.ksh new file mode 100755 index 000000000..ae374a6f6 --- /dev/null +++ b/tests/zfs-tests/tests/functional/cli_user/zfs_list/zfs_list_005_neg.ksh @@ -0,0 +1,14 @@ +#!/bin/ksh -p +# SPDX-License-Identifier: 0BSD + +. $STF_SUITE/include/libtest.shlib + +# +# DESCRIPTION: +# zfs list -t used to accept getsubopt(3)-style filesystem=whatever; +# it doesn't anymore +# + +log_mustnot zfs list -t filesystem=getsubopt + +log_pass "'zfs list -t' doesn't accept =getsubopt suffixes."