Permalink
Browse files

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
  • Loading branch information...
behlendorf authored and madwizard committed Dec 13, 2018
1 parent 7d6bee1 commit 98cf00ded28666e089f5b33864ff555f5bb84cce
@@ -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
}

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

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

This file was deleted.

Oops, something went wrong.
@@ -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"
@@ -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"

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

0 comments on commit 98cf00d

Please sign in to comment.