tests: clean out unused/single-use/useless commands from the list
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: John Kennedy <john.kennedy@delphix.com> Reviewed-by: Ryan Moeller <ryan@iXsystems.com> Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz> Closes #13259
This commit is contained in:
parent
df6e0f0092
commit
caccfc870f
|
@ -291,7 +291,7 @@ User: %s
|
|||
self.result.starttime = monotonic_time()
|
||||
|
||||
if kmemleak:
|
||||
cmd = f'echo clear | {SUDO} tee {KMEMLEAK_FILE}'
|
||||
cmd = f'{SUDO} sh -c "echo clear > {KMEMLEAK_FILE}"'
|
||||
check_output(cmd, shell=True)
|
||||
|
||||
proc = Popen(privcmd, stdout=PIPE, stderr=PIPE)
|
||||
|
@ -305,7 +305,7 @@ User: %s
|
|||
self.result.stdout, self.result.stderr = self.collect_output(proc)
|
||||
|
||||
if kmemleak:
|
||||
cmd = f'echo scan | {SUDO} tee {KMEMLEAK_FILE}'
|
||||
cmd = f'{SUDO} sh -c "echo scan > {KMEMLEAK_FILE}"'
|
||||
check_output(cmd, shell=True)
|
||||
cmd = f'{SUDO} cat {KMEMLEAK_FILE}'
|
||||
self.result.kmemleak = check_output(cmd, shell=True)
|
||||
|
@ -880,7 +880,7 @@ class TestRun(object):
|
|||
self.outputdir, LOG_ERR)
|
||||
|
||||
if options.kmemleak:
|
||||
cmd = f'echo scan=0 | {SUDO} tee {KMEMLEAK_FILE}'
|
||||
cmd = f'{SUDO} -c "echo scan=0 > {KMEMLEAK_FILE}"'
|
||||
check_output(cmd, shell=True)
|
||||
|
||||
iteration = 0
|
||||
|
|
|
@ -8,9 +8,7 @@
|
|||
# Please keep the contents of each variable sorted for ease of reading
|
||||
# and maintenance.
|
||||
#
|
||||
export SYSTEM_FILES_COMMON='arp
|
||||
awk
|
||||
base64
|
||||
export SYSTEM_FILES_COMMON='awk
|
||||
basename
|
||||
bc
|
||||
bunzip2
|
||||
|
@ -52,10 +50,10 @@ export SYSTEM_FILES_COMMON='arp
|
|||
ksh
|
||||
ldd
|
||||
ln
|
||||
logname
|
||||
ls
|
||||
mkdir
|
||||
mknod
|
||||
mkfifo
|
||||
mktemp
|
||||
mount
|
||||
mv
|
||||
|
@ -67,12 +65,9 @@ export SYSTEM_FILES_COMMON='arp
|
|||
pgrep
|
||||
ping
|
||||
pkill
|
||||
printenv
|
||||
printf
|
||||
ps
|
||||
pwd
|
||||
python3
|
||||
quotaon
|
||||
readlink
|
||||
rm
|
||||
rmdir
|
||||
|
@ -88,32 +83,26 @@ export SYSTEM_FILES_COMMON='arp
|
|||
ssh
|
||||
stat
|
||||
strings
|
||||
su
|
||||
sudo
|
||||
swapoff
|
||||
swapon
|
||||
sync
|
||||
tail
|
||||
tar
|
||||
tee
|
||||
timeout
|
||||
touch
|
||||
tr
|
||||
true
|
||||
truncate
|
||||
umask
|
||||
umount
|
||||
uname
|
||||
uniq
|
||||
uuidgen
|
||||
vmstat
|
||||
wait
|
||||
wc'
|
||||
|
||||
export SYSTEM_FILES_FREEBSD='chflags
|
||||
compress
|
||||
diskinfo
|
||||
dumpon
|
||||
fsck
|
||||
getextattr
|
||||
gpart
|
||||
|
@ -123,7 +112,6 @@ export SYSTEM_FILES_FREEBSD='chflags
|
|||
lsextattr
|
||||
md5
|
||||
mdconfig
|
||||
mkfifo
|
||||
newfs
|
||||
pw
|
||||
rmextattr
|
||||
|
@ -135,14 +123,11 @@ export SYSTEM_FILES_FREEBSD='chflags
|
|||
uncompress'
|
||||
|
||||
export SYSTEM_FILES_LINUX='attr
|
||||
bash
|
||||
blkid
|
||||
blockdev
|
||||
chattr
|
||||
dmidecode
|
||||
exportfs
|
||||
fallocate
|
||||
fdisk
|
||||
free
|
||||
getfattr
|
||||
groupadd
|
||||
|
@ -159,16 +144,17 @@ export SYSTEM_FILES_LINUX='attr
|
|||
mkswap
|
||||
modprobe
|
||||
mpstat
|
||||
nproc
|
||||
parted
|
||||
perf
|
||||
setenforce
|
||||
setfattr
|
||||
sha256sum
|
||||
udevadm
|
||||
useradd
|
||||
userdel
|
||||
usermod'
|
||||
usermod
|
||||
|
||||
flock
|
||||
logger'
|
||||
|
||||
export ZFS_FILES='zdb
|
||||
zfs
|
||||
|
|
|
@ -2970,59 +2970,6 @@ function get_device_state #pool disk field("", "spares","logs")
|
|||
($1==field || $1 ~ "^spares$" || $1 ~ "^logs$") {startfield=0}'
|
||||
}
|
||||
|
||||
#
|
||||
# Given a disk, label it to VTOC regardless what label was on the disk
|
||||
# $1 disk
|
||||
#
|
||||
function labelvtoc
|
||||
{
|
||||
typeset disk=$1
|
||||
if [[ -z $disk ]]; then
|
||||
log_fail "The disk name is unspecified."
|
||||
fi
|
||||
typeset label_file=/var/tmp/labelvtoc.$$
|
||||
typeset arch=$(uname -p)
|
||||
|
||||
if is_linux || is_freebsd; then
|
||||
log_note "Currently unsupported by the test framework"
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [[ $arch == "i386" ]]; then
|
||||
echo "label" > $label_file
|
||||
echo "0" >> $label_file
|
||||
echo "" >> $label_file
|
||||
echo "q" >> $label_file
|
||||
echo "q" >> $label_file
|
||||
|
||||
fdisk -B $disk >/dev/null 2>&1
|
||||
# wait a while for fdisk finishes
|
||||
sleep 60
|
||||
elif [[ $arch == "sparc" ]]; then
|
||||
echo "label" > $label_file
|
||||
echo "0" >> $label_file
|
||||
echo "" >> $label_file
|
||||
echo "" >> $label_file
|
||||
echo "" >> $label_file
|
||||
echo "q" >> $label_file
|
||||
else
|
||||
log_fail "unknown arch type"
|
||||
fi
|
||||
|
||||
format -e -s -d $disk -f $label_file
|
||||
typeset -i ret_val=$?
|
||||
rm -f $label_file
|
||||
#
|
||||
# wait the format to finish
|
||||
#
|
||||
sleep 60
|
||||
if ((ret_val != 0)); then
|
||||
log_fail "unable to label $disk as VTOC."
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
#
|
||||
# get the root filesystem name if it's zfsroot system.
|
||||
#
|
||||
|
@ -3077,22 +3024,19 @@ function verify_disk_count
|
|||
function ds_is_volume
|
||||
{
|
||||
typeset type=$(get_prop type $1)
|
||||
[[ $type = "volume" ]] && return 0
|
||||
return 1
|
||||
[ $type = "volume" ]
|
||||
}
|
||||
|
||||
function ds_is_filesystem
|
||||
{
|
||||
typeset type=$(get_prop type $1)
|
||||
[[ $type = "filesystem" ]] && return 0
|
||||
return 1
|
||||
[ $type = "filesystem" ]
|
||||
}
|
||||
|
||||
function ds_is_snapshot
|
||||
{
|
||||
typeset type=$(get_prop type $1)
|
||||
[[ $type = "snapshot" ]] && return 0
|
||||
return 1
|
||||
[ $type = "snapshot" ]
|
||||
}
|
||||
|
||||
#
|
||||
|
@ -3108,7 +3052,7 @@ function is_mp
|
|||
{
|
||||
case $(uname) in
|
||||
Linux)
|
||||
(($(nproc) > 1))
|
||||
(($(grep -c '^processor' /proc/cpuinfo) > 1))
|
||||
;;
|
||||
FreeBSD)
|
||||
sysctl -n kern.smp.cpus
|
||||
|
|
|
@ -145,7 +145,6 @@ function histo_check_test_pool
|
|||
typeset -i this_rs
|
||||
typeset -i this_ri
|
||||
typeset -i sum_filesizes=0
|
||||
typeset dumped
|
||||
typeset stripped
|
||||
|
||||
let histo_check_pool_size=$(get_pool_prop size ${pool})
|
||||
|
@ -157,11 +156,9 @@ function histo_check_test_pool
|
|||
log_fail "hctp: max_pool_record_size is not numeric ${max_pool_record_size}"
|
||||
fi
|
||||
|
||||
dumped="${TEST_BASE_DIR}/${pool}_dump.txt"
|
||||
stripped="${TEST_BASE_DIR}/${pool}_stripped.txt"
|
||||
|
||||
zdb -Pbbb ${pool} | \
|
||||
tee ${dumped} | \
|
||||
sed -e '1,/^block[ ][ ]*psize[ ][ ]*lsize.*$/d' \
|
||||
-e '/^size[ ]*Count/d' -e '/^$/,$d' \
|
||||
> ${stripped}
|
||||
|
|
|
@ -111,11 +111,7 @@ verify_object_class "$MNTPOINT/cdev" "C"
|
|||
|
||||
# 2. | (Named pipe)
|
||||
log_must zfs snapshot "$TESTSNAP1"
|
||||
if is_freebsd; then
|
||||
log_must mkfifo "$MNTPOINT/fifo"
|
||||
else
|
||||
log_must mknod "$MNTPOINT/fifo" p
|
||||
fi
|
||||
log_must zfs snapshot "$TESTSNAP2"
|
||||
verify_object_class "$MNTPOINT/fifo" "|"
|
||||
|
||||
|
|
|
@ -74,7 +74,7 @@ child_pools=""
|
|||
|
||||
function zpool_stress
|
||||
{
|
||||
typeset pool=$1
|
||||
typeset pool="$1-$$"
|
||||
typeset vdev0="$TEST_BASE_DIR/$pool-vdev0.img"
|
||||
typeset vdev1="$TEST_BASE_DIR/$pool-vdev1.img"
|
||||
typeset -i iters=$2
|
||||
|
@ -118,13 +118,11 @@ function zpool_stress
|
|||
# 1. Create 128 process each of which create/destroy a pool 5 times.
|
||||
typeset i=0
|
||||
while [[ $i -lt 128 ]]; do
|
||||
typeset uuid=$(uuidgen | cut -c1-13)
|
||||
|
||||
zpool_stress $TESTPOOL-$uuid 5 &
|
||||
zpool_stress $TESTPOOL-$i 5 &
|
||||
typeset pid=$!
|
||||
|
||||
child_pids="$child_pids $pid"
|
||||
child_pools="$child_pools $TESTPOOL-$uuid"
|
||||
child_pools="$child_pools $TESTPOOL-$i-$pid"
|
||||
((i = i + 1))
|
||||
done
|
||||
|
||||
|
|
|
@ -44,22 +44,15 @@
|
|||
#
|
||||
#
|
||||
|
||||
# check to see if we have zfs allow
|
||||
zfs 2>&1 | grep "allow" > /dev/null
|
||||
if (($? != 0)) then
|
||||
log_unsupported "ZFS allow not supported on this machine."
|
||||
fi
|
||||
|
||||
log_assert "zfs allow returns an error when run as a user"
|
||||
|
||||
log_must zfs allow $TESTPOOL/$TESTFS
|
||||
log_mustnot zfs allow $(logname) create $TESTPOOL/$TESTFS
|
||||
log_mustnot zfs allow $(id -un) create $TESTPOOL/$TESTFS
|
||||
|
||||
# now verify that the above command actually did nothing by
|
||||
# checking for any allow output. ( if no allows are granted,
|
||||
# nothing should be output )
|
||||
OUTPUT=$(zfs allow $TESTPOOL/$TESTFS | grep "Local+Descendent" )
|
||||
if [ -n "$OUTPUT" ]
|
||||
if zfs allow $TESTPOOL/$TESTFS | grep -q "Local+Descendent"
|
||||
then
|
||||
log_fail "zfs allow permissions were granted on $TESTPOOL/$TESTFS"
|
||||
fi
|
||||
|
|
|
@ -58,7 +58,7 @@ BATCH=1000
|
|||
log_must mkdir $TESTDIR/src
|
||||
log_must mkdir $TESTDIR/dst
|
||||
|
||||
WD=$(pwd)
|
||||
WD=$PWD
|
||||
cd $TESTDIR/src
|
||||
# create NR_FILES in BATCH at a time to prevent overflowing argument buffer
|
||||
for i in $(seq $(($NR_FILES/$BATCH))); do touch $(seq $((($i-1)*$BATCH+1)) $(($i*$BATCH))); done
|
||||
|
|
|
@ -69,8 +69,6 @@ function try_pool_import # pool opts message
|
|||
typeset msg=$3
|
||||
|
||||
zpool import $opts $pool 2>&1 | grep -i "$msg"
|
||||
|
||||
return $?
|
||||
}
|
||||
|
||||
function mmp_set_hostid
|
||||
|
@ -79,11 +77,7 @@ function mmp_set_hostid
|
|||
|
||||
zgenhostid $1
|
||||
|
||||
if [ $(hostid) != "$hostid" ]; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
return 0
|
||||
[ $(hostid) = "$hostid" ]
|
||||
}
|
||||
|
||||
function mmp_clear_hostid
|
||||
|
|
|
@ -59,8 +59,8 @@ create_xattr $testfile passwd /etc/passwd
|
|||
|
||||
log_must chmod 000 $testfile
|
||||
if is_illumos; then
|
||||
log_mustnot su $ZFS_USER -c "runat $testfile cat passwd"
|
||||
log_mustnot su $ZFS_USER -c "runat $testfile cp /etc/passwd ."
|
||||
log_mustnot user_run $ZFS_USER runat $testfile cat passwd
|
||||
log_mustnot user_run $ZFS_USER runat $testfile cp /etc/passwd .
|
||||
else
|
||||
log_mustnot user_run $ZFS_USER "
|
||||
. $STF_SUITE/include/libtest.shlib
|
||||
|
|
|
@ -61,6 +61,6 @@ log_mustnot runat $TESTDIR/myfile.$$ mknod block b 888 888
|
|||
|
||||
log_mustnot runat $TESTDIR/myfile.$$ mknod char c
|
||||
|
||||
log_mustnot runat $TESTDIR/myfile.$$ mknod fifo p
|
||||
log_mustnot runat $TESTDIR/myfile.$$ mkfifo fifo
|
||||
|
||||
log_pass "mkdir, mknod fail"
|
||||
|
|
|
@ -254,7 +254,7 @@ function do_collect_scripts
|
|||
# Find a place to deposit performance data collected while under load.
|
||||
function get_perf_output_dir
|
||||
{
|
||||
typeset dir="$(pwd)/perf_data"
|
||||
typeset dir="$PWD/perf_data"
|
||||
[[ -d $dir ]] || mkdir -p $dir
|
||||
|
||||
echo $dir
|
||||
|
@ -467,7 +467,7 @@ function get_system_config
|
|||
|
||||
echo "{" >>$config
|
||||
if is_linux; then
|
||||
echo " \"ncpus\": \"$(nproc --all)\"," >>$config
|
||||
echo " \"ncpus\": \"$(lscpu | awk '/^CPU\(s\)/ {print $2; exit}')\"," >>$config
|
||||
echo " \"physmem\": \"$(free -b | \
|
||||
awk '$1 == "Mem:" { print $2 }')\"," >>$config
|
||||
echo " \"c_max\": \"$(get_max_arc_size)\"," >>$config
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
#!/usr/bin/env bash
|
||||
# shellcheck disable=SC1004
|
||||
#!/bin/sh
|
||||
|
||||
#
|
||||
# This file and its contents are supplied under the terms of the
|
||||
|
@ -21,33 +20,12 @@
|
|||
# TBD if we can add additional kstats to achieve the desired results
|
||||
#
|
||||
|
||||
zfs_kstats="/proc/spl/kstat/zfs"
|
||||
|
||||
function get_prefetch_ios
|
||||
{
|
||||
typeset -l data_misses="$(awk '$1 == "prefetch_data_misses" \
|
||||
{ print $3; exit }' "$zfs_kstats/arcstats")"
|
||||
typeset -l metadata_misses="$(awk '$1 == "prefetch_metadata_misses" \
|
||||
{ print $3; exit }' "$zfs_kstats/arcstats")"
|
||||
typeset -l total_misses=$(( data_misses + metadata_misses ))
|
||||
|
||||
echo "$total_misses"
|
||||
getstat() {
|
||||
awk -v c="$1" '$1 == c {print $3; exit}' /proc/spl/kstat/zfs/arcstats
|
||||
}
|
||||
|
||||
function get_prefetched_demand_reads
|
||||
{
|
||||
typeset -l demand_reads="$(awk '$1 == "demand_hit_predictive_prefetch" \
|
||||
{ print $3; exit }' "$zfs_kstats/arcstats")"
|
||||
|
||||
echo "$demand_reads"
|
||||
}
|
||||
|
||||
function get_async_upgrade_sync
|
||||
{
|
||||
typeset -l sync_wait="$(awk '$1 == "async_upgrade_sync" \
|
||||
{ print $3; exit }' "$zfs_kstats/arcstats")"
|
||||
|
||||
echo "$sync_wait"
|
||||
get_prefetch_ios() {
|
||||
echo $(( $(getstat prefetch_data_misses) + $(getstat prefetch_metadata_misses) ))
|
||||
}
|
||||
|
||||
if [ $# -ne 2 ]
|
||||
|
@ -58,8 +36,8 @@ fi
|
|||
|
||||
interval=$2
|
||||
prefetch_ios=$(get_prefetch_ios)
|
||||
prefetched_demand_reads=$(get_prefetched_demand_reads)
|
||||
async_upgrade_sync=$(get_async_upgrade_sync)
|
||||
prefetched_demand_reads=$(getstat demand_hit_predictive_prefetch)
|
||||
async_upgrade_sync=$(getstat async_upgrade_sync)
|
||||
|
||||
while true
|
||||
do
|
||||
|
@ -68,12 +46,12 @@ do
|
|||
$(( new_prefetch_ios - prefetch_ios ))
|
||||
prefetch_ios=$new_prefetch_ios
|
||||
|
||||
new_prefetched_demand_reads=$(get_prefetched_demand_reads)
|
||||
new_prefetched_demand_reads=$(getstat demand_hit_predictive_prefetch)
|
||||
printf '%-24s\t%u\n' "prefetched_demand_reads" \
|
||||
$(( new_prefetched_demand_reads - prefetched_demand_reads ))
|
||||
prefetched_demand_reads=$new_prefetched_demand_reads
|
||||
|
||||
new_async_upgrade_sync=$(get_async_upgrade_sync)
|
||||
new_async_upgrade_sync=$(getstat async_upgrade_sync)
|
||||
printf '%-24s\t%u\n' "async_upgrade_sync" \
|
||||
$(( new_async_upgrade_sync - async_upgrade_sync ))
|
||||
async_upgrade_sync=$new_async_upgrade_sync
|
||||
|
|
Loading…
Reference in New Issue