diff options
author | LOLi <[email protected]> | 2017-12-19 22:02:40 +0100 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2017-12-19 13:02:40 -0800 |
commit | c4ba46deade0a14d089228a56a5d0aa0ffd5fadd (patch) | |
tree | f0d6393b98cde0d2285569e7852dcea8f4217407 /tests/zfs-tests | |
parent | 2e7c1bb35a9858eff93feaf9132d3d89e756f6e0 (diff) |
Handle invalid options in arc_summary
If an invalid option is provided to arc_summary.py we handle any error
thrown from the getopt Python module and print the usage help message.
Reviewed-by: George Melikov <[email protected]>
Reviewed-by: Giuseppe Di Natale <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: loli10K <[email protected]>
Closes #6983
Diffstat (limited to 'tests/zfs-tests')
-rw-r--r-- | tests/zfs-tests/tests/functional/cli_user/misc/Makefile.am | 1 | ||||
-rwxr-xr-x | tests/zfs-tests/tests/functional/cli_user/misc/arc_summary_002_neg.ksh | 38 |
2 files changed, 39 insertions, 0 deletions
diff --git a/tests/zfs-tests/tests/functional/cli_user/misc/Makefile.am b/tests/zfs-tests/tests/functional/cli_user/misc/Makefile.am index cf7502c27..75a3d0886 100644 --- a/tests/zfs-tests/tests/functional/cli_user/misc/Makefile.am +++ b/tests/zfs-tests/tests/functional/cli_user/misc/Makefile.am @@ -46,4 +46,5 @@ dist_pkgdata_SCRIPTS = \ zpool_upgrade_001_neg.ksh \ arcstat_001_pos.ksh \ arc_summary_001_pos.ksh \ + arc_summary_002_neg.ksh \ dbufstat_001_pos.ksh diff --git a/tests/zfs-tests/tests/functional/cli_user/misc/arc_summary_002_neg.ksh b/tests/zfs-tests/tests/functional/cli_user/misc/arc_summary_002_neg.ksh new file mode 100755 index 000000000..e63552feb --- /dev/null +++ b/tests/zfs-tests/tests/functional/cli_user/misc/arc_summary_002_neg.ksh @@ -0,0 +1,38 @@ +#!/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) 2015 by Lawrence Livermore National Security, LLC. +# All rights reserved. +# + +. $STF_SUITE/include/libtest.shlib + +typeset args=("-x" "-r" "-5" "-p 7" "--err" "-@") + +log_assert "arc_summary.py generates an error code with invalid options" + +for arg in "${args[@]}"; do + log_mustnot eval "arc_summary.py $arg > /dev/null" +done + +log_pass "arc_summary.py generates an error code with invalid options" |