mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2025-05-07 17:28:28 +03:00
tests: standardise on no-arg uname with *) case for illumos
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
eebfd28e9d
commit
bf228f3de0
@ -53,7 +53,7 @@ TAGS=""
|
|||||||
ITERATIONS=1
|
ITERATIONS=1
|
||||||
ZFS_DBGMSG="$STF_SUITE/callbacks/zfs_dbgmsg.ksh"
|
ZFS_DBGMSG="$STF_SUITE/callbacks/zfs_dbgmsg.ksh"
|
||||||
ZFS_DMESG="$STF_SUITE/callbacks/zfs_dmesg.ksh"
|
ZFS_DMESG="$STF_SUITE/callbacks/zfs_dmesg.ksh"
|
||||||
UNAME=$(uname -s)
|
UNAME=$(uname)
|
||||||
RERUN=""
|
RERUN=""
|
||||||
KMEMLEAK=""
|
KMEMLEAK=""
|
||||||
|
|
||||||
|
@ -260,7 +260,7 @@ if [ "$(id -u)" != 0 ]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
UNAME=$(uname -s)
|
UNAME=$(uname)
|
||||||
|
|
||||||
if [ "$UNLOAD" = "yes" ]; then
|
if [ "$UNLOAD" = "yes" ]; then
|
||||||
kill_zed
|
kill_zed
|
||||||
|
@ -170,8 +170,8 @@ if [ "@UBSAN_ENABLED@" = "yes" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
case $(uname -o) in
|
case $(uname) in
|
||||||
GNU/Linux)
|
Linux)
|
||||||
unpack_opts="--sparse -xf"
|
unpack_opts="--sparse -xf"
|
||||||
pack_opts="--sparse -cf"
|
pack_opts="--sparse -cf"
|
||||||
verbose=" -v"
|
verbose=" -v"
|
||||||
@ -209,7 +209,7 @@ FreeBSD)
|
|||||||
NEWFS_DEFAULT_FS="ufs"
|
NEWFS_DEFAULT_FS="ufs"
|
||||||
SLICE_PREFIX="p"
|
SLICE_PREFIX="p"
|
||||||
;;
|
;;
|
||||||
illumos)
|
*)
|
||||||
export AUTO_SNAP=$(svcs -a | \
|
export AUTO_SNAP=$(svcs -a | \
|
||||||
awk '/auto-snapshot/ && /online/ { print $3 }')
|
awk '/auto-snapshot/ && /online/ { print $3 }')
|
||||||
# finally, if we're running in a local zone
|
# finally, if we're running in a local zone
|
||||||
|
@ -88,11 +88,7 @@ function linux_version
|
|||||||
|
|
||||||
function is_linux
|
function is_linux
|
||||||
{
|
{
|
||||||
if [[ $(uname -o) == "GNU/Linux" ]]; then
|
[ $(uname) = "Linux" ]
|
||||||
return 0
|
|
||||||
else
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Determine if this is an illumos test system
|
# Determine if this is an illumos test system
|
||||||
@ -100,11 +96,7 @@ function is_linux
|
|||||||
# Return 0 if platform illumos, 1 if otherwise
|
# Return 0 if platform illumos, 1 if otherwise
|
||||||
function is_illumos
|
function is_illumos
|
||||||
{
|
{
|
||||||
if [[ $(uname -o) == "illumos" ]]; then
|
[ $(uname) = "illumos" ]
|
||||||
return 0
|
|
||||||
else
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Determine if this is a FreeBSD test system
|
# Determine if this is a FreeBSD test system
|
||||||
@ -113,11 +105,7 @@ function is_illumos
|
|||||||
|
|
||||||
function is_freebsd
|
function is_freebsd
|
||||||
{
|
{
|
||||||
if [[ $(uname -o) == "FreeBSD" ]]; then
|
[ $(uname) = "FreeBSD" ]
|
||||||
return 0
|
|
||||||
else
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Determine if this is a DilOS test system
|
# Determine if this is a DilOS test system
|
||||||
@ -128,11 +116,7 @@ function is_dilos
|
|||||||
{
|
{
|
||||||
typeset ID=""
|
typeset ID=""
|
||||||
[[ -f /etc/os-release ]] && . /etc/os-release
|
[[ -f /etc/os-release ]] && . /etc/os-release
|
||||||
if [[ $ID == "dilos" ]]; then
|
[ "$ID" = "dilos" ]
|
||||||
return 0
|
|
||||||
else
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Determine if this is a 32-bit system
|
# Determine if this is a 32-bit system
|
||||||
@ -141,11 +125,7 @@ function is_dilos
|
|||||||
|
|
||||||
function is_32bit
|
function is_32bit
|
||||||
{
|
{
|
||||||
if [[ $(getconf LONG_BIT) == "32" ]]; then
|
[ $(getconf LONG_BIT) = "32" ]
|
||||||
return 0
|
|
||||||
else
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Determine if kmemleak is enabled
|
# Determine if kmemleak is enabled
|
||||||
@ -154,11 +134,7 @@ function is_32bit
|
|||||||
|
|
||||||
function is_kmemleak
|
function is_kmemleak
|
||||||
{
|
{
|
||||||
if is_linux && [[ -e /sys/kernel/debug/kmemleak ]]; then
|
is_linux && [ -e /sys/kernel/debug/kmemleak ]
|
||||||
return 0
|
|
||||||
else
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Determine whether a dataset is mounted
|
# Determine whether a dataset is mounted
|
||||||
@ -1487,14 +1463,7 @@ function is_shared_smb
|
|||||||
#
|
#
|
||||||
function not_shared
|
function not_shared
|
||||||
{
|
{
|
||||||
typeset fs=$1
|
! is_shared $1
|
||||||
|
|
||||||
is_shared $fs
|
|
||||||
if (($? == 0)); then
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
return 0
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
@ -1504,14 +1473,7 @@ function not_shared
|
|||||||
#
|
#
|
||||||
function not_shared_smb
|
function not_shared_smb
|
||||||
{
|
{
|
||||||
typeset fs=$1
|
! is_shared_smb $1
|
||||||
|
|
||||||
is_shared_smb $fs
|
|
||||||
if (($? == 0)); then
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
return 0
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
@ -1521,12 +1483,9 @@ function unshare_fs #fs
|
|||||||
{
|
{
|
||||||
typeset fs=$1
|
typeset fs=$1
|
||||||
|
|
||||||
is_shared $fs || is_shared_smb $fs
|
if is_shared $fs || is_shared_smb $fs; then
|
||||||
if (($? == 0)); then
|
|
||||||
zfs unshare $fs || log_fail "zfs unshare $fs failed"
|
zfs unshare $fs || log_fail "zfs unshare $fs failed"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
return 0
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
@ -1536,14 +1495,10 @@ function share_nfs #fs
|
|||||||
{
|
{
|
||||||
typeset fs=$1
|
typeset fs=$1
|
||||||
|
|
||||||
if is_linux; then
|
if ! is_shared $fs; then
|
||||||
is_shared $fs
|
if is_linux; then
|
||||||
if (($? != 0)); then
|
|
||||||
log_must share "*:$fs"
|
log_must share "*:$fs"
|
||||||
fi
|
else
|
||||||
else
|
|
||||||
is_shared $fs
|
|
||||||
if (($? != 0)); then
|
|
||||||
log_must share -F nfs $fs
|
log_must share -F nfs $fs
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
@ -1558,14 +1513,10 @@ function unshare_nfs #fs
|
|||||||
{
|
{
|
||||||
typeset fs=$1
|
typeset fs=$1
|
||||||
|
|
||||||
if is_linux; then
|
if is_shared $fs; then
|
||||||
is_shared $fs
|
if is_linux; then
|
||||||
if (($? == 0)); then
|
|
||||||
log_must unshare -u "*:$fs"
|
log_must unshare -u "*:$fs"
|
||||||
fi
|
else
|
||||||
else
|
|
||||||
is_shared $fs
|
|
||||||
if (($? == 0)); then
|
|
||||||
log_must unshare -F nfs $fs
|
log_must unshare -F nfs $fs
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
@ -1693,10 +1644,7 @@ function is_global_zone
|
|||||||
return 0
|
return 0
|
||||||
else
|
else
|
||||||
typeset cur_zone=$(zonename 2>/dev/null)
|
typeset cur_zone=$(zonename 2>/dev/null)
|
||||||
if [[ $cur_zone != "global" ]]; then
|
[ $cur_zone = "global" ]
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
return 0
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user