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 <johnramsden@riseup.net>
Reviewed-by: Neal Gompa <ngompa@datto.com>
Reviewed-by: loli10K <ezomori.nozomu@gmail.com>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #8096
This commit is contained in:
Brian Behlendorf 2018-12-13 12:25:04 -08:00
parent 6e72a5b9b6
commit 530248d1aa
7 changed files with 36 additions and 72 deletions

View File

@ -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
}
#

View File

@ -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']

View File

@ -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 = \

View File

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

View File

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

View File

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

View File

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