ZTS: zfs_list_004_neg should not check paths that belong to ZFS
When ZFS is on root, /tmp is a ZFS. This causes zfs_list_004_neg to fail since `zfs list` on /tmp passes when the test expects it not to. The fix is to exclude paths that belong to ZFS. Reviewed-by: John Kennedy <john.kennedy@delphix.com> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Palash Gandhi <pbg4930@rit.edu> Closes #12744
This commit is contained in:
parent
c23803be84
commit
637771a066
|
@ -116,3 +116,22 @@ function verify_reverse_sort { # command list name
|
||||||
"unexpected number of filesystems found in list output!"
|
"unexpected number of filesystems found in list output!"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function is_fs_type_zfs {
|
||||||
|
|
||||||
|
typeset dirname=$1
|
||||||
|
typeset fs="$(df $dirname | tail -1 | awk '{print $NF}')"
|
||||||
|
|
||||||
|
if is_freebsd; then
|
||||||
|
fs_type=$(mount | awk -v fs=$fs '{if ($3 == fs) print $4}' \
|
||||||
|
| sed -n 's/(\(.*\),/\1/p')
|
||||||
|
elif is_linux; then
|
||||||
|
fs_type=$(mount | awk -v fs=$fs '{if ($3 == fs) print $5}')
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $fs_type == "zfs" ]]; then
|
||||||
|
true
|
||||||
|
else
|
||||||
|
false
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
# Copyright (c) 2013, 2016 by Delphix. All rights reserved.
|
# Copyright (c) 2013, 2016 by Delphix. All rights reserved.
|
||||||
#
|
#
|
||||||
|
|
||||||
. $STF_SUITE/include/libtest.shlib
|
. $STF_SUITE/tests/functional/cli_user/zfs_list/zfs_list.kshlib
|
||||||
|
|
||||||
#
|
#
|
||||||
# DESCRIPTION:
|
# DESCRIPTION:
|
||||||
|
@ -55,8 +55,12 @@ paths="$TESTPOOL/NONEXISTFS $TESTPOOL/$TESTFS/NONEXISTFS \
|
||||||
cd /tmp
|
cd /tmp
|
||||||
|
|
||||||
for fs in $paths ; do
|
for fs in $paths ; do
|
||||||
log_mustnot zfs list $fs
|
# In cases when ZFS is on root, /tmp will belong to ZFS and hence must be
|
||||||
log_mustnot zfs list -r $fs
|
# skipped
|
||||||
|
if ! is_fs_type_zfs $fs; then
|
||||||
|
log_mustnot zfs list $fs
|
||||||
|
log_mustnot zfs list -r $fs
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
log_pass "'zfs list [-r]' fails while the given dataset/path does not exist " \
|
log_pass "'zfs list [-r]' fails while the given dataset/path does not exist " \
|
||||||
|
|
Loading…
Reference in New Issue