tests: validate getsubopt(3) expulsion

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #12996
This commit is contained in:
наб 2022-03-10 20:14:28 +01:00 committed by Brian Behlendorf
parent 77cdc63d09
commit 1c41d8941c
10 changed files with 42 additions and 7 deletions

View File

@ -315,7 +315,7 @@ tests = ['zfs_upgrade_001_pos', 'zfs_upgrade_002_pos', 'zfs_upgrade_003_pos',
tags = ['functional', 'cli_root', 'zfs_upgrade'] tags = ['functional', 'cli_root', 'zfs_upgrade']
[tests/functional/cli_root/zfs_wait] [tests/functional/cli_root/zfs_wait]
tests = ['zfs_wait_deleteq'] tests = ['zfs_wait_deleteq', 'zfs_wait_getsubopt']
tags = ['functional', 'cli_root', 'zfs_wait'] tags = ['functional', 'cli_root', 'zfs_wait']
[tests/functional/cli_root/zhack] [tests/functional/cli_root/zhack]
@ -551,7 +551,8 @@ tags = ['functional', 'cli_user', 'misc']
[tests/functional/cli_user/zfs_list] [tests/functional/cli_user/zfs_list]
tests = ['zfs_list_001_pos', 'zfs_list_002_pos', 'zfs_list_003_pos', 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 = user =
tags = ['functional', 'cli_user', 'zfs_list'] tags = ['functional', 'cli_user', 'zfs_list']

View File

@ -236,7 +236,7 @@ tests = ['zfs_upgrade_001_pos', 'zfs_upgrade_002_pos', 'zfs_upgrade_006_neg',
tags = ['functional', 'cli_root', 'zfs_upgrade'] tags = ['functional', 'cli_root', 'zfs_upgrade']
[tests/functional/cli_root/zfs_wait] [tests/functional/cli_root/zfs_wait]
tests = ['zfs_wait_deleteq'] tests = ['zfs_wait_deleteq', 'zfs_wait_getsubopt']
tags = ['functional', 'cli_root', 'zfs_wait'] tags = ['functional', 'cli_root', 'zfs_wait']
[tests/functional/cli_root/zpool] [tests/functional/cli_root/zpool]

View File

@ -47,7 +47,8 @@ log_assert "Verify 'zfs get all' fails with invalid combination scenarios."
set -f # Force ksh ignore '?' and '*' set -f # Force ksh ignore '?' and '*'
set -A bad_combine "ALL" "\-R all" "-P all" "-h all" "-rph all" "-RpH all" "-PrH all" \ 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" "all -rp" "all -rH" "all -ph" "all -rpH" "all -r $TESTPOOL" \
"all -H $TESTPOOL" "all -p $TESTPOOL" "all -r -p -H $TESTPOOL" \ "all -H $TESTPOOL" "all -p $TESTPOOL" "all -r -p -H $TESTPOOL" \
"all -rph $TESTPOOL" "all,available,reservation $TESTPOOL" \ "all -rph $TESTPOOL" "all,available,reservation $TESTPOOL" \

View File

@ -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" "-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: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 typeset -i i=0
while (( i < ${#badargs[*]} )) while (( i < ${#badargs[*]} ))

View File

@ -2,7 +2,8 @@ pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zfs_wait
dist_pkgdata_SCRIPTS = \ dist_pkgdata_SCRIPTS = \
setup.ksh \ setup.ksh \
cleanup.ksh \ cleanup.ksh \
zfs_wait_deleteq.ksh zfs_wait_deleteq.ksh \
zfs_wait_getsubopt.ksh
dist_pkgdata_DATA = \ dist_pkgdata_DATA = \
zfs_wait.kshlib zfs_wait.kshlib

View File

@ -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."

View File

@ -51,7 +51,8 @@ set -A arguments "$TESTPOOL $TESTPOOL" "$TESTPOOL rubbish" "-v $TESTPOOL" \
"nosuchproperty $TESTPOOL" "--$TESTPOOL" "all all" \ "nosuchproperty $TESTPOOL" "--$TESTPOOL" "all all" \
"type $TESTPOOL" "usage: $TESTPOOL" "bootfs $TESTPOOL@" \ "type $TESTPOOL" "usage: $TESTPOOL" "bootfs $TESTPOOL@" \
"bootfs,bootfs $TESTPOOL" "name $TESTPOOL" "t%d%s" \ "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 for arg in $arguments
do do

View File

@ -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'." log_fail "Error message did not contain phrase 'no such pool'."
zpool wait -t foo $TESTPOOL 2>&1 | grep -i 'invalid activity' || \ zpool wait -t foo $TESTPOOL 2>&1 | grep -i 'invalid activity' || \
log_fail "Error message did not contain phrase '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." log_pass "'zpool wait' behaves sensibly when invoked incorrectly."

View File

@ -6,6 +6,7 @@ dist_pkgdata_SCRIPTS = \
zfs_list_002_pos.ksh \ zfs_list_002_pos.ksh \
zfs_list_003_pos.ksh \ zfs_list_003_pos.ksh \
zfs_list_004_neg.ksh \ zfs_list_004_neg.ksh \
zfs_list_005_neg.ksh \
zfs_list_007_pos.ksh \ zfs_list_007_pos.ksh \
zfs_list_008_neg.ksh zfs_list_008_neg.ksh

View File

@ -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."