diff options
author | Brian Behlendorf <[email protected]> | 2018-12-13 12:25:04 -0800 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2019-01-06 10:39:41 -0800 |
commit | 530248d1aab90356968570a44b26c92b7e190b8f (patch) | |
tree | a2f115478d0ffc8998fd9f7c2e337966cf12c0ef | |
parent | 6e72a5b9b61066146deafda39ab8158c559f5f15 (diff) |
arc_summary: consolidate test case
Since we're only installing one version of arc_summary we only
need one test case. Update the test to determine which version
is available and then test its supported flags.
Remove files for misc tests which should have been cleaned up.
Reviewed-by: John Ramsden <[email protected]>
Reviewed-by: Neal Gompa <[email protected]>
Reviewed-by: loli10K <[email protected]>
Signed-off-by: Brian Behlendorf <[email protected]>
Closes #8096
7 files changed, 36 insertions, 72 deletions
diff --git a/scripts/zfs-tests.sh b/scripts/zfs-tests.sh index cc80909ff..f00a28484 100755 --- a/scripts/zfs-tests.sh +++ b/scripts/zfs-tests.sh @@ -247,6 +247,10 @@ constrain_path() { ln -fs "$STF_PATH/gunzip" "$STF_PATH/uncompress" ln -fs "$STF_PATH/exportfs" "$STF_PATH/share" ln -fs "$STF_PATH/exportfs" "$STF_PATH/unshare" + + if [ -L "$STF_PATH/arc_summary3" ]; then + ln -fs "$STF_PATH/arc_summary3" "$STF_PATH/arc_summary" + fi } # diff --git a/tests/runfiles/linux.run b/tests/runfiles/linux.run index f33a91649..4463bfa1e 100644 --- a/tests/runfiles/linux.run +++ b/tests/runfiles/linux.run @@ -477,8 +477,7 @@ tests = ['zdb_001_neg', 'zfs_001_neg', 'zfs_allow_001_neg', 'zpool_offline_001_neg', 'zpool_online_001_neg', 'zpool_remove_001_neg', 'zpool_replace_001_neg', 'zpool_scrub_001_neg', 'zpool_set_001_neg', 'zpool_status_001_neg', 'zpool_upgrade_001_neg', 'arcstat_001_pos', - 'arc_summary_001_pos', 'arc_summary_002_neg', - 'arc_summary3_001_pos', 'dbufstat_001_pos'] + 'arc_summary_001_pos', 'arc_summary_002_neg', 'dbufstat_001_pos'] user = tags = ['functional', 'cli_user', 'misc'] 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 ff7b4906f..29c034290 100644 --- a/tests/zfs-tests/tests/functional/cli_user/misc/Makefile.am +++ b/tests/zfs-tests/tests/functional/cli_user/misc/Makefile.am @@ -46,7 +46,6 @@ dist_pkgdata_SCRIPTS = \ arcstat_001_pos.ksh \ arc_summary_001_pos.ksh \ arc_summary_002_neg.ksh \ - arc_summary3_001_pos.ksh \ dbufstat_001_pos.ksh dist_pkgdata_DATA = \ diff --git a/tests/zfs-tests/tests/functional/cli_user/misc/arc_summary3_001_pos.ksh b/tests/zfs-tests/tests/functional/cli_user/misc/arc_summary3_001_pos.ksh deleted file mode 100755 index ff090baee..000000000 --- a/tests/zfs-tests/tests/functional/cli_user/misc/arc_summary3_001_pos.ksh +++ /dev/null @@ -1,56 +0,0 @@ -#! /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 - -# Keep the following test until Python 3 is installed on all test systems, -# then remove -python3 -V 2>&1 > /dev/null -if (( $? )); then - log_unsupported "Python3 is not installed" -fi - - -# Some systems have Python 3 installed, but only older versions that don't -# have the subprocess.run() functionality. We catch these with a separate -# test. Remove this when all systems have reached 3.5 or greater -VERSIONPYTEST=$(python3 -V) -if [[ ${VERSIONPYTEST:9:1} -lt 5 ]]; then - log_unsupported "Python3 must be version 3.5 or greater" -fi - - -set -A args "" "-a" "-d" "-p 1" "-g" "-s arc" "-r" -log_assert "arc_summary3 generates output and doesn't return an error code" - -typeset -i i=0 -while [[ $i -lt ${#args[*]} ]]; do - log_must eval "arc_summary3 ${args[i]} > /dev/null" - ((i = i + 1)) -done - -log_pass "arc_summary3 generates output and doesn't return an error code" diff --git a/tests/zfs-tests/tests/functional/cli_user/misc/arc_summary_001_pos.ksh b/tests/zfs-tests/tests/functional/cli_user/misc/arc_summary_001_pos.ksh index 8736b18d8..a445fbb48 100755 --- a/tests/zfs-tests/tests/functional/cli_user/misc/arc_summary_001_pos.ksh +++ b/tests/zfs-tests/tests/functional/cli_user/misc/arc_summary_001_pos.ksh @@ -27,14 +27,31 @@ . $STF_SUITE/include/libtest.shlib -set -A args "" "-a" "-d" "-p 1" - log_assert "arc_summary generates output and doesn't return an error code" +# Depending on which version of arc_summary is installed some command +# line options may not be available. The python3 version includes +# several additional flags. +python3 -V 2>&1 > /dev/null +if (( $? )); then + # Some systems have Python 3 installed, but only older versions + # that don't have the subprocess.run() functionality. We catch + # these with a separate test. Remove this when all systems have + # reached 3.5 or greater + VERSIONPYTEST=$(python3 -V) + if [[ ${VERSIONPYTEST:9:1} -lt 5 ]]; then + set -A args "" "-a" "-d" "-p 1" + else + set -A args "" "-a" "-d" "-p 1" "-g" "-s arc" "-r" + fi +else + set -A args "" "-a" "-d" "-p 1" +fi + typeset -i i=0 while [[ $i -lt ${#args[*]} ]]; do - log_must eval "arc_summary ${args[i]} > /dev/null" - ((i = i + 1)) + log_must eval "arc_summary ${args[i]} > /dev/null" + ((i = i + 1)) done log_must eval "arc_summary | head > /dev/null" 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 index 477b7ca08..de747fba8 100755 --- 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 @@ -27,7 +27,7 @@ . $STF_SUITE/include/libtest.shlib -typeset args=("-x" "-r" "-5" "-p 7" "--err" "-@") +typeset args=("-x" "-5" "-p 7" "--err" "-@") log_assert "arc_summary generates an error code with invalid options" diff --git a/tests/zfs-tests/tests/functional/cli_user/misc/cleanup.ksh b/tests/zfs-tests/tests/functional/cli_user/misc/cleanup.ksh index 874a9fd2d..e3dc8c179 100755 --- a/tests/zfs-tests/tests/functional/cli_user/misc/cleanup.ksh +++ b/tests/zfs-tests/tests/functional/cli_user/misc/cleanup.ksh @@ -32,19 +32,20 @@ . $STF_SUITE/include/libtest.shlib . $STF_SUITE/tests/functional/cli_user/misc/misc.cfg -if poolexists $TESTPOOL.virt -then +if poolexists $TESTPOOL.virt; then log_must zpool destroy $TESTPOOL.virt fi -if poolexists v1-pool -then +if poolexists v1-pool; then log_must zpool destroy v1-pool fi -if [[ -f $TEST_BASE_DIR/zfstest_datastream.dat ]] -then - log_must rm -f $TEST_BASE_DIR/zfstest_datastream.dat -fi +log_must rm -f $TEST_BASE_DIR/zfstest_datastream.dat +log_must rm -f $TEST_BASE_DIR/disk1.dat $TEST_BASE_DIR/disk2.dat \ + $TEST_BASE_DIR/disk3.dat $TEST_BASE_DIR/disk-additional.dat \ + $TEST_BASE_DIR/disk-export.dat $TEST_BASE_DIR/disk-offline.dat \ + $TEST_BASE_DIR/disk-spare1.dat $TEST_BASE_DIR/disk-spare2.dat +log_must rm -f $TEST_BASE_DIR/zfs-pool-v1.dat \ + $TEST_BASE_DIR/zfs-pool-v1.dat.bz2 default_cleanup |