]> git.proxmox.com Git - mirror_zfs.git/commitdiff
tests: standardise on no-arg uname with *) case for illumos
authorнаб <nabijaczleweli@nabijaczleweli.xyz>
Thu, 3 Mar 2022 23:09:08 +0000 (00:09 +0100)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Sat, 2 Apr 2022 00:54:52 +0000 (17:54 -0700)
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

scripts/zfs-tests.sh
scripts/zfs.sh
tests/zfs-tests/include/default.cfg.in
tests/zfs-tests/include/libtest.shlib

index 851ff8b74e52366fbd84b05c781400da982dfa67..d82c5923a990d9fa71837cae3d9c3773934103c9 100755 (executable)
@@ -53,7 +53,7 @@ TAGS=""
 ITERATIONS=1
 ZFS_DBGMSG="$STF_SUITE/callbacks/zfs_dbgmsg.ksh"
 ZFS_DMESG="$STF_SUITE/callbacks/zfs_dmesg.ksh"
-UNAME=$(uname -s)
+UNAME=$(uname)
 RERUN=""
 KMEMLEAK=""
 
index 0561092a089fef9fdfdaf006c1ebec4f27f00651..edce2cbd4c64567d394ccdae65595159c8bd4e57 100755 (executable)
@@ -260,7 +260,7 @@ if [ "$(id -u)" != 0 ]; then
        exit 1
 fi
 
-UNAME=$(uname -s)
+UNAME=$(uname)
 
 if [ "$UNLOAD" = "yes" ]; then
        kill_zed
index cf382cfe994c7caa6053cbd890bf320c43ccbe08..a9a17de34ae79cb971a3e0b55d46f94233631589 100644 (file)
@@ -170,8 +170,8 @@ if [ "@UBSAN_ENABLED@" = "yes" ]; then
 fi
 
 
-case $(uname -o) in
-GNU/Linux)
+case $(uname) in
+Linux)
        unpack_opts="--sparse -xf"
        pack_opts="--sparse -cf"
        verbose=" -v"
@@ -209,7 +209,7 @@ FreeBSD)
        NEWFS_DEFAULT_FS="ufs"
        SLICE_PREFIX="p"
        ;;
-illumos)
+*)
        export AUTO_SNAP=$(svcs -a | \
            awk '/auto-snapshot/ && /online/ { print $3 }')
        # finally, if we're running in a local zone
index 3c0cd04c5e0f329bc23036b69ca492a000166d5f..79930bb293e185250e1d0e995c5c514b45e56a00 100644 (file)
@@ -88,11 +88,7 @@ function linux_version
 
 function is_linux
 {
-       if [[ $(uname -o) == "GNU/Linux" ]]; then
-               return 0
-       else
-               return 1
-       fi
+       [ $(uname) = "Linux" ]
 }
 
 # Determine if this is an illumos test system
@@ -100,11 +96,7 @@ function is_linux
 # Return 0 if platform illumos, 1 if otherwise
 function is_illumos
 {
-       if [[ $(uname -o) == "illumos" ]]; then
-               return 0
-       else
-               return 1
-       fi
+       [ $(uname) = "illumos" ]
 }
 
 # Determine if this is a FreeBSD test system
@@ -113,11 +105,7 @@ function is_illumos
 
 function is_freebsd
 {
-       if [[ $(uname -o) == "FreeBSD" ]]; then
-               return 0
-       else
-               return 1
-       fi
+       [ $(uname) = "FreeBSD" ]
 }
 
 # Determine if this is a DilOS test system
@@ -128,11 +116,7 @@ function is_dilos
 {
        typeset ID=""
        [[ -f /etc/os-release ]] && . /etc/os-release
-       if [[ $ID == "dilos" ]]; then
-               return 0
-       else
-               return 1
-       fi
+       [ "$ID" = "dilos" ]
 }
 
 # Determine if this is a 32-bit system
@@ -141,11 +125,7 @@ function is_dilos
 
 function is_32bit
 {
-       if [[ $(getconf LONG_BIT) == "32" ]]; then
-               return 0
-       else
-               return 1
-       fi
+       [ $(getconf LONG_BIT) = "32" ]
 }
 
 # Determine if kmemleak is enabled
@@ -154,11 +134,7 @@ function is_32bit
 
 function is_kmemleak
 {
-       if is_linux && [[ -e /sys/kernel/debug/kmemleak ]]; then
-               return 0
-       else
-               return 1
-       fi
+       is_linux && [ -e /sys/kernel/debug/kmemleak ]
 }
 
 # Determine whether a dataset is mounted
@@ -1487,14 +1463,7 @@ function is_shared_smb
 #
 function not_shared
 {
-       typeset fs=$1
-
-       is_shared $fs
-       if (($? == 0)); then
-               return 1
-       fi
-
-       return 0
+       ! is_shared $1
 }
 
 #
@@ -1504,14 +1473,7 @@ function not_shared
 #
 function not_shared_smb
 {
-       typeset fs=$1
-
-       is_shared_smb $fs
-       if (($? == 0)); then
-               return 1
-       fi
-
-       return 0
+       ! is_shared_smb $1
 }
 
 #
@@ -1521,12 +1483,9 @@ function unshare_fs #fs
 {
        typeset fs=$1
 
-       is_shared $fs || is_shared_smb $fs
-       if (($? == 0)); then
+       if is_shared $fs || is_shared_smb $fs; then
                zfs unshare $fs || log_fail "zfs unshare $fs failed"
        fi
-
-       return 0
 }
 
 #
@@ -1536,14 +1495,10 @@ function share_nfs #fs
 {
        typeset fs=$1
 
-       if is_linux; then
-               is_shared $fs
-               if (($? != 0)); then
+       if ! is_shared $fs; then
+               if is_linux; then
                        log_must share "*:$fs"
-               fi
-       else
-               is_shared $fs
-               if (($? != 0)); then
+               else
                        log_must share -F nfs $fs
                fi
        fi
@@ -1558,14 +1513,10 @@ function unshare_nfs #fs
 {
        typeset fs=$1
 
-       if is_linux; then
-               is_shared $fs
-               if (($? == 0)); then
+       if is_shared $fs; then
+               if is_linux; then
                        log_must unshare -u "*:$fs"
-               fi
-       else
-               is_shared $fs
-               if (($? == 0)); then
+               else
                        log_must unshare -F nfs $fs
                fi
        fi
@@ -1693,10 +1644,7 @@ function is_global_zone
                return 0
        else
                typeset cur_zone=$(zonename 2>/dev/null)
-               if [[ $cur_zone != "global" ]]; then
-                       return 1
-               fi
-               return 0
+               [ $cur_zone = "global" ]
        fi
 }