From 251e880c3b5a61355d11d1a253cfa058c9703cea Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Fri, 12 May 2017 13:08:27 -0400 Subject: [PATCH] Enable tests Enable most of the remaining test cases which were previously disabled. The required fixes are as follows: * cache_001_pos - No changes required. * cache_010_neg - Updated to use losetup under Linux. Loopback cache devices are allowed, ZVOLs as cache devices are not. Disabled until all the builders pass reliably. * cachefile_001_pos, cachefile_002_pos, cachefile_003_pos, cachefile_004_pos - Set set_device_dir path in cachefile.cfg, updated CPATH1 and CPATH2 to reference unique files. * zfs_clone_005_pos - Wait for udev to create volumes. * zfs_mount_007_pos - Updated mount options to expected Linux names. * zfs_mount_009_neg, zfs_mount_all_001_pos - No changes required. * zfs_unmount_005_pos, zfs_unmount_009_pos, zfs_unmount_all_001_pos - Updated to expect -f to not unmount busy mount points under Linux. * rsend_019_pos - Observed to occasionally take a long time on both 32-bit systems and the kmemleak builder. * zfs_written_property_001_pos - Switched sync(1) to sync_pool. * devices_001_pos, devices_002_neg - Updated create_dev_file() helper for Linux. * exec_002_neg.ksh - Fixed mmap_exec.c to preserve errno. Updated test case to expect EPERM from Linux as described by mmap(2). * grow_pool_001_pos - Adding missing setup.ksh and cleanup.ksh scripts from OpenZFS. * grow_replicas_001_pos.ksh - Added missing $SLICE_* variables. * history_004_pos, history_006_neg, history_008_pos - Fixed by previous commits and were not enabled. No changes. * zfs_allow_010_pos - Added missing spaces after assorted zfs commands in delegate_common.kshlib. * inuse_* - Illumos dump device tests skipped. Remaining test cases updated to correctly create required partitions. * large_files_001_pos - Fixed largest_file.c to accept EINVAL as well as EFBIG as described in write(2). * largest_pool_001_pos - Skipped until layering pools on zvols is supported. * link_count_001 - Added nproc to required commands. * umountall_001 - Updated to use umount -a. * online_offline_001_* - Pull in OpenZFS change to file_trunc.c to make the '-c 0' option run the test in a loop. Included online_offline.cfg file in all test cases. * rename_dirs_001_pos - Updated to use the rename_dir test binary, pkill restricted to exact matches and total runtime reduced. * slog_013_neg - No changes required. * slog_013_pos.ksh - Updated to use losetup under Linux. * slog_014_pos.ksh - ZED will not be running, manually degrade the damaged vdev as expected. * threadsappend_001_pos, write_dirs_002_pos - No changes required. * nopwrite_varying_compression, nopwrite_volume - Forced pool sync with sync_pool to ensure up to date property values. * Fixed typos in ZED log messages. Refactored zed_* helper functions to resolve all-syslog exit=1 errors in zedlog. * zfs_copies_003_pos, zfs_copies_005_neg, zfs_get_004_pos, clone_001_pos, cache_010_neg.ksh, zpool_add_004_pos, zpool_destroy_001_pos, largest_pool_001_pos - Enable tests which create pools layed on ZVOLs, resolved by PR #6065. * largest_pool_001_pos - Limited to 7eb pool, maximum supported size in 8eb-1 on Linux. * zpool_expand_001_pos, zpool_expand_003_neg - Updated skip reason. * zfs_rollback_001_pos, zfs_rollback_002_pos - Properly cleanup busy mount points under Linux between test loops. * privilege_001_pos, privilege_003_pos - Skip with log_unsupported. * rollback_003_pos, snapshot_016_pos - No changes required. * snapshot_008_pos - Increased LIMIT from 512K to 2M and added sync_pool to avoid false positives. * xattr_* - Updated for Linux and enabled. Signed-off-by: Brian Behlendorf --- cmd/zed/agents/zfs_mod.c | 4 +- cmd/zed/zed_disk_event.c | 2 +- tests/runfiles/linux.run | 230 ++++++---------- tests/zfs-tests/cmd/file_common.h | 8 + tests/zfs-tests/cmd/file_trunc/file_trunc.c | 8 +- .../zfs-tests/cmd/largest_file/largest_file.c | 4 +- tests/zfs-tests/cmd/mmap_exec/mmap_exec.c | 11 +- tests/zfs-tests/include/commands.cfg | 3 + tests/zfs-tests/include/default.cfg | 6 +- tests/zfs-tests/include/libtest.shlib | 107 ++++++-- .../tests/functional/cache/cache_010_neg.ksh | 54 ++-- .../tests/functional/cachefile/Makefile.am | 2 + .../tests/functional/cachefile/cachefile.cfg | 8 +- .../functional/cachefile/cachefile.kshlib | 1 + .../tests/functional/cachefile/cleanup.ksh | 30 +++ .../tests/functional/cachefile/setup.ksh | 46 ++++ .../cli_root/zfs_clone/zfs_clone_005_pos.ksh | 5 +- .../zfs_copies/zfs_copies_005_neg.ksh | 3 +- .../cli_root/zfs_get/zfs_get_006_neg.ksh | 4 + .../cli_root/zfs_mount/zfs_mount_007_pos.ksh | 18 +- .../zfs_written_property_001_pos.ksh | 18 +- .../zfs_rollback/zfs_rollback_001_pos.ksh | 13 +- .../zfs_rollback/zfs_rollback_common.kshlib | 4 +- .../cli_root/zfs_send/zfs_send_005_pos.ksh | 2 +- .../zfs_unmount/zfs_unmount_005_pos.ksh | 6 +- .../zfs_unmount/zfs_unmount_009_pos.ksh | 27 +- .../zfs_unmount/zfs_unmount_all_001_pos.ksh | 4 + .../zfs_unshare/zfs_unshare_002_pos.ksh | 4 + .../zfs_unshare/zfs_unshare_006_pos.ksh | 4 + .../cli_root/zpool_add/zpool_add_004_pos.ksh | 5 - .../zpool_destroy/zpool_destroy_001_pos.ksh | 13 +- .../cli_root/zpool_expand/cleanup.ksh | 3 + .../cli_root/zpool_expand/setup.ksh | 3 + .../zpool_expand/zpool_expand_001_pos.ksh | 5 +- .../zpool_expand/zpool_expand_003_neg.ksh | 5 +- .../cli_user/misc/zfs_share_001_neg.ksh | 4 + .../cli_user/misc/zfs_unshare_001_neg.ksh | 4 + .../delegate/delegate_common.kshlib | 28 +- .../functional/devices/devices_001_pos.ksh | 4 + .../functional/devices/devices_002_neg.ksh | 4 + .../functional/devices/devices_common.kshlib | 22 +- .../tests/functional/exec/exec_001_pos.ksh | 2 +- .../tests/functional/exec/exec_002_neg.ksh | 11 +- .../tests/functional/fault/cleanup.ksh | 4 +- .../tests/functional/fault/fault.cfg | 3 - .../tests/functional/fault/setup.ksh | 16 +- .../tests/functional/grow_pool/Makefile.am | 2 + .../tests/functional/grow_pool/cleanup.ksh | 53 ++++ .../tests/functional/grow_pool/grow_pool.cfg | 3 + .../tests/functional/grow_pool/setup.ksh | 54 ++++ .../grow_replicas/grow_replicas.cfg | 3 + .../grow_replicas/grow_replicas_001_pos.ksh | 4 +- .../tests/functional/inuse/inuse.cfg | 3 +- .../tests/functional/inuse/inuse_001_pos.ksh | 4 + .../tests/functional/inuse/inuse_003_pos.ksh | 8 +- .../tests/functional/inuse/inuse_005_pos.ksh | 13 +- .../tests/functional/inuse/inuse_006_pos.ksh | 9 + .../tests/functional/inuse/inuse_007_pos.ksh | 9 + .../tests/functional/inuse/inuse_008_pos.ksh | 13 +- .../tests/functional/inuse/inuse_009_pos.ksh | 10 +- .../functional/largest_pool/largest_pool.cfg | 2 +- .../largest_pool/largest_pool_001_pos.ksh | 1 + .../functional/link_count/link_count_001.ksh | 4 +- .../tests/functional/mount/umountall_001.ksh | 23 +- .../tests/functional/nopwrite/nopwrite.shlib | 2 +- .../online_offline/online_offline_001_pos.ksh | 26 +- .../online_offline/online_offline_002_neg.ksh | 1 + .../privilege/privilege_001_pos.ksh | 4 + .../privilege/privilege_002_pos.ksh | 4 + .../rename_dirs/rename_dirs_001_pos.ksh | 8 +- .../tests/functional/rsend/rsend_019_pos.ksh | 5 + .../tests/functional/slog/slog_013_pos.ksh | 24 +- .../tests/functional/slog/slog_014_pos.ksh | 2 + .../tests/functional/snapshot/snapshot.cfg | 2 +- .../functional/snapshot/snapshot_008_pos.ksh | 1 + .../functional/snapshot/snapshot_016_pos.ksh | 8 +- .../threadsappend/threadsappend_001_pos.ksh | 7 +- .../tests/functional/xattr/Makefile.am | 1 + .../tests/functional/xattr/cleanup.ksh | 7 +- .../tests/functional/xattr/setup.ksh | 33 +-- .../tests/functional/xattr/xattr.cfg | 30 +++ .../tests/functional/xattr/xattr_001_pos.ksh | 14 +- .../tests/functional/xattr/xattr_002_neg.ksh | 14 +- .../tests/functional/xattr/xattr_003_neg.ksh | 18 +- .../tests/functional/xattr/xattr_004_pos.ksh | 68 +++-- .../tests/functional/xattr/xattr_007_neg.ksh | 21 +- .../tests/functional/xattr/xattr_008_pos.ksh | 4 + .../tests/functional/xattr/xattr_009_neg.ksh | 4 + .../tests/functional/xattr/xattr_010_neg.ksh | 4 + .../tests/functional/xattr/xattr_011_pos.ksh | 251 +++++++++++------- .../tests/functional/xattr/xattr_012_pos.ksh | 10 +- .../tests/functional/xattr/xattr_013_pos.ksh | 32 ++- .../functional/xattr/xattr_common.kshlib | 52 +++- 93 files changed, 1111 insertions(+), 536 deletions(-) create mode 100755 tests/zfs-tests/tests/functional/cachefile/cleanup.ksh create mode 100755 tests/zfs-tests/tests/functional/cachefile/setup.ksh create mode 100755 tests/zfs-tests/tests/functional/grow_pool/cleanup.ksh create mode 100755 tests/zfs-tests/tests/functional/grow_pool/setup.ksh create mode 100644 tests/zfs-tests/tests/functional/xattr/xattr.cfg diff --git a/cmd/zed/agents/zfs_mod.c b/cmd/zed/agents/zfs_mod.c index 8f2f60bbfb94..a906decab406 100644 --- a/cmd/zed/agents/zfs_mod.c +++ b/cmd/zed/agents/zfs_mod.c @@ -763,12 +763,12 @@ zfs_deliver_dle(nvlist_t *nvl) char *devname; if (nvlist_lookup_string(nvl, DEV_PHYS_PATH, &devname) != 0) { - zed_log_msg(LOG_INFO, "zfs_deliver_event: no physpath"); + zed_log_msg(LOG_INFO, "zfs_deliver_dle: no physpath"); return (-1); } if (zpool_iter(g_zfshdl, zfsdle_vdev_online, devname) != 1) { - zed_log_msg(LOG_INFO, "zfs_deliver_event: device '%s' not " + zed_log_msg(LOG_INFO, "zfs_deliver_dle: device '%s' not " "found", devname); return (1); } diff --git a/cmd/zed/zed_disk_event.c b/cmd/zed/zed_disk_event.c index 32eefb2f386c..a778f9a240fe 100644 --- a/cmd/zed/zed_disk_event.c +++ b/cmd/zed/zed_disk_event.c @@ -161,7 +161,7 @@ zed_udev_monitor(void *arg) struct udev_monitor *mon = arg; char *tmp, *tmp2; - zed_log_msg(LOG_INFO, "Waiting for new uduev disk events..."); + zed_log_msg(LOG_INFO, "Waiting for new udev disk events..."); while (1) { struct udev_device *dev; diff --git a/tests/runfiles/linux.run b/tests/runfiles/linux.run index 232fd234fd14..2622502aa4c1 100644 --- a/tests/runfiles/linux.run +++ b/tests/runfiles/linux.run @@ -19,7 +19,7 @@ post_user = root post = cleanup outputdir = /var/tmp/test_results -# DISABLED: update to use ZFS_ACL_* variables and user_run helper. +# Update to use ZFS_ACL_* variables and user_run helper. # posix_001_pos # posix_002_pos [tests/functional/acl/posix] @@ -33,22 +33,15 @@ tests = ['bootfs_001_pos', 'bootfs_002_neg', 'bootfs_003_pos', 'bootfs_004_neg', 'bootfs_005_neg', 'bootfs_006_pos', 'bootfs_007_pos', 'bootfs_008_pos'] -# DISABLED: -# cache_001_pos - needs investigation -# cache_010_neg - needs investigation [tests/functional/cache] -tests = ['cache_002_pos', 'cache_003_pos', 'cache_004_neg', +tests = ['cache_001_pos', 'cache_002_pos', 'cache_003_pos', 'cache_004_neg', 'cache_005_neg', 'cache_006_pos', 'cache_007_neg', 'cache_008_neg', - 'cache_009_pos', 'cache_011_pos'] + 'cache_009_pos', 'cache_010_neg', 'cache_011_pos'] -# DISABLED: needs investigation -#[tests/functional/cachefile] -#tests = ['cachefile_001_pos', 'cachefile_002_pos', 'cachefile_003_pos', -# 'cachefile_004_pos'] -#pre = -#post = +[tests/functional/cachefile] +tests = ['cachefile_001_pos', 'cachefile_002_pos', 'cachefile_003_pos', + 'cachefile_004_pos'] -# DISABLED: needs investigation # 'sensitive_none_lookup', 'sensitive_none_delete', # 'sensitive_formd_lookup', 'sensitive_formd_delete', # 'insensitive_none_lookup', 'insensitive_none_delete', @@ -77,20 +70,15 @@ post = [tests/functional/cli_root/zfs] tests = ['zfs_001_neg', 'zfs_002_pos', 'zfs_003_neg'] -# DISABLED: -# zfs_clone_005_pos - busy unmount [tests/functional/cli_root/zfs_clone] tests = ['zfs_clone_001_neg', 'zfs_clone_002_pos', 'zfs_clone_003_pos', - 'zfs_clone_004_pos', 'zfs_clone_006_pos', + 'zfs_clone_004_pos', 'zfs_clone_005_pos', 'zfs_clone_006_pos', 'zfs_clone_007_pos', 'zfs_clone_008_neg', 'zfs_clone_009_neg', 'zfs_clone_010_pos'] -# DISABLED: -# zfs_copies_003_pos - https://github.com/zfsonlinux/zfs/issues/3484 -# zfs_copies_005_neg - https://github.com/zfsonlinux/zfs/issues/3484 [tests/functional/cli_root/zfs_copies] -tests = ['zfs_copies_001_pos', 'zfs_copies_002_pos', 'zfs_copies_004_neg', - 'zfs_copies_006_pos'] +tests = ['zfs_copies_001_pos', 'zfs_copies_002_pos', 'zfs_copies_003_pos', + 'zfs_copies_004_neg', 'zfs_copies_005_neg', 'zfs_copies_006_pos'] [tests/functional/cli_root/zfs_create] tests = ['zfs_create_001_pos', 'zfs_create_002_pos', 'zfs_create_003_pos', @@ -107,38 +95,29 @@ tests = ['zfs_destroy_001_pos', 'zfs_destroy_002_pos', 'zfs_destroy_003_pos', 'zfs_destroy_013_neg', 'zfs_destroy_014_pos', 'zfs_destroy_015_pos', 'zfs_destroy_016_pos'] -# DISABLED: -# zfs_get_004_pos - https://github.com/zfsonlinux/zfs/issues/3484 -# zfs_get_006_neg - needs investigation [tests/functional/cli_root/zfs_get] tests = ['zfs_get_001_pos', 'zfs_get_002_pos', 'zfs_get_003_pos', - 'zfs_get_005_neg', 'zfs_get_007_neg', 'zfs_get_008_pos', - 'zfs_get_009_pos', 'zfs_get_010_neg'] + 'zfs_get_004_pos', 'zfs_get_005_neg', 'zfs_get_006_neg', 'zfs_get_007_neg', + 'zfs_get_008_pos', 'zfs_get_009_pos', 'zfs_get_010_neg'] [tests/functional/cli_root/zfs_inherit] tests = ['zfs_inherit_001_neg', 'zfs_inherit_002_neg', 'zfs_inherit_003_pos'] -# DISABLED: # zfs_mount_006_pos - https://github.com/zfsonlinux/zfs/issues/4990 -# zfs_mount_007_pos - needs investigation -# zfs_mount_009_neg - needs investigation -# zfs_mount_all_001_pos - needs investigation [tests/functional/cli_root/zfs_mount] tests = ['zfs_mount_001_pos', 'zfs_mount_002_pos', 'zfs_mount_003_pos', - 'zfs_mount_004_pos', 'zfs_mount_005_pos', 'zfs_mount_008_pos', - 'zfs_mount_010_neg', 'zfs_mount_011_neg', 'zfs_mount_012_neg'] + 'zfs_mount_004_pos', 'zfs_mount_005_pos', 'zfs_mount_007_pos', + 'zfs_mount_008_pos', 'zfs_mount_009_neg', 'zfs_mount_010_neg', + 'zfs_mount_011_neg', 'zfs_mount_012_neg', 'zfs_mount_all_001_pos'] [tests/functional/cli_root/zfs_promote] tests = ['zfs_promote_001_pos', 'zfs_promote_002_pos', 'zfs_promote_003_pos', 'zfs_promote_004_pos', 'zfs_promote_005_pos', 'zfs_promote_006_neg', 'zfs_promote_007_neg', 'zfs_promote_008_pos'] -# DISABLED: -# zfs_written_property_001_pos - https://github.com/zfsonlinux/zfs/issues/2441 [tests/functional/cli_root/zfs_property] -tests = [] +tests = ['zfs_written_property_001_pos'] -# DISABLED: # zfs_receive_004_neg - Fails for OpenZFS on illumos [tests/functional/cli_root/zfs_receive] tests = ['zfs_receive_001_pos', 'zfs_receive_002_pos', 'zfs_receive_003_pos', @@ -148,7 +127,6 @@ tests = ['zfs_receive_001_pos', 'zfs_receive_002_pos', 'zfs_receive_003_pos', 'zfs_receive_013_pos', 'zfs_receive_014_pos', 'zfs_receive_015_pos', 'receive-o-x_props_override'] -# DISABLED: # zfs_rename_006_pos - https://github.com/zfsonlinux/zfs/issues/5647 # zfs_rename_009_neg - https://github.com/zfsonlinux/zfs/issues/5648 [tests/functional/cli_root/zfs_rename] @@ -161,11 +139,9 @@ tests = ['zfs_rename_001_pos', 'zfs_rename_002_pos', 'zfs_rename_003_pos', [tests/functional/cli_root/zfs_reservation] tests = ['zfs_reservation_001_pos', 'zfs_reservation_002_pos'] -# DISABLED: -# zfs_rollback_001_pos - busy mountpoint behavior -# zfs_rollback_002_pos - busy mountpoint behavior [tests/functional/cli_root/zfs_rollback] -tests = ['zfs_rollback_003_neg', 'zfs_rollback_004_neg'] +tests = ['zfs_rollback_001_pos', 'zfs_rollback_002_pos', + 'zfs_rollback_003_neg', 'zfs_rollback_004_neg'] [tests/functional/cli_root/zfs_send] tests = ['zfs_send_001_pos', 'zfs_send_002_pos', 'zfs_send_003_pos', @@ -195,21 +171,15 @@ tests = ['zfs_snapshot_001_neg', 'zfs_snapshot_002_neg', 'zfs_snapshot_006_pos', 'zfs_snapshot_007_neg', 'zfs_snapshot_008_neg', 'zfs_snapshot_009_pos'] -# DISABLED: -# zfs_unmount_005_pos - needs investigation -# zfs_unmount_009_pos - needs investigation -# zfs_unmount_all_001_pos - needs investigation [tests/functional/cli_root/zfs_unmount] tests = ['zfs_unmount_001_pos', 'zfs_unmount_002_pos', 'zfs_unmount_003_pos', - 'zfs_unmount_004_pos', 'zfs_unmount_006_pos', - 'zfs_unmount_007_neg', 'zfs_unmount_008_neg'] + 'zfs_unmount_004_pos', 'zfs_unmount_005_pos', 'zfs_unmount_006_pos', + 'zfs_unmount_007_neg', 'zfs_unmount_008_neg', 'zfs_unmount_009_pos', + 'zfs_unmount_all_001_pos'] -# DISABLED: -# zfs_unshare_002_pos - zfs set sharenfs=off won't unshare if it was already off -# zfs_unshare_006_pos - some distros come with Samba "user shares" disabled [tests/functional/cli_root/zfs_unshare] -tests = ['zfs_unshare_001_pos', 'zfs_unshare_003_pos', - 'zfs_unshare_004_neg', 'zfs_unshare_005_neg'] +tests = ['zfs_unshare_001_pos', 'zfs_unshare_002_pos', 'zfs_unshare_003_pos', + 'zfs_unshare_004_neg', 'zfs_unshare_005_neg', 'zfs_unshare_006_pos'] [tests/functional/cli_root/zfs_upgrade] tests = ['zfs_upgrade_001_pos', 'zfs_upgrade_002_pos', 'zfs_upgrade_003_pos', @@ -319,17 +289,14 @@ tests = ['zpool_upgrade_001_pos', 'zpool_upgrade_002_pos', 'zpool_upgrade_007_pos', 'zpool_upgrade_008_pos', 'zpool_upgrade_009_neg'] -# DISABLED: -# zfs_share_001_neg - requires additional dependencies -# zfs_unshare_001_neg - requires additional dependencies [tests/functional/cli_user/misc] tests = ['zdb_001_neg', 'zfs_001_neg', 'zfs_allow_001_neg', 'zfs_clone_001_neg', 'zfs_create_001_neg', 'zfs_destroy_001_neg', 'zfs_get_001_neg', 'zfs_inherit_001_neg', 'zfs_mount_001_neg', 'zfs_promote_001_neg', 'zfs_receive_001_neg', 'zfs_rename_001_neg', 'zfs_rollback_001_neg', 'zfs_send_001_neg', 'zfs_set_001_neg', - 'zfs_snapshot_001_neg', 'zfs_unallow_001_neg', - 'zfs_unmount_001_neg', 'zfs_upgrade_001_neg', + 'zfs_share_001_neg', 'zfs_snapshot_001_neg', 'zfs_unallow_001_neg', + 'zfs_unmount_001_neg', 'zfs_unshare_001_neg', 'zfs_upgrade_001_neg', 'zpool_001_neg', 'zpool_add_001_neg', 'zpool_attach_001_neg', 'zpool_clear_001_neg', 'zpool_create_001_neg', 'zpool_destroy_001_neg', 'zpool_detach_001_neg', 'zpool_export_001_neg', 'zpool_get_001_neg', @@ -362,27 +329,20 @@ tests = ['compress_001_pos', 'compress_002_pos', 'compress_003_pos', [tests/functional/ctime] tests = ['ctime_001_pos' ] -# DISABLED: -# zfs_allow_010_pos - https://github.com/zfsonlinux/zfs/issues/5646 [tests/functional/delegate] tests = ['zfs_allow_001_pos', 'zfs_allow_002_pos', 'zfs_allow_004_pos', 'zfs_allow_005_pos', 'zfs_allow_006_pos', 'zfs_allow_007_pos', 'zfs_allow_008_pos', 'zfs_allow_009_neg', - 'zfs_allow_011_neg', 'zfs_allow_012_neg', + 'zfs_allow_010_pos', 'zfs_allow_011_neg', 'zfs_allow_012_neg', 'zfs_unallow_001_pos', 'zfs_unallow_002_pos', 'zfs_unallow_003_pos', 'zfs_unallow_004_pos', 'zfs_unallow_005_pos', 'zfs_unallow_006_pos', 'zfs_unallow_007_neg', 'zfs_unallow_008_neg'] -# DISABLED: -# devices_001_pos - needs investigation -# devices_002_neg - needs investigation [tests/functional/devices] -tests = ['devices_003_pos'] +tests = ['devices_001_pos', 'devices_002_neg', 'devices_003_pos'] -# DISABLED: -# exec_002_neg - needs investigation [tests/functional/exec] -tests = ['exec_001_pos'] +tests = ['exec_001_pos', 'exec_002_neg'] [tests/functional/fault] tests = ['auto_online_001_pos', 'auto_replace_001_pos'] @@ -395,56 +355,40 @@ tests = ['large_dnode_001_pos', 'large_dnode_002_pos', 'large_dnode_003_pos', 'large_dnode_004_neg', 'large_dnode_005_pos', 'large_dnode_006_pos', 'large_dnode_007_neg'] -# DISABLED: needs investigation -#[tests/functional/grow_pool] -#tests = ['grow_pool_001_pos'] -#pre = -#post = - -# DISABLED: needs investigation -#[tests/functional/grow_replicas] -#tests = ['grow_replicas_001_pos'] -#pre = -#post = - -# DISABLED: -# history_004_pos - https://github.com/zfsonlinux/zfs/issues/5664 -# history_006_neg - https://github.com/zfsonlinux/zfs/issues/5657 -# history_008_pos - https://github.com/zfsonlinux/zfs/issues/5658 +[tests/functional/grow_pool] +tests = ['grow_pool_001_pos'] + +[tests/functional/grow_replicas] +tests = ['grow_replicas_001_pos'] +pre = +post = + [tests/functional/history] tests = ['history_001_pos', 'history_002_pos', 'history_003_pos', - 'history_005_neg', - 'history_007_pos', 'history_009_pos', + 'history_004_pos', 'history_005_neg', 'history_006_neg', + 'history_007_pos', 'history_008_pos', 'history_009_pos', 'history_010_pos'] [tests/functional/inheritance] tests = ['inherit_001_pos'] pre = -# DISABLED: -# inuse_001_pos, inuse_007_pos - no dumpadm command -# inuse_005_pos - partition issue -# inuse_006_pos - partition issue -# inuse_008_pos - partition issue -# inuse_009_pos - partition issue [tests/functional/inuse] -tests = ['inuse_004_pos'] +tests = ['inuse_001_pos', 'inuse_003_pos', 'inuse_004_pos', + 'inuse_005_pos', 'inuse_006_pos', 'inuse_007_pos', 'inuse_008_pos', + 'inuse_009_pos'] post = -# DISABLED: needs investigation -# large_files_001_pos [tests/functional/large_files] -tests = ['large_files_002_pos'] +tests = ['large_files_001_pos', 'large_files_002_pos'] -# DISABLED: needs investigation -#[tests/functional/largest_pool] -#tests = ['largest_pool_001_pos'] -#pre = -#post = +[tests/functional/largest_pool] +tests = ['largest_pool_001_pos'] +pre = +post = -# DISABLED: needs investigation -#[tests/functional/link_count] -#tests = ['link_count_001'] +[tests/functional/link_count] +tests = ['link_count_001'] [tests/functional/migration] tests = ['migration_001_pos', 'migration_002_pos', 'migration_003_pos', @@ -452,15 +396,11 @@ tests = ['migration_001_pos', 'migration_002_pos', 'migration_003_pos', 'migration_007_pos', 'migration_008_pos', 'migration_009_pos', 'migration_010_pos', 'migration_011_pos', 'migration_012_pos'] -# DISABLED: -# mmap_write_001_pos - needs investigation [tests/functional/mmap] -tests = ['mmap_read_001_pos'] +tests = ['mmap_write_001_pos', 'mmap_read_001_pos'] -# DISABLED: -# umountall_001 - requires umountall command. [tests/functional/mount] -tests = ['umount_001'] +tests = ['umount_001', 'umountall_001'] [tests/functional/mv_files] tests = ['mv_files_001_pos', 'mv_files_002_pos'] @@ -471,17 +411,14 @@ tests = ['nestedfs_001_pos'] [tests/functional/no_space] tests = ['enospc_001_pos', 'enospc_002_pos', 'enospc_003_pos'] -# DISABLED: -# nopwrite_volume - https://github.com/zfsonlinux/zfs/issues/5510 -# nopwrite_varying_compression - needs investigation [tests/functional/nopwrite] tests = ['nopwrite_copies', 'nopwrite_mtime', 'nopwrite_negative', - 'nopwrite_promoted_clone', 'nopwrite_recsize', 'nopwrite_sync'] + 'nopwrite_promoted_clone', 'nopwrite_recsize', 'nopwrite_sync', + 'nopwrite_varying_compression', 'nopwrite_volume'] -# DISABLED: needs investigation -#[tests/functional/online_offline] -#tests = ['online_offline_001_pos', 'online_offline_002_neg', -# 'online_offline_003_neg'] +[tests/functional/online_offline] +tests = ['online_offline_001_pos', 'online_offline_002_neg', + 'online_offline_003_neg'] [tests/functional/pool_names] tests = ['pool_names_001_pos', 'pool_names_002_neg'] @@ -491,9 +428,8 @@ post = [tests/functional/poolversion] tests = ['poolversion_001_pos', 'poolversion_002_pos'] -# DISABLED: requires pfexec command or 'RBAC profile' -#[tests/functional/privilege] -#tests = ['privilege_001_pos', 'privilege_002_pos'] +[tests/functional/privilege] +tests = ['privilege_001_pos', 'privilege_002_pos'] [tests/functional/quota] tests = ['quota_001_pos', 'quota_002_pos', 'quota_003_pos', @@ -510,20 +446,17 @@ tests = ['redundancy_001_pos', 'redundancy_002_pos', 'redundancy_003_pos', tests = ['refquota_001_pos', 'refquota_002_pos', 'refquota_003_pos', 'refquota_004_pos', 'refquota_005_pos', 'refquota_006_neg'] -# DISABLED: -# refreserv_004_pos - needs investigation +# refreserv_004_pos - Fails for OpenZFS on illumos [tests/functional/refreserv] tests = ['refreserv_001_pos', 'refreserv_002_pos', 'refreserv_003_pos', 'refreserv_005_pos'] -# DISABLED: -#[tests/functional/rename_dirs] -#tests = ['rename_dirs_001_pos'] +[tests/functional/rename_dirs] +tests = ['rename_dirs_001_pos'] [tests/functional/replacement] tests = ['replacement_001_pos', 'replacement_002_pos', 'replacement_003_pos'] -# DISABLED: # reservation_001_pos - https://github.com/zfsonlinux/zfs/issues/4445 # reservation_013_pos - https://github.com/zfsonlinux/zfs/issues/4444 # reservation_018_pos - https://github.com/zfsonlinux/zfs/issues/5642 @@ -538,7 +471,6 @@ tests = ['reservation_001_pos', 'reservation_002_pos', 'reservation_003_pos', [tests/functional/rootpool] tests = ['rootpool_002_neg', 'rootpool_003_neg', 'rootpool_007_pos'] -# DISABLED: # rsend_008_pos - https://github.com/zfsonlinux/zfs/issues/6066 # rsend_009_pos - https://github.com/zfsonlinux/zfs/issues/5887 [tests/functional/rsend] @@ -559,30 +491,21 @@ tests = ['rsend_001_pos', 'rsend_002_pos', 'rsend_003_pos', 'rsend_004_pos', tests = ['scrub_mirror_001_pos', 'scrub_mirror_002_pos', 'scrub_mirror_003_pos', 'scrub_mirror_004_pos'] -# DISABLED: Scripts need to be updated. -# slog_012_neg - needs investigation -# slog_013_pos - requires 'lofiadm' command. -# slog_014_pos - needs investigation [tests/functional/slog] tests = ['slog_001_pos', 'slog_002_pos', 'slog_003_pos', 'slog_004_pos', 'slog_005_pos', 'slog_006_pos', 'slog_007_pos', 'slog_008_neg', - 'slog_009_neg', 'slog_010_neg', 'slog_011_neg', 'slog_015_pos'] + 'slog_009_neg', 'slog_010_neg', 'slog_011_neg', 'slog_012_neg', + 'slog_013_pos', 'slog_014_pos', 'slog_015_pos'] -# DISABLED: -# clone_001_pos - https://github.com/zfsonlinux/zfs/issues/3484 -# rollback_003_pos - Hangs in unmount and spins. -# snapshot_016_pos - Problem with automount -# snapshot_008_pos - https://github.com/zfsonlinux/zfs/issues/5784 [tests/functional/snapshot] -tests = ['rollback_001_pos', 'rollback_002_pos', - 'snapshot_001_pos', 'snapshot_002_pos', +tests = ['clone_001_pos', 'rollback_001_pos', 'rollback_002_pos', + 'rollback_003_pos', 'snapshot_001_pos', 'snapshot_002_pos', 'snapshot_003_pos', 'snapshot_004_pos', 'snapshot_005_pos', - 'snapshot_006_pos', 'snapshot_007_pos', + 'snapshot_006_pos', 'snapshot_007_pos', 'snapshot_008_pos', 'snapshot_009_pos', 'snapshot_010_pos', 'snapshot_011_pos', 'snapshot_012_pos', 'snapshot_013_pos', 'snapshot_014_pos', - 'snapshot_015_pos', 'snapshot_017_pos'] + 'snapshot_015_pos', 'snapshot_016_pos', 'snapshot_017_pos'] -# DISABLED: # snapused_004_pos - https://github.com/zfsonlinux/zfs/issues/5513 [tests/functional/snapused] tests = ['snapused_001_pos', 'snapused_002_pos', 'snapused_003_pos', @@ -591,9 +514,8 @@ tests = ['snapused_001_pos', 'snapused_002_pos', 'snapused_003_pos', [tests/functional/sparse] tests = ['sparse_001_pos'] -# DISABLED: needs investigation -#[tests/functional/threadsappend] -#tests = ['threadsappend_001_pos'] +[tests/functional/threadsappend] +tests = ['threadsappend_001_pos'] [tests/functional/tmpfile] tests = ['tmpfile_001_pos', 'tmpfile_002_pos', 'tmpfile_003_pos'] @@ -614,23 +536,19 @@ tests = [ 'userspace_001_pos', 'userspace_002_pos', 'userspace_003_pos', 'groupspace_001_pos', 'groupspace_002_pos', 'groupspace_003_pos' ] -# DISABLED: # vdev_zaps_007_pos -- fails due to a pre-existing issue with zpool split [tests/functional/vdev_zaps] tests = ['vdev_zaps_001_pos', 'vdev_zaps_002_pos', 'vdev_zaps_003_pos', 'vdev_zaps_004_pos', 'vdev_zaps_005_pos', 'vdev_zaps_006_pos'] -# DISABLED: -# write_dirs_002_pos - needs investigation [tests/functional/write_dirs] -tests = ['write_dirs_001_pos'] - -# DISABLED: No 'runat' command, replace the Linux equivalent and add xattrtest -#[tests/functional/xattr] -#tests = ['xattr_001_pos', 'xattr_002_neg', 'xattr_003_neg', 'xattr_004_pos', -# 'xattr_005_pos', 'xattr_006_pos', 'xattr_007_neg', 'xattr_008_pos', -# 'xattr_009_neg', 'xattr_010_neg', 'xattr_011_pos', 'xattr_012_pos', -# 'xattr_013_pos'] +tests = ['write_dirs_001_pos', 'write_dirs_002_pos'] + +[tests/functional/xattr] +tests = ['xattr_001_pos', 'xattr_002_neg', 'xattr_003_neg', 'xattr_004_pos', + 'xattr_005_pos', 'xattr_006_pos', 'xattr_007_neg', 'xattr_008_pos', + 'xattr_009_neg', 'xattr_010_neg', 'xattr_011_pos', 'xattr_012_pos', + 'xattr_013_pos'] [tests/functional/zvol/zvol_ENOSPC] tests = ['zvol_ENOSPC_001_pos'] diff --git a/tests/zfs-tests/cmd/file_common.h b/tests/zfs-tests/cmd/file_common.h index 759889e70d82..64b1777a9ae8 100644 --- a/tests/zfs-tests/cmd/file_common.h +++ b/tests/zfs-tests/cmd/file_common.h @@ -37,6 +37,14 @@ extern "C" { #endif +#ifndef _FILE_OFFSET_BITS +#define _FILE_OFFSET_BITS 64 +#endif + +#ifndef _LARGEFILE64_SOURCE +#define _LARGEFILE64_SOURCE +#endif + #include #include #include diff --git a/tests/zfs-tests/cmd/file_trunc/file_trunc.c b/tests/zfs-tests/cmd/file_trunc/file_trunc.c index f9431300beb6..69096752efa2 100644 --- a/tests/zfs-tests/cmd/file_trunc/file_trunc.c +++ b/tests/zfs-tests/cmd/file_trunc/file_trunc.c @@ -25,7 +25,7 @@ */ /* - * Copyright (c) 2012 by Delphix. All rights reserved. + * Copyright (c) 2012, 2014 by Delphix. All rights reserved. */ #include @@ -87,11 +87,9 @@ main(int argc, char *argv[]) exit(3); } - while (i < count) { + for (i = 0; count == 0 || i < count; i++) { (void) do_write(fd); (void) do_trunc(fd); - - i++; } (void) close(fd); @@ -188,7 +186,7 @@ do_write(int fd) exit(5); } - strcpy(buf, "ZFS Test Suite Truncation Test"); + (void) strcpy(buf, "ZFS Test Suite Truncation Test"); if (write(fd, buf, bsize) < bsize) { perror("write"); exit(6); diff --git a/tests/zfs-tests/cmd/largest_file/largest_file.c b/tests/zfs-tests/cmd/largest_file/largest_file.c index 286232da5b19..5e6a1866059b 100644 --- a/tests/zfs-tests/cmd/largest_file/largest_file.c +++ b/tests/zfs-tests/cmd/largest_file/largest_file.c @@ -108,8 +108,8 @@ main(int argc, char **argv) write_ret = write(fd, mybuf, 1); if (write_ret < 0) { - if (errno == EFBIG) { - (void) printf("write errno=EFBIG: success\n"); + if (errno == EFBIG || errno == EINVAL) { + (void) printf("write errno=EFBIG|EINVAL: success\n"); err = 0; } else { err = errno; diff --git a/tests/zfs-tests/cmd/mmap_exec/mmap_exec.c b/tests/zfs-tests/cmd/mmap_exec/mmap_exec.c index 6a48a9c0459e..db90adbdca10 100644 --- a/tests/zfs-tests/cmd/mmap_exec/mmap_exec.c +++ b/tests/zfs-tests/cmd/mmap_exec/mmap_exec.c @@ -38,7 +38,7 @@ int main(int argc, char *argv[]) { - int fd; + int error, fd; struct stat statbuf; if (argc != 2) { @@ -51,18 +51,21 @@ main(int argc, char *argv[]) errno = 0; if ((fd = open(argv[1], O_RDONLY)) < 0) { + error = errno; perror("open"); - return (errno); + return (error); } if (fstat(fd, &statbuf) < 0) { + error = errno; perror("fstat"); - return (errno); + return (error); } if (mmap(0, statbuf.st_size, PROT_EXEC, MAP_SHARED, fd, 0) == MAP_FAILED) { + error = errno; perror("mmap"); - return (errno); + return (error); } return (0); diff --git a/tests/zfs-tests/include/commands.cfg b/tests/zfs-tests/include/commands.cfg index e458f4197511..968ab3cd1a5b 100644 --- a/tests/zfs-tests/include/commands.cfg +++ b/tests/zfs-tests/include/commands.cfg @@ -44,6 +44,7 @@ export SYSTEM_FILES='arp getconf getent getfacl + getfattr grep groupadd groupdel @@ -58,6 +59,7 @@ export SYSTEM_FILES='arp ksh ln logname + losetup ls lsblk lsmod @@ -72,6 +74,7 @@ export SYSTEM_FILES='arp mpstat mv net + nproc openssl parted pax diff --git a/tests/zfs-tests/include/default.cfg b/tests/zfs-tests/include/default.cfg index 4556b2cf6844..84edce7377bc 100644 --- a/tests/zfs-tests/include/default.cfg +++ b/tests/zfs-tests/include/default.cfg @@ -172,7 +172,11 @@ if is_linux; then ZVOL_RDEVDIR="/dev/zvol" DEV_RDSKDIR="/dev" DEV_MPATHDIR="/dev/mapper" + ZEDLET_DIR="/var/tmp/zed" + VDEVID_CONF="$ZEDLET_DIR/vdev_id.conf" + VDEVID_CONF_ETC="/etc/zfs/vdev_id.conf" + NEWFS_DEFAULT_FS="ext2" else @@ -191,4 +195,4 @@ else fi export unpack_opts pack_opts verbose unpack_preserve pack_preserve \ ZVOL_DEVDIR ZVOL_RDEVDIR NEWFS_DEFAULT_FS DEV_RDSKDIR DEV_MPATHDIR \ - ZEDLET_DIR + ZEDLET_DIR VDEVID_CONF VDEVID_CONF_ETC diff --git a/tests/zfs-tests/include/libtest.shlib b/tests/zfs-tests/include/libtest.shlib index 4ad375e9db88..e27058b8e954 100644 --- a/tests/zfs-tests/include/libtest.shlib +++ b/tests/zfs-tests/include/libtest.shlib @@ -750,6 +750,8 @@ function zero_partitions # set_partition $i "" 0mb $diskname done fi + + return 0 } # @@ -3257,32 +3259,84 @@ function wait_replacing #pool done } +# +# Setup custom environment for the ZED. +# +function zed_setup +{ + if ! is_linux; then + return + fi + + if [[ ! -d $ZEDLET_DIR ]]; then + log_must mkdir $ZEDLET_DIR + fi + + if [[ ! -e $VDEVID_CONF ]]; then + log_must touch $VDEVID_CONF + fi + + if [[ -e $VDEVID_CONF_ETC ]]; then + log_fail "Must not have $VDEVID_CONF_ETC file present on system" + fi + + # Create a symlink for /etc/zfs/vdev_id.conf file. + log_must ln -s $VDEVID_CONF $VDEVID_CONF_ETC + + # Setup minimal ZED configuration. Individual test cases should + # add additional ZEDLETs as needed for their specific test. + log_must cp ${ZEDLETDIR}/zed.rc $ZEDLET_DIR + log_must cp ${ZEDLETDIR}/zed-functions.sh $ZEDLET_DIR + log_must cp ${ZEDLETDIR}/all-syslog.sh $ZEDLET_DIR + + log_must zpool events -c +} + +# +# Cleanup custom ZED environment. +# +function zed_cleanup +{ + if ! is_linux; then + return + fi + + log_must rm -f ${ZEDLET_DIR}/zed.rc + log_must rm -f ${ZEDLET_DIR}/zed-functions.sh + log_must rm -f ${ZEDLET_DIR}/all-syslog.sh + log_must rm -f ${ZEDLET_DIR}/zed.pid + log_must rm -f ${ZEDLET_DIR}/zedlog + log_must rm -f ${ZEDLET_DIR}/state + log_must rm -f $VDEVID_CONF_ETC + log_must rm -f $VDEVID_CONF + rmdir $ZEDLET_DIR +} + # # Check if ZED is currently running, if not start ZED. # function zed_start { - if is_linux; then - # ZEDLET_DIR=/var/tmp/zed - if [[ ! -d $ZEDLET_DIR ]]; then - log_must mkdir $ZEDLET_DIR - fi - - # Verify the ZED is not already running. - pgrep -x zed > /dev/null - if (($? == 0)); then - log_fail "ZED already running" - fi + if ! is_linux; then + return + fi - # ZEDLETDIR= - log_must cp ${ZEDLETDIR}/all-syslog.sh $ZEDLET_DIR + # ZEDLET_DIR=/var/tmp/zed + if [[ ! -d $ZEDLET_DIR ]]; then + log_must mkdir $ZEDLET_DIR + fi - log_note "Starting ZED" - # run ZED in the background and redirect foreground logging - # output to zedlog - log_must eval "zed -vF -d $ZEDLET_DIR -p $ZEDLET_DIR/zed.pid" \ - "-s $ZEDLET_DIR/state 2>${ZEDLET_DIR}/zedlog &" + # Verify the ZED is not already running. + pgrep -x zed > /dev/null + if (($? == 0)); then + log_fail "ZED already running" fi + + log_note "Starting ZED" + # run ZED in the background and redirect foreground logging + # output to zedlog + log_must eval "zed -vF -d $ZEDLET_DIR -p $ZEDLET_DIR/zed.pid" \ + "-s $ZEDLET_DIR/state 2>${ZEDLET_DIR}/zedlog &" } # @@ -3290,16 +3344,13 @@ function zed_start # function zed_stop { - if is_linux; then - if [[ -f ${ZEDLET_DIR}/zed.pid ]]; then - zedpid=$(cat ${ZEDLET_DIR}/zed.pid) - log_must kill $zedpid - fi - log_must rm -f ${ZEDLET_DIR}/all-syslog.sh - log_must rm -f ${ZEDLET_DIR}/zed.pid - log_must rm -f ${ZEDLET_DIR}/zedlog - log_must rm -f ${ZEDLET_DIR}/state - log_must rmdir $ZEDLET_DIR + if ! is_linux; then + return + fi + + if [[ -f ${ZEDLET_DIR}/zed.pid ]]; then + zedpid=$(cat ${ZEDLET_DIR}/zed.pid) + log_must kill $zedpid fi } diff --git a/tests/zfs-tests/tests/functional/cache/cache_010_neg.ksh b/tests/zfs-tests/tests/functional/cache/cache_010_neg.ksh index 42fa0ebf66cf..901e182d7d14 100755 --- a/tests/zfs-tests/tests/functional/cache/cache_010_neg.ksh +++ b/tests/zfs-tests/tests/functional/cache/cache_010_neg.ksh @@ -44,11 +44,19 @@ verify_runnable "global" +if is_linux; then + log_unsupported "Test case occasionally fails" +fi + function cleanup_testenv { cleanup if [[ -n $lofidev ]]; then - log_must lofiadm -d $lofidev + if is_linux; then + losetup -d $lofidev + else + lofiadm -d $lofidev + fi fi } @@ -59,32 +67,38 @@ TESTVOL=testvol1$$ dsk1=${DISKS%% *} log_must zpool create $TESTPOOL ${DISKS#$dsk1} -if is_linux; then - SLICE="p1" -else - SLICE="s0" -fi - # Add nomal ${DEV_RDSKDIR} device -log_mustnot zpool add $TESTPOOL cache ${DEV_RDSKDIR}/${dsk1}${SLICE} -#log_must verify_cache_device $TESTPOOL $dsk1 'ONLINE' +log_must zpool add $TESTPOOL cache \ + ${DEV_RDSKDIR}/${dsk1}${SLICE_PREFIX}${SLICE0} +log_must verify_cache_device $TESTPOOL $dsk1 'ONLINE' -# Add nomal file +# Add normal file log_mustnot zpool add $TESTPOOL cache $VDEV2 -# Add /dev/rlofi device -lofidev=${VDEV2%% *} -log_must lofiadm -a $lofidev -lofidev=$(lofiadm $lofidev) -log_mustnot zpool add $TESTPOOL cache "/dev/rlofi/${lofidev#/dev/lofi/}" -if [[ -n $lofidev ]]; then +# Add /dev/rlofi device (allowed under Linux) +if is_linux; then + lofidev=$(losetup -f) + lofidev=${lofidev##*/} + log_must losetup $lofidev ${VDEV2%% *} + log_must zpool add $TESTPOOL cache $lofidev + log_must zpool remove $TESTPOOL $lofidev + log_must losetup -d $lofidev + lofidev="" +else + lofidev=${VDEV2%% *} + log_must lofiadm -a $lofidev + lofidev=$(lofiadm $lofidev) + log_mustnot zpool add $TESTPOOL cache "/dev/rlofi/${lofidev#/dev/lofi/}" log_must lofiadm -d $lofidev lofidev="" fi -# Add ${ZVOL_RDEVDIR} device -log_must zpool create $TESTPOOL2 $VDEV2 -log_must zfs create -V $SIZE $TESTPOOL2/$TESTVOL -log_mustnot zpool add $TESTPOOL cache ${ZVOL_RDEVDIR}/$TESTPOOL2/$TESTVOL +# Add /dev/zvol/rdsk device (allowed under Linux) +if ! is_linux; then + log_must zpool create $TESTPOOL2 $VDEV2 + log_must zfs create -V $SIZE $TESTPOOL2/$TESTVOL + log_mustnot zpool add $TESTPOOL cache \ + ${ZVOL_RDEVDIR}/$TESTPOOL2/$TESTVOL +fi log_pass "Cache device can only be block devices." diff --git a/tests/zfs-tests/tests/functional/cachefile/Makefile.am b/tests/zfs-tests/tests/functional/cachefile/Makefile.am index 4252c70b4217..89d6a9b860a3 100644 --- a/tests/zfs-tests/tests/functional/cachefile/Makefile.am +++ b/tests/zfs-tests/tests/functional/cachefile/Makefile.am @@ -1,5 +1,7 @@ pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cachefile dist_pkgdata_SCRIPTS = \ + cleanup.ksh \ + setup.ksh \ cachefile.cfg \ cachefile.kshlib \ cachefile_001_pos.ksh \ diff --git a/tests/zfs-tests/tests/functional/cachefile/cachefile.cfg b/tests/zfs-tests/tests/functional/cachefile/cachefile.cfg index 13791981c653..d93ec3ed6f3b 100644 --- a/tests/zfs-tests/tests/functional/cachefile/cachefile.cfg +++ b/tests/zfs-tests/tests/functional/cachefile/cachefile.cfg @@ -29,5 +29,9 @@ # export CPATH="/etc/zfs/zpool.cache" -export CPATH1=/var/tmp/cachefile.$$ -export CPATH2=$TEST_BASE_DIR/cachefile.$$ +export CPATH1=$TEST_BASE_DIR/cachefile.1.$$ +export CPATH2=$TEST_BASE_DIR/cachefile.2.$$ + +export DISKSARRAY=$DISKS +export DISK_ARRAY_NUM=$(echo ${DISKS} | nawk '{print NF}') +set_device_dir diff --git a/tests/zfs-tests/tests/functional/cachefile/cachefile.kshlib b/tests/zfs-tests/tests/functional/cachefile/cachefile.kshlib index a88ac59c3a45..b64bcc635fea 100644 --- a/tests/zfs-tests/tests/functional/cachefile/cachefile.kshlib +++ b/tests/zfs-tests/tests/functional/cachefile/cachefile.kshlib @@ -43,5 +43,6 @@ function pool_in_cache { then return 1 fi + log_note "Found pool: $RESULT" return 0 } diff --git a/tests/zfs-tests/tests/functional/cachefile/cleanup.ksh b/tests/zfs-tests/tests/functional/cachefile/cleanup.ksh new file mode 100755 index 000000000000..79cd6e9f908e --- /dev/null +++ b/tests/zfs-tests/tests/functional/cachefile/cleanup.ksh @@ -0,0 +1,30 @@ +#!/bin/ksh -p +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. +# +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +# or http://www.opensolaris.org/os/licensing. +# See the License for the specific language governing permissions +# and limitations under the License. +# +# When distributing Covered Code, include this CDDL HEADER in each +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. +# If applicable, add the following below this CDDL HEADER, with the +# fields enclosed by brackets "[]" replaced with your own identifying +# information: Portions Copyright [yyyy] [name of copyright owner] +# +# CDDL HEADER END +# + +# +# Copyright 2007 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# + +. $STF_SUITE/include/libtest.shlib + +default_cleanup diff --git a/tests/zfs-tests/tests/functional/cachefile/setup.ksh b/tests/zfs-tests/tests/functional/cachefile/setup.ksh new file mode 100755 index 000000000000..47c7893bfdd6 --- /dev/null +++ b/tests/zfs-tests/tests/functional/cachefile/setup.ksh @@ -0,0 +1,46 @@ +#!/bin/ksh -p +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. +# +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +# or http://www.opensolaris.org/os/licensing. +# See the License for the specific language governing permissions +# and limitations under the License. +# +# When distributing Covered Code, include this CDDL HEADER in each +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. +# If applicable, add the following below this CDDL HEADER, with the +# fields enclosed by brackets "[]" replaced with your own identifying +# information: Portions Copyright [yyyy] [name of copyright owner] +# +# CDDL HEADER END +# + +# +# Copyright 2007 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# + +. $STF_SUITE/include/libtest.shlib +. $STF_SUITE/tests/functional/cachefile/cachefile.cfg +. $STF_SUITE/tests/functional/cachefile/cachefile.kshlib + +for pool in "$TESTPOOL" "$TESTPOOL2" "$TESTPOOL3" ; do + if poolexists $pool ; then + destroy_pool $pool + fi +done + +for file in $CPATH1 $CPATH2 ; do + if [[ -f $file ]] ; then + log_must rm $file + fi +done + +if pool_in_cache $TESTPOOL; then + log_unsupported "Skipping test group due to existing pool" +fi diff --git a/tests/zfs-tests/tests/functional/cli_root/zfs_clone/zfs_clone_005_pos.ksh b/tests/zfs-tests/tests/functional/cli_root/zfs_clone/zfs_clone_005_pos.ksh index 879f837a6688..afa8b46a6f7c 100755 --- a/tests/zfs-tests/tests/functional/cli_root/zfs_clone/zfs_clone_005_pos.ksh +++ b/tests/zfs-tests/tests/functional/cli_root/zfs_clone/zfs_clone_005_pos.ksh @@ -61,7 +61,10 @@ log_assert "'zfs clone -o property=value -V size volume' can successfully" \ log_must zfs snapshot $SNAPFS1 typeset -i i=0 while (( $i < ${#RW_VOL_CLONE_PROP[*]} )); do - log_must zfs clone -o ${RW_VOL_CLONE_PROP[$i]} $SNAPFS1 $TESTPOOL/$TESTCLONE + log_must zfs clone -o ${RW_VOL_CLONE_PROP[$i]} $SNAPFS1 \ + $TESTPOOL/$TESTCLONE + block_device_wait + datasetexists $TESTPOOL/$TESTCLONE || \ log_fail "zfs clone $TESTPOOL/$TESTCLONE fail." propertycheck $TESTPOOL/$TESTCLONE ${RW_VOL_CLONE_PROP[i]} || \ diff --git a/tests/zfs-tests/tests/functional/cli_root/zfs_copies/zfs_copies_005_neg.ksh b/tests/zfs-tests/tests/functional/cli_root/zfs_copies/zfs_copies_005_neg.ksh index ae81ae964e7b..8013acff6d62 100755 --- a/tests/zfs-tests/tests/functional/cli_root/zfs_copies/zfs_copies_005_neg.ksh +++ b/tests/zfs-tests/tests/functional/cli_root/zfs_copies/zfs_copies_005_neg.ksh @@ -57,11 +57,12 @@ function cleanup log_assert "Verify that copies cannot be set with pool version 1" log_onexit cleanup -cp $STF_SUITE/tests/functional/cli_root/zpool_upgrade/blockfiles/$ZPOOL_VERSION_1_FILES $TESTDIR +cp $STF_SUITE/tests/functional/cli_root/zpool_upgrade/$ZPOOL_VERSION_1_FILES $TESTDIR bunzip2 $TESTDIR/$ZPOOL_VERSION_1_FILES log_must zpool import -d $TESTDIR $ZPOOL_VERSION_1_NAME log_must zfs create $ZPOOL_VERSION_1_NAME/$TESTFS log_must zfs create -V 1m $ZPOOL_VERSION_1_NAME/$TESTVOL +block_device_wait for val in 3 2 1; do for ds in $ZPOOL_VERSION_1_NAME/$TESTFS $ZPOOL_VERSION_1_NAME/$TESTVOL; do diff --git a/tests/zfs-tests/tests/functional/cli_root/zfs_get/zfs_get_006_neg.ksh b/tests/zfs-tests/tests/functional/cli_root/zfs_get/zfs_get_006_neg.ksh index d006748e55ab..a91685849069 100755 --- a/tests/zfs-tests/tests/functional/cli_root/zfs_get/zfs_get_006_neg.ksh +++ b/tests/zfs-tests/tests/functional/cli_root/zfs_get/zfs_get_006_neg.ksh @@ -53,6 +53,8 @@ set -A bad_combine "ALL" "\-R all" "-P all" "-h all" "-rph all" "-RpH all" "-Pr "all -rph $TESTPOOL" "all,available,reservation $TESTPOOL" \ "all $TESTPOOL?" "all $TESTPOOL*" "all nonexistpool" +export POSIXLY_CORRECT=1 + typeset -i i=0 while (( i < ${#bad_combine[*]} )) do @@ -61,4 +63,6 @@ do (( i = i + 1 )) done +unset POSIXLY_CORRECT + log_pass "'zfs get all' fails with invalid combinations scenarios as expected." diff --git a/tests/zfs-tests/tests/functional/cli_root/zfs_mount/zfs_mount_007_pos.ksh b/tests/zfs-tests/tests/functional/cli_root/zfs_mount/zfs_mount_007_pos.ksh index fe275672e32b..e2ef0bf00db0 100755 --- a/tests/zfs-tests/tests/functional/cli_root/zfs_mount/zfs_mount_007_pos.ksh +++ b/tests/zfs-tests/tests/functional/cli_root/zfs_mount/zfs_mount_007_pos.ksh @@ -76,11 +76,19 @@ function get_reverse_option typeset prop=$2 # Define property value: "reverse if value=on" "reverse if value=off" - set -A values "noatime" "atime" \ - "nodevices" "devices" \ - "noexec" "exec" \ - "rw" "ro" \ - "nosetuid" "setuid" + if is_linux; then + set -A values "noatime" "atime" \ + "nodev" "dev" \ + "noexec" "exec" \ + "rw" "ro" \ + "nosuid" "suid" + else + set -A values "noatime" "atime" \ + "nodevices" "devices" \ + "noexec" "exec" \ + "rw" "ro" \ + "nosetuid" "setuid" + fi typeset -i i=0 while (( i < ${#properties[@]} )); do diff --git a/tests/zfs-tests/tests/functional/cli_root/zfs_property/zfs_written_property_001_pos.ksh b/tests/zfs-tests/tests/functional/cli_root/zfs_property/zfs_written_property_001_pos.ksh index 6d6365ddb001..c74634418a8a 100755 --- a/tests/zfs-tests/tests/functional/cli_root/zfs_property/zfs_written_property_001_pos.ksh +++ b/tests/zfs-tests/tests/functional/cli_root/zfs_property/zfs_written_property_001_pos.ksh @@ -72,8 +72,7 @@ for i in 1 2 3; do log_must zfs snapshot $TESTPOOL/$TESTFS1@snap$i log_must dd if=/dev/urandom of=/$TESTPOOL/$TESTFS1/testfile.$i bs=1M \ count=$blocks - log_must sync - log_must sleep 10 + sync_pool written=$(get_prop written $TESTPOOL/$TESTFS1) ((expected_written=blocks * mb_block)) within_percent $written $expected_written 99.5 || \ @@ -117,8 +116,7 @@ log_note "delete data" before_written=$(get_prop written $TESTPOOL/$TESTFS1) log_must rm /$TESTPOOL/$TESTFS1/testfile.3 snap3_size=0 -log_must sync -log_must sleep 10 +sync_pool written=$(get_prop written $TESTPOOL/$TESTFS1) writtenat3=$(get_prop written@snap3 $TESTPOOL/$TESTFS1) [[ $written -eq $writtenat3 ]] || \ @@ -140,8 +138,7 @@ log_note "write data" blocks=20 log_must dd if=/dev/urandom of=/$TESTPOOL/$TESTFS1/testfile.3 bs=1M \ count=$blocks -log_must sync -log_must sleep 10 +sync_pool written=$(get_prop written $TESTPOOL/$TESTFS1) writtenat1=$(get_prop written@snap1 $TESTPOOL/$TESTFS1) writtenat2=$(get_prop written@snap2 $TESTPOOL/$TESTFS1) @@ -177,8 +174,7 @@ typeset -l snap_before_written2=$(get_prop_mb written $TESTPOOL/$TESTFS1@snap2) typeset -l snap_before_written3=$(get_prop_mb written $TESTPOOL/$TESTFS1@snap3) log_must zfs destroy $TESTPOOL/$TESTFS1@snap2 log_mustnot snapexists $TESTPOOL/$TESTFS1@snap2 -log_must sync -log_must sleep 10 +sync_pool written1=$(get_prop_mb written@snap1 $TESTPOOL/$TESTFS1) written3=$(get_prop_mb written@snap3 $TESTPOOL/$TESTFS1) [[ $before_written1 -eq $written1 && $before_written3 -eq $written3 ]] || \ @@ -204,8 +200,7 @@ for ds in $datasets; do [[ $writtenat -ne 0 ]] && \ log_fail "Unexpected written@ value" log_must dd if=/dev/urandom of=/$ds/testfile bs=1M count=$blocks - log_must sync - log_must sleep 10 + sync_pool writtenat=$(get_prop written@now $ds) ((expected_writtenat = blocks * mb_block)) within_percent $writtenat $expected_writtenat 0.1 || \ @@ -219,8 +214,7 @@ for ds in $datasets; do log_must zfs snapshot $ds@current log_must dd if=/dev/urandom of=/$ds/testfile bs=1M \ count=$blocks - log_must sync - log_must sleep 10 + sync_pool done recursive_output=$(zfs get -r written@current $TESTPOOL | \ grep -v $TESTFS1@ | grep -v $TESTFS2@ | grep -v $TESTFS3@ | \ diff --git a/tests/zfs-tests/tests/functional/cli_root/zfs_rollback/zfs_rollback_001_pos.ksh b/tests/zfs-tests/tests/functional/cli_root/zfs_rollback/zfs_rollback_001_pos.ksh index 90e7b8340a03..5511f6ad6db6 100755 --- a/tests/zfs-tests/tests/functional/cli_root/zfs_rollback/zfs_rollback_001_pos.ksh +++ b/tests/zfs-tests/tests/functional/cli_root/zfs_rollback/zfs_rollback_001_pos.ksh @@ -72,10 +72,15 @@ function test_n_check #opt num_snap_clone num_rollback log_fail "Unsupported testing condition." # Clean up the test environment + if pgrep -x dd 2>/dev/null; then + pkill -x dd + fi + datasetexists $FS && log_must zfs destroy -Rf $FS if datasetexists $VOL; then - df -lhF ufs "$ZVOL_DEVDIR/$VOL" > /dev/null 2>&1 - (( $? == 0 )) && log_must umount -f $TESTDIR1 + if ismounted $TESTDIR1 $NEWFS_DEFAULT_FS; then + log_must umount -f $TESTDIR1 + fi log_must zfs destroy -Rf $VOL fi @@ -117,7 +122,9 @@ function test_n_check #opt num_snap_clone num_rollback fi if [[ $dtst == $VOL ]]; then - log_must umount -f $TESTDIR1 + if ismounted $TESTDIR1 $NEWFS_DEFAULT_FS; then + log_must umount -f $TESTDIR1 + fi log_must zfs rollback $opt $dtst@$snap_point log_must mount \ $ZVOL_DEVDIR/$TESTPOOL/$TESTVOL $TESTDIR1 diff --git a/tests/zfs-tests/tests/functional/cli_root/zfs_rollback/zfs_rollback_common.kshlib b/tests/zfs-tests/tests/functional/cli_root/zfs_rollback/zfs_rollback_common.kshlib index 8f79113dcf8e..5d5aeed63eac 100644 --- a/tests/zfs-tests/tests/functional/cli_root/zfs_rollback/zfs_rollback_common.kshlib +++ b/tests/zfs-tests/tests/functional/cli_root/zfs_rollback/zfs_rollback_common.kshlib @@ -83,7 +83,7 @@ function setup_snap_env # Make sure the ufs|ext2 filesystem hasn't been mounted, # then mount the new ufs|ext2 filesystem. - if ! ismounted "$ZVOL_DEVDIR/$VOL" $NEWFS_DEFAULT_FS; then + if ! ismounted $TESTDIR1 $NEWFS_DEFAULT_FS; then log_must mount \ $ZVOL_DEVDIR/$TESTPOOL/$TESTVOL $TESTDIR1 fi @@ -157,7 +157,7 @@ function cleanup_env typeset dtst typeset snap - pkill ${DD##*/} + pkill -x dd if ismounted $TESTDIR1 $NEWFS_DEFAULT_FS; then log_must umount -f $TESTDIR1 diff --git a/tests/zfs-tests/tests/functional/cli_root/zfs_send/zfs_send_005_pos.ksh b/tests/zfs-tests/tests/functional/cli_root/zfs_send/zfs_send_005_pos.ksh index f24ce7f922ca..9f369e372dee 100755 --- a/tests/zfs-tests/tests/functional/cli_root/zfs_send/zfs_send_005_pos.ksh +++ b/tests/zfs-tests/tests/functional/cli_root/zfs_send/zfs_send_005_pos.ksh @@ -46,7 +46,7 @@ verify_runnable "both" function cleanup { - poolexists $TESTPOOL && log_must zpool export $TESTPOOL + poolexists $TESTPOOL && log_must_busy zpool export $TESTPOOL log_must zpool import $TESTPOOL datasetexists $TESTPOOL@snap && \ diff --git a/tests/zfs-tests/tests/functional/cli_root/zfs_unmount/zfs_unmount_005_pos.ksh b/tests/zfs-tests/tests/functional/cli_root/zfs_unmount/zfs_unmount_005_pos.ksh index e21a2954d0c6..eaea4696dfb4 100755 --- a/tests/zfs-tests/tests/functional/cli_root/zfs_unmount/zfs_unmount_005_pos.ksh +++ b/tests/zfs-tests/tests/functional/cli_root/zfs_unmount/zfs_unmount_005_pos.ksh @@ -101,7 +101,11 @@ typeset -i i=0 while (( i < ${#options[*]} )); do if [[ ${options[i]} == "-f" ]]; then - do_unmount_multiple "${options[i]}" + if is_linux; then + do_unmount_multiple "${options[i]}" 1 + else + do_unmount_multiple "${options[i]}" + fi else do_unmount_multiple "${options[i]}" 1 fi diff --git a/tests/zfs-tests/tests/functional/cli_root/zfs_unmount/zfs_unmount_009_pos.ksh b/tests/zfs-tests/tests/functional/cli_root/zfs_unmount/zfs_unmount_009_pos.ksh index b1d98e68bc4f..0ed14a99fc27 100755 --- a/tests/zfs-tests/tests/functional/cli_root/zfs_unmount/zfs_unmount_009_pos.ksh +++ b/tests/zfs-tests/tests/functional/cli_root/zfs_unmount/zfs_unmount_009_pos.ksh @@ -96,8 +96,13 @@ for fs in $TESTPOOL/$TESTFS $TESTPOOL ; do log_must cd .zfs/snapshot/$TESTSNAP log_mustnot zfs unmount -a - log_must zfs unmount -fa - log_mustnot ls + if is_linux; then + log_mustnot zfs unmount -fa + log_must ls + else + log_must zfs unmount -fa + log_mustnot ls + fi log_must cd / log_must zfs mount -a @@ -105,8 +110,13 @@ for fs in $TESTPOOL/$TESTFS $TESTPOOL ; do log_must cd .zfs/snapshot/$TESTSNAP if is_global_zone || [[ $fs != $TESTPOOL ]] ; then - log_must zfs destroy -rf $fs - log_mustnot ls + if is_linux; then + log_mustnot zfs destroy -rf $fs + log_must ls + else + log_must zfs destroy -rf $fs + log_mustnot ls + fi log_must cd / fi @@ -114,8 +124,13 @@ for fs in $TESTPOOL/$TESTFS $TESTPOOL ; do done if is_global_zone ; then - log_must zpool destroy -f $TESTPOOL - log_mustnot ls + if is_linux; then + log_mustnot zpool destroy -f $TESTPOOL + log_must ls + else + log_must zpool destroy -f $TESTPOOL + log_mustnot ls + fi log_must cd / fi diff --git a/tests/zfs-tests/tests/functional/cli_root/zfs_unmount/zfs_unmount_all_001_pos.ksh b/tests/zfs-tests/tests/functional/cli_root/zfs_unmount/zfs_unmount_all_001_pos.ksh index b1be2093eda8..b5a01b53aeab 100755 --- a/tests/zfs-tests/tests/functional/cli_root/zfs_unmount/zfs_unmount_all_001_pos.ksh +++ b/tests/zfs-tests/tests/functional/cli_root/zfs_unmount/zfs_unmount_all_001_pos.ksh @@ -181,6 +181,10 @@ for opt in "-a" "-fa"; do fi export __ZFS_POOL_RESTRICT="$TESTPOOL" + if [[ $opt == "-fa" ]] && is_linux; then + log_mustnot zfs unmount $opt + cd /tmp + fi log_must zfs unmount $opt unset __ZFS_POOL_RESTRICT diff --git a/tests/zfs-tests/tests/functional/cli_root/zfs_unshare/zfs_unshare_002_pos.ksh b/tests/zfs-tests/tests/functional/cli_root/zfs_unshare/zfs_unshare_002_pos.ksh index 1620c0bd7161..6a9c72311c74 100755 --- a/tests/zfs-tests/tests/functional/cli_root/zfs_unshare/zfs_unshare_002_pos.ksh +++ b/tests/zfs-tests/tests/functional/cli_root/zfs_unshare/zfs_unshare_002_pos.ksh @@ -44,6 +44,10 @@ verify_runnable "global" +if is_linux; then + log_unsupported "zfs set sharenfs=off won't unshare if already off" +fi + function cleanup { typeset -i i=0 diff --git a/tests/zfs-tests/tests/functional/cli_root/zfs_unshare/zfs_unshare_006_pos.ksh b/tests/zfs-tests/tests/functional/cli_root/zfs_unshare/zfs_unshare_006_pos.ksh index a6ff2010234d..b4318020cc7f 100755 --- a/tests/zfs-tests/tests/functional/cli_root/zfs_unshare/zfs_unshare_006_pos.ksh +++ b/tests/zfs-tests/tests/functional/cli_root/zfs_unshare/zfs_unshare_006_pos.ksh @@ -41,6 +41,10 @@ verify_runnable "global" +if is_linux; then + log_unsupported "some distros come with Samba "user shares" disabled" +fi + function cleanup { log_must zfs unshare -a diff --git a/tests/zfs-tests/tests/functional/cli_root/zpool_add/zpool_add_004_pos.ksh b/tests/zfs-tests/tests/functional/cli_root/zpool_add/zpool_add_004_pos.ksh index 7b6a029dc9d8..61ce4ec69c13 100755 --- a/tests/zfs-tests/tests/functional/cli_root/zpool_add/zpool_add_004_pos.ksh +++ b/tests/zfs-tests/tests/functional/cli_root/zpool_add/zpool_add_004_pos.ksh @@ -45,11 +45,6 @@ verify_runnable "global" -# See issue: https://github.com/zfsonlinux/zfs/issues/6065 -if is_linux; then - log_unsupported "Creating a pool containing a zvol may deadlock" -fi - function cleanup { poolexists $TESTPOOL && \ diff --git a/tests/zfs-tests/tests/functional/cli_root/zpool_destroy/zpool_destroy_001_pos.ksh b/tests/zfs-tests/tests/functional/cli_root/zpool_destroy/zpool_destroy_001_pos.ksh index 428765e2ebdd..2d9ec7821118 100755 --- a/tests/zfs-tests/tests/functional/cli_root/zpool_destroy/zpool_destroy_001_pos.ksh +++ b/tests/zfs-tests/tests/functional/cli_root/zpool_destroy/zpool_destroy_001_pos.ksh @@ -72,15 +72,10 @@ log_onexit cleanup partition_disk $SLICE_SIZE $DISK 2 create_pool "$TESTPOOL" "${DISK}${SLICE_PREFIX}${SLICE0}" - -if is_linux; then - # Layering a pool on a zvol can deadlock and isn't supported. - create_pool "$TESTPOOL2" "${DISK}${SLICE_PREFIX}${SLICE1}" -else - create_pool "$TESTPOOL1" "${DISK}${SLICE_PREFIX}${SLICE1}" - log_must zfs create -s -V $VOLSIZE $TESTPOOL1/$TESTVOL - create_pool "$TESTPOOL2" "${ZVOL_DEVDIR}/$TESTPOOL1/$TESTVOL" -fi +create_pool "$TESTPOOL1" "${DISK}${SLICE_PREFIX}${SLICE1}" +log_must zfs create -s -V $VOLSIZE $TESTPOOL1/$TESTVOL +block_device_wait +create_pool "$TESTPOOL2" "${ZVOL_DEVDIR}/$TESTPOOL1/$TESTVOL" typeset -i i=0 while (( i < ${#datasets[*]} )); do diff --git a/tests/zfs-tests/tests/functional/cli_root/zpool_expand/cleanup.ksh b/tests/zfs-tests/tests/functional/cli_root/zpool_expand/cleanup.ksh index d00826bb276f..059c3839050b 100755 --- a/tests/zfs-tests/tests/functional/cli_root/zpool_expand/cleanup.ksh +++ b/tests/zfs-tests/tests/functional/cli_root/zpool_expand/cleanup.ksh @@ -29,4 +29,7 @@ verify_runnable "global" +zed_stop +zed_cleanup + default_cleanup diff --git a/tests/zfs-tests/tests/functional/cli_root/zpool_expand/setup.ksh b/tests/zfs-tests/tests/functional/cli_root/zpool_expand/setup.ksh index 2069e97017eb..7d6a43ef5280 100755 --- a/tests/zfs-tests/tests/functional/cli_root/zpool_expand/setup.ksh +++ b/tests/zfs-tests/tests/functional/cli_root/zpool_expand/setup.ksh @@ -29,6 +29,9 @@ verify_runnable "global" +zed_setup +zed_start + DISK=${DISKS%% *} default_setup $DISK diff --git a/tests/zfs-tests/tests/functional/cli_root/zpool_expand/zpool_expand_001_pos.ksh b/tests/zfs-tests/tests/functional/cli_root/zpool_expand/zpool_expand_001_pos.ksh index 8cdef954e538..7d0f32b9e269 100755 --- a/tests/zfs-tests/tests/functional/cli_root/zpool_expand/zpool_expand_001_pos.ksh +++ b/tests/zfs-tests/tests/functional/cli_root/zpool_expand/zpool_expand_001_pos.ksh @@ -48,9 +48,9 @@ verify_runnable "global" -# See issue: https://github.com/zfsonlinux/zfs/issues/6065 +# See issue: https://github.com/zfsonlinux/zfs/issues/5771 if is_linux; then - log_unsupported "Creating a pool containing a zvol may deadlock" + log_unsupported "Requires additional ZED support" fi function cleanup @@ -73,6 +73,7 @@ log_assert "zpool can be autoexpanded after set autoexpand=on on LUN expansion" for i in 1 2 3; do log_must zfs create -V $org_size $VFS/vol$i done +block_device_wait for type in " " mirror raidz raidz2; do diff --git a/tests/zfs-tests/tests/functional/cli_root/zpool_expand/zpool_expand_003_neg.ksh b/tests/zfs-tests/tests/functional/cli_root/zpool_expand/zpool_expand_003_neg.ksh index 002b07cee004..0134db3496a0 100755 --- a/tests/zfs-tests/tests/functional/cli_root/zpool_expand/zpool_expand_003_neg.ksh +++ b/tests/zfs-tests/tests/functional/cli_root/zpool_expand/zpool_expand_003_neg.ksh @@ -48,9 +48,9 @@ verify_runnable "global" -# See issue: https://github.com/zfsonlinux/zfs/issues/6065 +# See issue: https://github.com/zfsonlinux/zfs/issues/5771 if is_linux; then - log_unsupported "Creating a pool containing a zvol may deadlock" + log_unsupported "Requires additional ZED support" fi function cleanup @@ -73,6 +73,7 @@ log_assert "zpool can not expand if set autoexpand=off after LUN expansion" for i in 1 2 3; do log_must zfs create -V $org_size $VFS/vol$i done +block_device_wait for type in " " mirror raidz raidz2; do log_must zpool create $TESTPOOL1 $type ${ZVOL_DEVDIR}/$VFS/vol1 \ diff --git a/tests/zfs-tests/tests/functional/cli_user/misc/zfs_share_001_neg.ksh b/tests/zfs-tests/tests/functional/cli_user/misc/zfs_share_001_neg.ksh index 1cc1783c8abb..3f120c2438f7 100755 --- a/tests/zfs-tests/tests/functional/cli_user/misc/zfs_share_001_neg.ksh +++ b/tests/zfs-tests/tests/functional/cli_user/misc/zfs_share_001_neg.ksh @@ -45,6 +45,10 @@ verify_runnable "global" +if is_linux; then + log_unsupported "Requires additional dependencies" +fi + log_assert "zfs share returns an error when run as a user" if is_shared $TESTDIR/unshared diff --git a/tests/zfs-tests/tests/functional/cli_user/misc/zfs_unshare_001_neg.ksh b/tests/zfs-tests/tests/functional/cli_user/misc/zfs_unshare_001_neg.ksh index 48d4d5294e73..72ed1f5d3e9f 100755 --- a/tests/zfs-tests/tests/functional/cli_user/misc/zfs_unshare_001_neg.ksh +++ b/tests/zfs-tests/tests/functional/cli_user/misc/zfs_unshare_001_neg.ksh @@ -45,6 +45,10 @@ verify_runnable "global" +if is_linux; then + log_unsupported "Requires additional dependencies" +fi + log_assert "zfs unshare returns an error when run as a user" # verify that the filesystem was shared initially diff --git a/tests/zfs-tests/tests/functional/delegate/delegate_common.kshlib b/tests/zfs-tests/tests/functional/delegate/delegate_common.kshlib index 8e6bd46a2761..8dd601850884 100644 --- a/tests/zfs-tests/tests/functional/delegate/delegate_common.kshlib +++ b/tests/zfs-tests/tests/functional/delegate/delegate_common.kshlib @@ -431,7 +431,7 @@ function verify_fs_receive log_must zfs snapshot $dtstsnap log_must eval "zfs send $dtstsnap > $bak_root" - log_must zfs destroy -rf $dtst + log_must_busy zfs destroy -rf $dtst user_run $user eval "zfs receive $dtst < $bak_root" if datasetexists $dtstsnap ; then @@ -461,10 +461,10 @@ function verify_fs_receive # check the data integrity log_must eval "zfs send $dtstsnap > $bak_user" - log_must zfs destroy -rf $dtst + log_must_busy zfs destroy -rf $dtst log_must eval "zfs receive $dtst < $bak_root" log_must eval "zfs send $dtstsnap > $bak_root" - log_must zfs destroy -rf $dtst + log_must_busy zfs destroy -rf $dtst if [[ $(checksum $bak_user) != $(checksum $bak_root) ]]; then return 1 fi @@ -612,26 +612,26 @@ function verify_fs_create return 1 fi - log_must zfsallow $user mount $fs - user_run $user zfscreate -V 150m $newvol + log_must zfs allow $user mount $fs + user_run $user zfs create -V 150m $newvol block_device_wait - log_must zfsunallow $user mount $fs + log_must zfs unallow $user mount $fs if datasetexists $newvol ; then return 1 fi - log_must zfsallow $user reservation $fs - user_run $user zfscreate -V 150m $newvol + log_must zfs allow $user reservation $fs + user_run $user zfs create -V 150m $newvol block_device_wait - log_must zfsunallow $user reservation $fs + log_must zfs unallow $user reservation $fs if datasetexists $newvol ; then return 1 fi - log_must zfsallow $user refreservation $fs - user_run $user zfscreate -V 150m $newvol + log_must zfs allow $user refreservation $fs + user_run $user zfs create -V 150m $newvol block_device_wait - log_must zfsunallow $user refreservation $fs + log_must zfs unallow $user refreservation $fs if datasetexists $newvol ; then return 1 fi @@ -648,7 +648,7 @@ function verify_fs_create fi block_device_wait - log_must zfsdestroy $newvol + log_must zfs destroy $newvol block_device_wait fi @@ -1123,7 +1123,7 @@ function verify_fs_dnodesize typeset fs=$3 value="2k" - user_run $user zfsset dnodesize=$value $fs + user_run $user zfs set dnodesize=$value $fs if [[ $value != $(get_prop dnodesize $fs) ]]; then return 1 fi diff --git a/tests/zfs-tests/tests/functional/devices/devices_001_pos.ksh b/tests/zfs-tests/tests/functional/devices/devices_001_pos.ksh index ac031ed6a52f..c02aa2d9fbd9 100755 --- a/tests/zfs-tests/tests/functional/devices/devices_001_pos.ksh +++ b/tests/zfs-tests/tests/functional/devices/devices_001_pos.ksh @@ -48,6 +48,10 @@ verify_runnable "global" +if is_32bit; then + log_unsupported "Test case fails on 32-bit systems" +fi + log_assert "Setting devices=on on file system, the devices files in this file" \ "system can be used." log_onexit cleanup diff --git a/tests/zfs-tests/tests/functional/devices/devices_002_neg.ksh b/tests/zfs-tests/tests/functional/devices/devices_002_neg.ksh index ce25502b818b..1a645cc3ccf0 100755 --- a/tests/zfs-tests/tests/functional/devices/devices_002_neg.ksh +++ b/tests/zfs-tests/tests/functional/devices/devices_002_neg.ksh @@ -48,6 +48,10 @@ verify_runnable "global" +if is_32bit; then + log_unsupported "Test case fails on 32-bit systems" +fi + log_assert "Setting devices=off on file system, the devices files in this file"\ "system can not be used." log_onexit cleanup diff --git a/tests/zfs-tests/tests/functional/devices/devices_common.kshlib b/tests/zfs-tests/tests/functional/devices/devices_common.kshlib index fe575eed8b21..2c7df8d058c3 100644 --- a/tests/zfs-tests/tests/functional/devices/devices_common.kshlib +++ b/tests/zfs-tests/tests/functional/devices/devices_common.kshlib @@ -45,10 +45,15 @@ function create_dev_file case $filetype in b) if is_linux; then - devtype=$(df -T / | awk '{print $2}') - else - devtype=$(df -n / | awk '{print $3}') + major=$(awk '/[hsv]d/ { print $1; exit }' \ + /proc/partitions) + minor=$(awk '/[hsv]d/ { print $2; exit }' \ + /proc/partitions) + log_must mknod $filename b $major $minor + return 0 fi + + devtype=$(df -n / | awk '{print $3}') case $devtype in zfs) rootpool=$(df / | \ @@ -76,9 +81,6 @@ function create_dev_file [[ -z $devstr ]] && \ log_fail "Can not get block device file." ;; - ext2) - # TODO: Linux version - ;; *) log_unsupported "Unsupported fstype " \ "for / ($devtype)," \ @@ -106,7 +108,13 @@ function create_dev_file # # Create device file '/dev/null' # - log_must mknod $filename c $(getmajor mm) 2 + if is_linux; then + major=$(stat -c %t /dev/null) + minor=$(stat -c %T /dev/null) + log_must mknod $filename c $major $minor + else + log_must mknod $filename c $(getmajor mm) 2 + fi ;; *) log_fail "'$filetype' is wrong." diff --git a/tests/zfs-tests/tests/functional/exec/exec_001_pos.ksh b/tests/zfs-tests/tests/functional/exec/exec_001_pos.ksh index d76a265e2472..5de8a79ea30f 100755 --- a/tests/zfs-tests/tests/functional/exec/exec_001_pos.ksh +++ b/tests/zfs-tests/tests/functional/exec/exec_001_pos.ksh @@ -58,6 +58,6 @@ log_onexit cleanup log_must cp $STF_PATH/ls $TESTDIR/myls log_must zfs set exec=on $TESTPOOL/$TESTFS log_must $TESTDIR/myls -log_must $MMAP_EXEC $TESTDIR/myls +log_must mmap_exec $TESTDIR/myls log_pass "Setting exec=on on filesystem testing passed." diff --git a/tests/zfs-tests/tests/functional/exec/exec_002_neg.ksh b/tests/zfs-tests/tests/functional/exec/exec_002_neg.ksh index eaf2d0b62d88..c11bf8442bcd 100755 --- a/tests/zfs-tests/tests/functional/exec/exec_002_neg.ksh +++ b/tests/zfs-tests/tests/functional/exec/exec_002_neg.ksh @@ -75,10 +75,15 @@ log_assert "Setting exec=off on a filesystem, processes can not be executed " \ "from this file system." log_onexit cleanup -log_must cp /usr/bin/ls $TESTDIR/myls +log_must cp $STF_PATH/ls $TESTDIR/myls log_must zfs set exec=off $TESTPOOL/$TESTFS -log_must exec_n_check 126 $TESTDIR/myls -log_must exec_n_check 13 $MMAP_EXEC $TESTDIR/myls +if is_linux; then + log_must exec_n_check 126 $TESTDIR/myls + log_must exec_n_check 1 mmap_exec $TESTDIR/myls # EPERM +else + log_must exec_n_check 126 $TESTDIR/myls + log_must exec_n_check 13 mmap_exec $TESTDIR/myls # EACCES +fi log_pass "Setting exec=off on filesystem testing passed." diff --git a/tests/zfs-tests/tests/functional/fault/cleanup.ksh b/tests/zfs-tests/tests/functional/fault/cleanup.ksh index 88bf5e28a75a..f39f05d6fe8e 100755 --- a/tests/zfs-tests/tests/functional/fault/cleanup.ksh +++ b/tests/zfs-tests/tests/functional/fault/cleanup.ksh @@ -30,10 +30,8 @@ verify_runnable "global" cleanup_devices $DISKS -# Remove symlink and vdev_id.conf in-tree file -rm -f $VDEVID_CONF_ETC -rm -f $VDEVID_CONF zed_stop +zed_cleanup SD=$(lsscsi | nawk '/scsi_debug/ {print $6; exit}') SDDEVICE=$(echo $SD | nawk -F / '{print $3}') diff --git a/tests/zfs-tests/tests/functional/fault/fault.cfg b/tests/zfs-tests/tests/functional/fault/fault.cfg index 6a05b8cc4977..e6e4fe58266d 100644 --- a/tests/zfs-tests/tests/functional/fault/fault.cfg +++ b/tests/zfs-tests/tests/functional/fault/fault.cfg @@ -41,9 +41,6 @@ export DISK1=$(echo $DISKS | nawk '{print $1}') export DISK2=$(echo $DISKS | nawk '{print $2}') export DISK3=$(echo $DISKS | nawk '{print $3}') -export VDEVID_CONF=$ZEDLET_DIR/vdev_id.conf -export VDEVID_CONF_ETC=/etc/zfs/vdev_id.conf - if is_linux; then set_slice_prefix set_device_dir diff --git a/tests/zfs-tests/tests/functional/fault/setup.ksh b/tests/zfs-tests/tests/functional/fault/setup.ksh index 2b9fb61c0eca..3d54d4f21754 100755 --- a/tests/zfs-tests/tests/functional/fault/setup.ksh +++ b/tests/zfs-tests/tests/functional/fault/setup.ksh @@ -28,21 +28,7 @@ verify_runnable "global" -if [[ ! -d $ZEDLET_DIR ]]; then - log_must mkdir $ZEDLET_DIR -fi - -if [[ ! -e $VDEVID_CONF ]]; then - log_must touch $VDEVID_CONF -fi - -if [[ -e $VDEVID_CONF_ETC ]]; then - log_fail "Must not have $VDEVID_CONF_ETC file present on system" -fi - -# Create a symlink for /etc/zfs/vdev_id.conf file -log_must ln -s $VDEVID_CONF $VDEVID_CONF_ETC - +zed_setup zed_start # Create a scsi_debug device to be used with auto-online (if using loop devices) diff --git a/tests/zfs-tests/tests/functional/grow_pool/Makefile.am b/tests/zfs-tests/tests/functional/grow_pool/Makefile.am index 4fc98ffc3c44..cdad61757f4a 100644 --- a/tests/zfs-tests/tests/functional/grow_pool/Makefile.am +++ b/tests/zfs-tests/tests/functional/grow_pool/Makefile.am @@ -1,4 +1,6 @@ pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/grow_pool dist_pkgdata_SCRIPTS = \ + setup.ksh \ + cleanup.ksh \ grow_pool.cfg \ grow_pool_001_pos.ksh diff --git a/tests/zfs-tests/tests/functional/grow_pool/cleanup.ksh b/tests/zfs-tests/tests/functional/grow_pool/cleanup.ksh new file mode 100755 index 000000000000..91cf6757f0b3 --- /dev/null +++ b/tests/zfs-tests/tests/functional/grow_pool/cleanup.ksh @@ -0,0 +1,53 @@ +#!/bin/ksh -p +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. +# +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +# or http://www.opensolaris.org/os/licensing. +# See the License for the specific language governing permissions +# and limitations under the License. +# +# When distributing Covered Code, include this CDDL HEADER in each +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. +# If applicable, add the following below this CDDL HEADER, with the +# fields enclosed by brackets "[]" replaced with your own identifying +# information: Portions Copyright [yyyy] [name of copyright owner] +# +# CDDL HEADER END +# + +# +# Copyright 2009 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# + +# +# Copyright (c) 2013, 2016 by Delphix. All rights reserved. +# + +. $STF_SUITE/include/libtest.shlib +. $STF_SUITE/tests/functional/grow_pool/grow_pool.cfg + +verify_runnable "global" + +ismounted $TESTFS && \ + log_must zfs umount $TESTDIR +destroy_pool "$TESTPOOL" + +# +# Here we create & destroy a zpool using the disks +# because this resets the partitions to normal +# +if [[ -z $DISK ]]; then + create_pool ZZZ "$DISK0 $DISK1" + destroy_pool ZZZ +else + create_pool ZZZ "$DISK" + destroy_pool ZZZ +fi + +log_pass diff --git a/tests/zfs-tests/tests/functional/grow_pool/grow_pool.cfg b/tests/zfs-tests/tests/functional/grow_pool/grow_pool.cfg index 8b0563201c7a..082472301b43 100644 --- a/tests/zfs-tests/tests/functional/grow_pool/grow_pool.cfg +++ b/tests/zfs-tests/tests/functional/grow_pool/grow_pool.cfg @@ -30,6 +30,9 @@ . $STF_SUITE/include/libtest.shlib +export DISKSARRAY=$DISKS +export DISK_ARRAY_NUM=$(echo ${DISKS} | nawk '{print NF}') + function set_disks { set -A disk_array $(find_disks $DISKS) diff --git a/tests/zfs-tests/tests/functional/grow_pool/setup.ksh b/tests/zfs-tests/tests/functional/grow_pool/setup.ksh new file mode 100755 index 000000000000..4c1257915d7f --- /dev/null +++ b/tests/zfs-tests/tests/functional/grow_pool/setup.ksh @@ -0,0 +1,54 @@ +#!/bin/ksh -p +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. +# +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +# or http://www.opensolaris.org/os/licensing. +# See the License for the specific language governing permissions +# and limitations under the License. +# +# When distributing Covered Code, include this CDDL HEADER in each +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. +# If applicable, add the following below this CDDL HEADER, with the +# fields enclosed by brackets "[]" replaced with your own identifying +# information: Portions Copyright [yyyy] [name of copyright owner] +# +# CDDL HEADER END +# + +# +# Copyright 2009 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# + +# +# Copyright (c) 2013 by Delphix. All rights reserved. +# + +. $STF_SUITE/include/libtest.shlib +. $STF_SUITE/tests/functional/grow_pool/grow_pool.cfg + +verify_runnable "global" + +if ! $(is_physical_device $DISKS) ; then + log_unsupported "This directory cannot be run on raw files." +fi + +if [[ -n $DISK ]]; then + log_note "No spare disks available. Using slices on $DISK" + for i in $SLICE0 $SLICE1 ; do + log_must set_partition $i "$cyl" $SIZE $DISK + cyl=$(get_endslice $DISK $i) + done + tmp=$DISK"s"$SLICE0 +else + log_must set_partition $SLICE "" $SIZE $DISK0 + log_must set_partition $SLICE "" $SIZE $DISK1 + tmp=$DISK0$SLICE_PREFIX$SLICE +fi + +default_setup $tmp diff --git a/tests/zfs-tests/tests/functional/grow_replicas/grow_replicas.cfg b/tests/zfs-tests/tests/functional/grow_replicas/grow_replicas.cfg index ebf322602110..fd94555baf3e 100644 --- a/tests/zfs-tests/tests/functional/grow_replicas/grow_replicas.cfg +++ b/tests/zfs-tests/tests/functional/grow_replicas/grow_replicas.cfg @@ -31,6 +31,9 @@ . $STF_SUITE/include/libtest.shlib +export DISKSARRAY=$DISKS +export DISK_ARRAY_NUM=$(echo ${DISKS} | nawk '{print NF}') + function set_disks { set -A disk_array $(find_disks $DISKS) diff --git a/tests/zfs-tests/tests/functional/grow_replicas/grow_replicas_001_pos.ksh b/tests/zfs-tests/tests/functional/grow_replicas/grow_replicas_001_pos.ksh index 6a5b9d9f96f9..53b8113ec489 100755 --- a/tests/zfs-tests/tests/functional/grow_replicas/grow_replicas_001_pos.ksh +++ b/tests/zfs-tests/tests/functional/grow_replicas/grow_replicas_001_pos.ksh @@ -96,7 +96,9 @@ for pooltype in "mirror" "raidz"; do # $DISK will be set if we're using slices on one disk if [[ -n $DISK ]]; then - log_must zpool add $TESTPOOL $pooltype ${DISK}s3 ${DISK}s4 + log_must zpool add $TESTPOOL $pooltype \ + ${DISK}${SLICE_PREFIX}${SLICE3} \ + ${DISK}${SLICE_PREFIX}${SLICE4} else [[ -z $DISK2 || -z $DISK3 ]] && log_unsupported "No spare disks available" diff --git a/tests/zfs-tests/tests/functional/inuse/inuse.cfg b/tests/zfs-tests/tests/functional/inuse/inuse.cfg index a0891fde19ca..bbc32f1f108d 100644 --- a/tests/zfs-tests/tests/functional/inuse/inuse.cfg +++ b/tests/zfs-tests/tests/functional/inuse/inuse.cfg @@ -31,7 +31,8 @@ . $STF_SUITE/include/libtest.shlib if is_linux; then - DISK_ARRAY_NUM=2 + export DISKSARRAY=$DISKS + export DISK_ARRAY_NUM=$(echo ${DISKS} | nawk '{print NF}') set_device_dir set_slice_prefix export SLICE0=1 diff --git a/tests/zfs-tests/tests/functional/inuse/inuse_001_pos.ksh b/tests/zfs-tests/tests/functional/inuse/inuse_001_pos.ksh index 4ba57c3627a7..63c68e66e4e4 100755 --- a/tests/zfs-tests/tests/functional/inuse/inuse_001_pos.ksh +++ b/tests/zfs-tests/tests/functional/inuse/inuse_001_pos.ksh @@ -43,6 +43,10 @@ verify_runnable "global" +if is_linux; then + log_unsupported "Test case isn't applicable to Linux" +fi + function cleanup { # diff --git a/tests/zfs-tests/tests/functional/inuse/inuse_003_pos.ksh b/tests/zfs-tests/tests/functional/inuse/inuse_003_pos.ksh index 932955b4fb10..bdd79d9c4c4f 100755 --- a/tests/zfs-tests/tests/functional/inuse/inuse_003_pos.ksh +++ b/tests/zfs-tests/tests/functional/inuse/inuse_003_pos.ksh @@ -50,6 +50,10 @@ verify_runnable "global" +if is_linux; then + log_unsupported "Test case isn't applicable to Linux" +fi + function cleanup { poolexists $TESTPOOL1 && destroy_pool $TESTPOOL1 @@ -94,12 +98,14 @@ typeset restored_files="${UFSMP}/restored_files" typeset -i dirnum=0 typeset -i filenum=0 typeset cwd="" +typeset cyl="" for num in 0 1 2; do eval typeset slice=\${FS_SIDE$num} disk=${slice%s*} slice=${slice##*${SLICE_PREFIX}} - log_must set_partition $slice "" $FS_SIZE $disk + log_must set_partition $slice "$cyl" $FS_SIZE $disk + cyl=$(get_endslice $disk $slice) done log_note "Make a ufs filesystem on source $rawdisk1" diff --git a/tests/zfs-tests/tests/functional/inuse/inuse_005_pos.ksh b/tests/zfs-tests/tests/functional/inuse/inuse_005_pos.ksh index 04fa30b27216..9dd1e25bf408 100755 --- a/tests/zfs-tests/tests/functional/inuse/inuse_005_pos.ksh +++ b/tests/zfs-tests/tests/functional/inuse/inuse_005_pos.ksh @@ -44,6 +44,10 @@ verify_runnable "global" +if ! is_physical_device $FS_DISK0; then + log_unsupported "This directory cannot be run on raw files." +fi + function cleanup { poolexists $TESTPOOL1 && destroy_pool $TESTPOOL1 @@ -79,11 +83,18 @@ typeset -i i=0 unset NOINUSE_CHECK while (( i < ${#vdevs[*]} )); do + for num in 0 1 2 3 ; do + eval typeset disk=\${FS_DISK$num} + zero_partitions $disk + done + + typeset cyl="" for num in 0 1 2 3 ; do eval typeset slice=\${FS_SIDE$num} disk=${slice%${SLICE_PREFIX}*} slice=${slice##*${SLICE_PREFIX}} - log_must set_partition $slice "" $FS_SIZE $disk + log_must set_partition $slice "$cyl" $FS_SIZE $disk + cyl=$(get_endslice $disk $slice) done if [[ -n $SINGLE_DISK && -n ${vdevs[i]} ]]; then diff --git a/tests/zfs-tests/tests/functional/inuse/inuse_006_pos.ksh b/tests/zfs-tests/tests/functional/inuse/inuse_006_pos.ksh index 6d2e88d91d50..0ce45a661c59 100755 --- a/tests/zfs-tests/tests/functional/inuse/inuse_006_pos.ksh +++ b/tests/zfs-tests/tests/functional/inuse/inuse_006_pos.ksh @@ -44,6 +44,10 @@ verify_runnable "global" +if is_linux; then + log_unsupported "Test case isn't applicable to Linux" +fi + function cleanup { if [[ -n $PREVDUMPDEV ]]; then @@ -82,6 +86,11 @@ PREVDUMPDEV=`dumpadm | grep "Dump device" | awk '{print $3}'` unset NOINUSE_CHECK while (( i < ${#vdevs[*]} )); do + for num in 0 1 2 3 ; do + eval typeset disk=\${FS_DISK$num} + zero_partitions $disk + done + for num in 0 1 2 3 ; do eval typeset slice=\${FS_SIDE$num} disk=${slice%${SLICE_PREFIX}*} diff --git a/tests/zfs-tests/tests/functional/inuse/inuse_007_pos.ksh b/tests/zfs-tests/tests/functional/inuse/inuse_007_pos.ksh index d4c6d0a0b2f0..22ac064ef3e5 100755 --- a/tests/zfs-tests/tests/functional/inuse/inuse_007_pos.ksh +++ b/tests/zfs-tests/tests/functional/inuse/inuse_007_pos.ksh @@ -45,6 +45,10 @@ verify_runnable "global" +if is_linux; then + log_unsupported "Test case isn't applicable to Linux" +fi + function cleanup { if [[ -n $PREVDUMPDEV ]]; then @@ -86,6 +90,11 @@ PREVDUMPDEV=`dumpadm | grep "Dump device" | awk '{print $3}'` while (( i < ${#vdevs[*]} )); do + for num in 0 1 2 3 ; do + eval typeset disk=\${FS_DISK$num} + zero_partitions $disk + done + for num in 0 1 2 3 ; do eval typeset slice=\${FS_SIDE$num} disk=${slice%${SLICE_PREFIX}*} diff --git a/tests/zfs-tests/tests/functional/inuse/inuse_008_pos.ksh b/tests/zfs-tests/tests/functional/inuse/inuse_008_pos.ksh index 5144054a976a..95d39d958c3f 100755 --- a/tests/zfs-tests/tests/functional/inuse/inuse_008_pos.ksh +++ b/tests/zfs-tests/tests/functional/inuse/inuse_008_pos.ksh @@ -45,6 +45,10 @@ verify_runnable "global" +if ! is_physical_device $FS_DISK0; then + log_unsupported "This directory cannot be run on raw files." +fi + function cleanup { poolexists $TESTPOOL1 || zpool import $TESTPOOL1 >/dev/null 2>&1 @@ -78,12 +82,19 @@ log_onexit cleanup set -A vdevs "" "mirror" "raidz" "raidz1" "raidz2" typeset -i i=0 +typeset cyl="" + +for num in 0 1 2 3 ; do + eval typeset disk=\${FS_DISK$num} + zero_partitions $disk +done for num in 0 1 2 3 ; do eval typeset slice=\${FS_SIDE$num} disk=${slice%${SLICE_PREFIX}*} slice=${slice##*${SLICE_PREFIX}} - log_must set_partition $slice "" $FS_SIZE $disk + log_must set_partition $slice "$cyl" $FS_SIZE $disk + cyl=$(get_endslice $disk $slice) done while (( i < ${#vdevs[*]} )); do diff --git a/tests/zfs-tests/tests/functional/inuse/inuse_009_pos.ksh b/tests/zfs-tests/tests/functional/inuse/inuse_009_pos.ksh index f76913fb55ce..6a9b9623cc87 100755 --- a/tests/zfs-tests/tests/functional/inuse/inuse_009_pos.ksh +++ b/tests/zfs-tests/tests/functional/inuse/inuse_009_pos.ksh @@ -45,6 +45,10 @@ verify_runnable "global" +if ! is_physical_device $FS_DISK0; then + log_unsupported "This directory cannot be run on raw files." +fi + function cleanup { poolexists $TESTPOOL1 || zpool import $TESTPOOL1 >/dev/null 2>&1 @@ -62,7 +66,7 @@ function verify_assertion #disks typeset targets=$1 for t in $targets; do - log_must set_partition 0 "" 0mb $t + log_must zero_partitions $t done return 0 @@ -78,11 +82,13 @@ typeset -i i=0 while (( i < ${#vdevs[*]} )); do + typeset cyl="" for num in 0 1 2 3 ; do eval typeset slice=\${FS_SIDE$num} disk=${slice%${SLICE_PREFIX}*} slice=${slice##*${SLICE_PREFIX}} - log_must set_partition $slice "" $FS_SIZE $disk + log_must set_partition $slice "$cyl" $FS_SIZE $disk + cyl=$(get_endslice $disk $slice) done if [[ -n $SINGLE_DISK && -n ${vdevs[i]} ]]; then diff --git a/tests/zfs-tests/tests/functional/largest_pool/largest_pool.cfg b/tests/zfs-tests/tests/functional/largest_pool/largest_pool.cfg index bcb93d47d55f..13c157789dd7 100644 --- a/tests/zfs-tests/tests/functional/largest_pool/largest_pool.cfg +++ b/tests/zfs-tests/tests/functional/largest_pool/largest_pool.cfg @@ -30,7 +30,7 @@ export TESTVOL=testvol$$ export VOL_PATH=${ZVOL_DEVDIR}/${TESTPOOL2}/$TESTVOL -export VOLSIZES=${VOLSIZES-"2pb 5pb 10pb 2eb 5eb 8eb 9eb"} +export VOLSIZES=${VOLSIZES-"2pb 5pb 10pb 2eb 5eb 7eb"} # There're 3 different prompt messages while create # a volume that great than 1TB on 32-bit diff --git a/tests/zfs-tests/tests/functional/largest_pool/largest_pool_001_pos.ksh b/tests/zfs-tests/tests/functional/largest_pool/largest_pool_001_pos.ksh index 4b25cf6163b4..98dc45be26c8 100755 --- a/tests/zfs-tests/tests/functional/largest_pool/largest_pool_001_pos.ksh +++ b/tests/zfs-tests/tests/functional/largest_pool/largest_pool_001_pos.ksh @@ -137,6 +137,7 @@ for volsize in $VOLSIZES; do log_fail "zfs create -sV $volsize $TESTPOOL2/$TESTVOL" fi fi + block_device_wait log_note "Create the largest pool allowed using the volume vdev" create_pool $TESTPOOL "$VOL_PATH" diff --git a/tests/zfs-tests/tests/functional/link_count/link_count_001.ksh b/tests/zfs-tests/tests/functional/link_count/link_count_001.ksh index 71e617ecf5e1..e121787cab65 100755 --- a/tests/zfs-tests/tests/functional/link_count/link_count_001.ksh +++ b/tests/zfs-tests/tests/functional/link_count/link_count_001.ksh @@ -50,7 +50,9 @@ export ITERS=10 export NUMFILES=10000 # Detect and make sure this test must be executed on a multi-process system -is_mp || log_fail "This test requires a multi-processor system." +if ! is_mp; then + log_unsupported "This test requires a multi-processor system." +fi log_must mkdir -p ${TESTDIR}/tmp diff --git a/tests/zfs-tests/tests/functional/mount/umountall_001.ksh b/tests/zfs-tests/tests/functional/mount/umountall_001.ksh index b5dc01e9bd05..b8c89c623ae6 100755 --- a/tests/zfs-tests/tests/functional/mount/umountall_001.ksh +++ b/tests/zfs-tests/tests/functional/mount/umountall_001.ksh @@ -43,17 +43,34 @@ done zfs_list="/ /lib /sbin /tmp /usr /var /var/adm /var/run" # Append our ZFS filesystems to the list, not worrying about duplicates. -for fs in $(mount -p | awk '{if ($4 == "zfs") print $3}'); do +if is_linux; then + typeset mounts=$(mount | awk '{if ($5 == "zfs") print $3}') +else + typeset mounts=$(mount -p | awk '{if ($4 == "zfs") print $3}') +fi + +for fs in $mounts; do zfs_list="$zfs_list $fs" done +if is_linux; then + mounts=$(umount --fake -av -t zfs 2>&1 | \ + grep "successfully umounted" | awk '{print $1}') + # Fallback to /proc/mounts for umount(8) (util-linux-ng 2.17.2) + if [[ -z $mounts ]]; then + mounts=$(awk '/zfs/ { print $2 }' /proc/mounts) + fi +else + mounts=$(umountall -n -F zfs 2>&1 | awk '{print $2}') +fi + fs='' -for fs in $(umountall -n -F zfs 2>&1 | awk '{print $2}'); do +for fs in $mounts; do for i in $zfs_list; do [[ $fs = $i ]] && continue 2 done log_fail "umountall -n -F zfs tried to unmount $fs" done -[[ -n $fs ]] || log_fail "umountall -n -F zfs produced no output" +[[ -n $mounts ]] || log_fail "umountall -n -F zfs produced no output" log_pass "All ZFS file systems would have been unmounted" diff --git a/tests/zfs-tests/tests/functional/nopwrite/nopwrite.shlib b/tests/zfs-tests/tests/functional/nopwrite/nopwrite.shlib index 1c0f0517db55..139b4b26e5ed 100644 --- a/tests/zfs-tests/tests/functional/nopwrite/nopwrite.shlib +++ b/tests/zfs-tests/tests/functional/nopwrite/nopwrite.shlib @@ -27,7 +27,7 @@ function verify_nopwrite typeset low=1 typeset high=99 - sync + sync_pool for i in origin snap clone; do for j in used refer usedbychildren written; do typeset ${i}_$j=$(get_prop $j $(eval echo \$$i)) diff --git a/tests/zfs-tests/tests/functional/online_offline/online_offline_001_pos.ksh b/tests/zfs-tests/tests/functional/online_offline/online_offline_001_pos.ksh index 9682767c0ab8..2fd913f40338 100755 --- a/tests/zfs-tests/tests/functional/online_offline/online_offline_001_pos.ksh +++ b/tests/zfs-tests/tests/functional/online_offline/online_offline_001_pos.ksh @@ -30,6 +30,7 @@ # . $STF_SUITE/include/libtest.shlib +. $STF_SUITE/tests/functional/online_offline/online_offline.cfg # # DESCRIPTION: @@ -70,19 +71,22 @@ file_trunc -f $((64 * 1024 * 1024)) -b 8192 -c 0 -r $TESTDIR/$TESTFILE1 & typeset killpid="$! " for disk in $DISKLIST; do - for i in 'do_offline' 'do_offline_while_already_offline'; do + for i in 'do_offline' 'do_offline_while_already_offline'; do log_must zpool offline $TESTPOOL $disk check_state $TESTPOOL $disk "offline" - if [[ $? != 0 ]]; then - log_fail "$disk of $TESTPOOL is not offline." - fi - done - - log_must zpool online $TESTPOOL $disk - check_state $TESTPOOL $disk "online" - if [[ $? != 0 ]]; then - log_fail "$disk of $TESTPOOL did not match online state" - fi + if [[ $? != 0 ]]; then + log_fail "$disk of $TESTPOOL is not offline." + fi + done + + log_must zpool online $TESTPOOL $disk + check_state $TESTPOOL $disk "online" + if [[ $? != 0 ]]; then + log_fail "$disk of $TESTPOOL did not match online state" + fi + + # Delay for resilver to complete + sleep 3 done log_must kill $killpid diff --git a/tests/zfs-tests/tests/functional/online_offline/online_offline_002_neg.ksh b/tests/zfs-tests/tests/functional/online_offline/online_offline_002_neg.ksh index 2f32e21e9011..63e9d46f2bac 100755 --- a/tests/zfs-tests/tests/functional/online_offline/online_offline_002_neg.ksh +++ b/tests/zfs-tests/tests/functional/online_offline/online_offline_002_neg.ksh @@ -30,6 +30,7 @@ # . $STF_SUITE/include/libtest.shlib +. $STF_SUITE/tests/functional/online_offline/online_offline.cfg # # DESCRIPTION: diff --git a/tests/zfs-tests/tests/functional/privilege/privilege_001_pos.ksh b/tests/zfs-tests/tests/functional/privilege/privilege_001_pos.ksh index 7a2fe6095007..5e7ddc189d35 100755 --- a/tests/zfs-tests/tests/functional/privilege/privilege_001_pos.ksh +++ b/tests/zfs-tests/tests/functional/privilege/privilege_001_pos.ksh @@ -57,6 +57,10 @@ # We can only run this in the global zone verify_runnable "global" +if is_linux; then + log_unsupported "Requires pfexec command" +fi + log_assert "The RBAC profile \"ZFS Storage Management\" works" ZFS_USER=$(cat /tmp/zfs-privs-test-user.txt) diff --git a/tests/zfs-tests/tests/functional/privilege/privilege_002_pos.ksh b/tests/zfs-tests/tests/functional/privilege/privilege_002_pos.ksh index dcccb5401f39..5f68857026ee 100755 --- a/tests/zfs-tests/tests/functional/privilege/privilege_002_pos.ksh +++ b/tests/zfs-tests/tests/functional/privilege/privilege_002_pos.ksh @@ -60,6 +60,10 @@ verify_runnable "both" +if is_linux; then + log_unsupported "Requires pfexec command" +fi + log_assert "The RBAC profile \"ZFS File System Management\" works" ZFS_USER=$(cat /tmp/zfs-privs-test-user.txt) diff --git a/tests/zfs-tests/tests/functional/rename_dirs/rename_dirs_001_pos.ksh b/tests/zfs-tests/tests/functional/rename_dirs/rename_dirs_001_pos.ksh index 12224deec683..d7b6de1a2e01 100755 --- a/tests/zfs-tests/tests/functional/rename_dirs/rename_dirs_001_pos.ksh +++ b/tests/zfs-tests/tests/functional/rename_dirs/rename_dirs_001_pos.ksh @@ -58,14 +58,14 @@ log_onexit cleanup cd $TESTDIR mkdir -p 1/2/3/4/5 a/b/c/d/e -$RENAME_DIRS & +rename_dir & -sleep 500 +sleep 10 typeset -i retval=1 -pgrep $RENAME_DIRS >/dev/null 2>&1 +pgrep -x rename_dir >/dev/null 2>&1 retval=$? if (( $retval == 0 )); then - pkill -9 $RENAME_DIRS >/dev/null 2>&1 + pkill -9 -x rename_dir >/dev/null 2>&1 fi log_pass "ZFS handle race directory rename operation as expected." diff --git a/tests/zfs-tests/tests/functional/rsend/rsend_019_pos.ksh b/tests/zfs-tests/tests/functional/rsend/rsend_019_pos.ksh index 8969ba9e8972..771d7e2f04a0 100755 --- a/tests/zfs-tests/tests/functional/rsend/rsend_019_pos.ksh +++ b/tests/zfs-tests/tests/functional/rsend/rsend_019_pos.ksh @@ -35,6 +35,11 @@ verify_runnable "both" +# See issue: https://github.com/zfsonlinux/zfs/issues/6086 +if is_linux; then + log_unsupported "Test case occasionally fails" +fi + log_assert "Verify resumability of a full and incremental ZFS send/receive " \ "in the presence of a corrupted stream" log_onexit resume_cleanup $sendfs $streamfs diff --git a/tests/zfs-tests/tests/functional/slog/slog_013_pos.ksh b/tests/zfs-tests/tests/functional/slog/slog_013_pos.ksh index 0ccea4992154..1436feab9237 100755 --- a/tests/zfs-tests/tests/functional/slog/slog_013_pos.ksh +++ b/tests/zfs-tests/tests/functional/slog/slog_013_pos.ksh @@ -44,6 +44,10 @@ verify_runnable "global" +if ! $(is_physical_device $DISKS) ; then + log_unsupported "This directory cannot be run on raw files." +fi + function cleanup_testenv { cleanup @@ -51,7 +55,11 @@ function cleanup_testenv log_must zpool destroy -f $TESTPOOL2 fi if [[ -n $lofidev ]]; then - lofiadm -d $lofidev + if is_linux; then + losetup -d $lofidev + else + lofiadm -d $lofidev + fi fi } @@ -72,9 +80,15 @@ ldev=$(random_get $LDEV) log_must verify_slog_device $TESTPOOL $ldev 'ONLINE' # Add lofi device -lofidev=${LDEV2%% *} -log_must lofiadm -a $lofidev -lofidev=$(lofiadm $lofidev) +if is_linux; then + lofidev=$(losetup -f) + lofidev=${lofidev##*/} + log_must losetup $lofidev ${LDEV2%% *} +else + lofidev=${LDEV2%% *} + log_must lofiadm -a $lofidev + lofidev=$(lofiadm $lofidev) +fi log_must zpool add $TESTPOOL log $lofidev log_must verify_slog_device $TESTPOOL $lofidev 'ONLINE' @@ -89,4 +103,4 @@ log_must zpool add $TESTPOOL $mntpnt/vdev # Add ZFS volume vol=$TESTPOOL/vol log_must zpool create -V $MINVDEVSIZE $vol -log_must zpool add $TESTPOOL ${ZVOL_DEVDIR}/$vol \ No newline at end of file +log_must zpool add $TESTPOOL ${ZVOL_DEVDIR}/$vol diff --git a/tests/zfs-tests/tests/functional/slog/slog_014_pos.ksh b/tests/zfs-tests/tests/functional/slog/slog_014_pos.ksh index 2d5407849ade..bc0c2fec55d6 100755 --- a/tests/zfs-tests/tests/functional/slog/slog_014_pos.ksh +++ b/tests/zfs-tests/tests/functional/slog/slog_014_pos.ksh @@ -65,6 +65,7 @@ do log_must zpool scrub $TESTPOOL log_must display_status $TESTPOOL log_must zpool status $TESTPOOL 2>&1 >/dev/null + log_must zpool offline $TESTPOOL $VDIR/a zpool status -v $TESTPOOL | \ grep "state: DEGRADED" 2>&1 >/dev/null @@ -78,6 +79,7 @@ do log_fail "log device should display correct status" fi + log_must zpool online $TESTPOOL $VDIR/a log_must zpool destroy -f $TESTPOOL done done diff --git a/tests/zfs-tests/tests/functional/snapshot/snapshot.cfg b/tests/zfs-tests/tests/functional/snapshot/snapshot.cfg index fa3164555101..265903fe1469 100644 --- a/tests/zfs-tests/tests/functional/snapshot/snapshot.cfg +++ b/tests/zfs-tests/tests/functional/snapshot/snapshot.cfg @@ -47,7 +47,7 @@ export VOLSIZE=1gb export BLOCKSZ=8192 export NUM_WRITES=20 export DATA=0 -export LIMIT=524288 # tolerance measured in bytes, 512K +export LIMIT=2097152 # tolerance measured in bytes, 2M export FSQUOTA=500m export FILESIZE=400m export FILESIZE1=200m diff --git a/tests/zfs-tests/tests/functional/snapshot/snapshot_008_pos.ksh b/tests/zfs-tests/tests/functional/snapshot/snapshot_008_pos.ksh index 0f7b0621a482..d0ecb77fe0a0 100755 --- a/tests/zfs-tests/tests/functional/snapshot/snapshot_008_pos.ksh +++ b/tests/zfs-tests/tests/functional/snapshot/snapshot_008_pos.ksh @@ -89,6 +89,7 @@ while [[ $i -lt $COUNT ]]; do done wait_freeing $TESTPOOL +sync_pool new_size=`get_prop available $TESTPOOL` diff --git a/tests/zfs-tests/tests/functional/snapshot/snapshot_016_pos.ksh b/tests/zfs-tests/tests/functional/snapshot/snapshot_016_pos.ksh index 66bf64833150..b460c2b0c5dc 100755 --- a/tests/zfs-tests/tests/functional/snapshot/snapshot_016_pos.ksh +++ b/tests/zfs-tests/tests/functional/snapshot/snapshot_016_pos.ksh @@ -51,6 +51,8 @@ function cleanup log_must zfs destroy -Rf $SNAPFS datasetexists $TESTPOOL/$TESTFS@snap_a && \ log_must zfs destroy -Rf $TESTPOOL/$TESTFS@snap_a + datasetexists $TESTPOOL/$TESTFS@snap_b && \ + log_must zfs destroy -Rf $TESTPOOL/$TESTFS@snap_b datasetexists $TESTPOOL/$TESTCLONE@snap_a && \ log_must zfs destroy -Rf $TESTPOOL/$TESTCLONE@snap_a @@ -79,15 +81,15 @@ log_must zfs destroy $TESTPOOL/$TESTFS@snap_a log_must zfs snapshot $SNAPFS log_must zfs clone $SNAPFS $TESTPOOL/$TESTCLONE -log_must mv $TESTDIR/$SNAPROOT/$TESTSNAP $TESTDIR/$SNAPROOT/snap_a +log_must mv $TESTDIR/$SNAPROOT/$TESTSNAP $TESTDIR/$SNAPROOT/snap_b -datasetexists $TESTPOOL/$TESTFS@snap_a || \ +datasetexists $TESTPOOL/$TESTFS@snap_b || \ log_fail "rename snapshot via mv in .zfs/snapshot fails." log_must zfs promote $TESTPOOL/$TESTCLONE # promote back to $TESTPOOL/$TESTFS for scenario 3 log_must zfs promote $TESTPOOL/$TESTFS log_must zfs destroy $TESTPOOL/$TESTCLONE -log_must zfs destroy $TESTPOOL/$TESTFS@snap_a +log_must zfs destroy $TESTPOOL/$TESTFS@snap_b # scenario 3 diff --git a/tests/zfs-tests/tests/functional/threadsappend/threadsappend_001_pos.ksh b/tests/zfs-tests/tests/functional/threadsappend/threadsappend_001_pos.ksh index b3e99d8611a5..48c468b5661c 100755 --- a/tests/zfs-tests/tests/functional/threadsappend/threadsappend_001_pos.ksh +++ b/tests/zfs-tests/tests/functional/threadsappend/threadsappend_001_pos.ksh @@ -45,6 +45,11 @@ verify_runnable "both" +# See issue: https://github.com/zfsonlinux/zfs/issues/6136 +if is_linux; then + log_unsupported "Test case occasionally fails" +fi + log_assert "Ensure multiple threads performing write appends to the same" \ "ZFS file succeed" @@ -67,7 +72,7 @@ fi # zfs_threadsappend tries to append to $TESTFILE using threads # so that the resulting file is $FILE_SIZE bytes in size # -log_must $THREADSAPPEND ${TESTDIR}/${TESTFILE} +log_must threadsappend ${TESTDIR}/${TESTFILE} # # Check the size of the resulting file diff --git a/tests/zfs-tests/tests/functional/xattr/Makefile.am b/tests/zfs-tests/tests/functional/xattr/Makefile.am index ac2cb54b5bdd..e404e84b1694 100644 --- a/tests/zfs-tests/tests/functional/xattr/Makefile.am +++ b/tests/zfs-tests/tests/functional/xattr/Makefile.am @@ -3,6 +3,7 @@ dist_pkgdata_SCRIPTS = \ xattr_common.kshlib \ setup.ksh \ cleanup.ksh \ + xattr.cfg \ xattr_001_pos.ksh \ xattr_002_neg.ksh \ xattr_003_neg.ksh \ diff --git a/tests/zfs-tests/tests/functional/xattr/cleanup.ksh b/tests/zfs-tests/tests/functional/xattr/cleanup.ksh index 10cd733d21fd..5f0a846165c5 100755 --- a/tests/zfs-tests/tests/functional/xattr/cleanup.ksh +++ b/tests/zfs-tests/tests/functional/xattr/cleanup.ksh @@ -28,15 +28,14 @@ # . $STF_SUITE/include/libtest.shlib +. $STF_SUITE/tests/functional/xattr/xattr_common.kshlib -ZFS_USER=$(cat /tmp/zfs-xattr-test-user.txt) -rm /tmp/zfs-xattr-test-user.txt +del_user $ZFS_USER +del_group $ZFS_GROUP USES_NIS=$(cat /tmp/zfs-xattr-test-nis.txt) rm /tmp/zfs-xattr-test-nis.txt -del_user $ZFS_USER - if [ "${USES_NIS}" == "true" ] then svcadm enable svc:/network/nis/client:default diff --git a/tests/zfs-tests/tests/functional/xattr/setup.ksh b/tests/zfs-tests/tests/functional/xattr/setup.ksh index ac82c5919118..64f89a3d0afd 100755 --- a/tests/zfs-tests/tests/functional/xattr/setup.ksh +++ b/tests/zfs-tests/tests/functional/xattr/setup.ksh @@ -28,33 +28,24 @@ # . $STF_SUITE/include/libtest.shlib +. $STF_SUITE/tests/functional/xattr/xattr_common.kshlib # if we're running NIS, turn it off until we clean up # (it can cause useradd to take a long time, hitting our TIMEOUT) -USES_NIS=false -svcs svc:/network/nis/client:default | grep online > /dev/null -if [ $? -eq 0 ] -then - svcadm disable -t svc:/network/nis/client:default - USES_NIS=true -fi - -# Make sure we use a brand new user for this -ZFS_USER=zxtr -ZFS_GROUP=staff -while [ -z "${FOUND}" ] -do - COUNT=0 - USER_EXISTS=$( grep $ZFS_USER /etc/passwd ) - if [ ! -z "${USER_EXISTS}" ] +if is_linux; then + USED_NIS=false +else + USES_NIS=false + svcs svc:/network/nis/client:default | grep online > /dev/null + if [ $? -eq 0 ] then - ZFS_USER="${ZFS_USER}${COUNT}" - COUNT=$(( $COUNT + 1 )) - else - FOUND="true" + svcadm disable -t svc:/network/nis/client:default + USES_NIS=true fi -done +fi +# Make sure we use a brand new user for this +log_must add_group $ZFS_GROUP log_must add_user $ZFS_GROUP $ZFS_USER echo $ZFS_USER > /tmp/zfs-xattr-test-user.txt diff --git a/tests/zfs-tests/tests/functional/xattr/xattr.cfg b/tests/zfs-tests/tests/functional/xattr/xattr.cfg new file mode 100644 index 000000000000..5f47562bbb09 --- /dev/null +++ b/tests/zfs-tests/tests/functional/xattr/xattr.cfg @@ -0,0 +1,30 @@ +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. +# +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +# or http://www.opensolaris.org/os/licensing. +# See the License for the specific language governing permissions +# and limitations under the License. +# +# When distributing Covered Code, include this CDDL HEADER in each +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. +# If applicable, add the following below this CDDL HEADER, with the +# fields enclosed by brackets "[]" replaced with your own identifying +# information: Portions Copyright [yyyy] [name of copyright owner] +# +# CDDL HEADER END +# + +# +# Copyright (c) 2017 by Lawrence Livermore National Security, LLC. +# Use is subject to license terms. +# + +export NISSTAFILE=/var/tmp/nis_state + +export ZFS_USER=zxtr +export ZFS_GROUP=zfsgrp diff --git a/tests/zfs-tests/tests/functional/xattr/xattr_001_pos.ksh b/tests/zfs-tests/tests/functional/xattr/xattr_001_pos.ksh index adb5132f28ff..ffb700438528 100755 --- a/tests/zfs-tests/tests/functional/xattr/xattr_001_pos.ksh +++ b/tests/zfs-tests/tests/functional/xattr/xattr_001_pos.ksh @@ -52,12 +52,18 @@ function cleanup { fi } +set -A args "on" "sa" + log_assert "Create/read/write/append of xattrs works" log_onexit cleanup -log_must touch $TESTDIR/myfile.$$ -create_xattr $TESTDIR/myfile.$$ passwd /etc/passwd -verify_write_xattr $TESTDIR/myfile.$$ passwd -delete_xattr $TESTDIR/myfile.$$ passwd +for arg in ${args[*]}; do + log_must zfs set xattr=$arg $TESTPOOL + + log_must touch $TESTDIR/myfile.$$ + create_xattr $TESTDIR/myfile.$$ passwd /etc/passwd + verify_write_xattr $TESTDIR/myfile.$$ passwd + delete_xattr $TESTDIR/myfile.$$ passwd +done log_pass "Create/read/write of xattrs works" diff --git a/tests/zfs-tests/tests/functional/xattr/xattr_002_neg.ksh b/tests/zfs-tests/tests/functional/xattr/xattr_002_neg.ksh index 99212a011066..e379d1586ea9 100755 --- a/tests/zfs-tests/tests/functional/xattr/xattr_002_neg.ksh +++ b/tests/zfs-tests/tests/functional/xattr/xattr_002_neg.ksh @@ -46,11 +46,17 @@ function cleanup { } +set -A args "on" "sa" + log_assert "A read of a non-existent xattr fails" log_onexit cleanup -# create a file -log_must touch $TESTDIR/myfile.$$ -log_mustnot eval "cat $TESTDIR/myfile.$$ not-here.txt > /dev/null 2>&1" +for arg in ${args[*]}; do + log_must zfs set xattr=$arg $TESTPOOL + + # create a file + log_must touch $TESTDIR/myfile.$$ + log_mustnot eval "cat $TESTDIR/myfile.$$ not-here.txt > /dev/null 2>&1" -log_pass "A read of a non-existent xattr fails" + log_pass "A read of a non-existent xattr fails" +done diff --git a/tests/zfs-tests/tests/functional/xattr/xattr_003_neg.ksh b/tests/zfs-tests/tests/functional/xattr/xattr_003_neg.ksh index 28fae8e6574f..a56fce4eaba1 100755 --- a/tests/zfs-tests/tests/functional/xattr/xattr_003_neg.ksh +++ b/tests/zfs-tests/tests/functional/xattr/xattr_003_neg.ksh @@ -56,7 +56,21 @@ log_must touch $TESTDIR/myfile.$$ create_xattr $TESTDIR/myfile.$$ passwd /etc/passwd log_must chmod 000 $TESTDIR/myfile.$$ -log_mustnot su $ZFS_USER -c "runat $TESTDIR/myfile.$$ cat passwd" -log_mustnot su $ZFS_USER -c "runat $TESTDIR/myfile.$$ cp /etc/passwd ." +if is_linux; then + user_run $ZFS_USER eval \ + "attr -q -g passwd $TESTDIR/myfile.$$ >/tmp/passwd.$$" + log_mustnot diff /etc/passwd /tmp/passwd.$$ + log_must rm /tmp/passwd.$$ + + user_run $ZFS_USER eval \ + "attr -q -s passwd $TESTDIR/myfile.$$ /tmp/passwd.$$ + log_must diff /etc/passwd /tmp/passwd.$$ + log_must rm /tmp/passwd.$$ +else + log_mustnot su $ZFS_USER -c "runat $TESTDIR/myfile.$$ cat passwd" + log_mustnot su $ZFS_USER -c "runat $TESTDIR/myfile.$$ cp /etc/passwd ." +fi log_pass "read/write xattr on a file with no permissions fails" diff --git a/tests/zfs-tests/tests/functional/xattr/xattr_004_pos.ksh b/tests/zfs-tests/tests/functional/xattr/xattr_004_pos.ksh index 921526315141..e5f61d3bfa71 100755 --- a/tests/zfs-tests/tests/functional/xattr/xattr_004_pos.ksh +++ b/tests/zfs-tests/tests/functional/xattr/xattr_004_pos.ksh @@ -50,8 +50,7 @@ verify_runnable "global" # Make sure we clean up properly function cleanup { - if [ $( ismounted /tmp/$NEWFS_DEFAULT_FS.$$ $NEWFS_DEFAULT_FS ) ] - then + if ismounted /tmp/$NEWFS_DEFAULT_FS.$$ $NEWFS_DEFAULT_FS; then log_must umount /tmp/$NEWFS_DEFAULT_FS.$$ log_must rm -rf /tmp/$NEWFS_DEFAULT_FS.$$ fi @@ -63,25 +62,62 @@ log_onexit cleanup # Create a UFS|EXT2 file system that we can work in log_must zfs create -V128m $TESTPOOL/$TESTFS/zvol block_device_wait -log_must eval "echo y | $NEWFS $ZVOL_DEVDIR/$TESTPOOL/$TESTFS/zvol > /dev/null 2>&1" +log_must eval "echo y | newfs $ZVOL_DEVDIR/$TESTPOOL/$TESTFS/zvol > /dev/null 2>&1" log_must mkdir /tmp/$NEWFS_DEFAULT_FS.$$ -log_must mount $ZVOL_DEVDIR/$TESTPOOL/$TESTFS/zvol /tmp/$NEWFS_DEFAULT_FS.$$ +if is_linux; then + log_must mount -o user_xattr \ + $ZVOL_DEVDIR/$TESTPOOL/$TESTFS/zvol /tmp/$NEWFS_DEFAULT_FS.$$ -# Create files in ufs|ext2 and tmpfs, and set some xattrs on them. -log_must touch /tmp/$NEWFS_DEFAULT_FS.$$/$NEWFS_DEFAULT_FS-file.$$ -log_must touch /tmp/tmpfs-file.$$ + # Create files in ext2 and tmpfs, and set some xattrs on them. + # Use small values for xattrs for ext2 compatibility. + log_must touch /tmp/$NEWFS_DEFAULT_FS.$$/$NEWFS_DEFAULT_FS-file.$$ -log_must runat /tmp/$NEWFS_DEFAULT_FS.$$/$NEWFS_DEFAULT_FS-file.$$ cp /etc/passwd . -log_must runat /tmp/tmpfs-file.$$ cp /etc/group . + log_must touch /tmp/tmpfs-file.$$ + echo "TEST XATTR" >/tmp/xattr1 + echo "1234567890" >/tmp/xattr2 + log_must attr -q -s xattr1 \ + /tmp/$NEWFS_DEFAULT_FS.$$/$NEWFS_DEFAULT_FS-file.$$ /tmp/xattr1.$$" + + log_must diff /tmp/xattr1.$$ /tmp/xattr1 + log_must eval "attr -q -g xattr2 $TESTDIR/tmpfs-file.$$ >/tmp/xattr2.$$" + log_must diff /tmp/xattr2.$$ /tmp/xattr2 + log_must rm /tmp/xattr1 /tmp/xattr1.$$ /tmp/xattr2 /tmp/xattr2.$$ + + log_must umount /tmp/$NEWFS_DEFAULT_FS.$$ +else + log_must mount $ZVOL_DEVDIR/$TESTPOOL/$TESTFS/zvol \ + /tmp/$NEWFS_DEFAULT_FS.$$ + + # Create files in ufs and tmpfs, and set some xattrs on them. + log_must touch /tmp/$NEWFS_DEFAULT_FS.$$/$NEWFS_DEFAULT_FS-file.$$ + log_must touch /tmp/tmpfs-file.$$ + + log_must runat /tmp/$NEWFS_DEFAULT_FS.$$/$NEWFS_DEFAULT_FS-file.$$ \ + cp /etc/passwd . + log_must runat /tmp/tmpfs-file.$$ cp /etc/group . + + # copy those files to ZFS + log_must cp -@ /tmp/$NEWFS_DEFAULT_FS.$$/$NEWFS_DEFAULT_FS-file.$$ \ + $TESTDIR + log_must cp -@ /tmp/tmpfs-file.$$ $TESTDIR + + # ensure the xattr information has been copied correctly + log_must runat $TESTDIR/$NEWFS_DEFAULT_FS-file.$$ \ + diff passwd /etc/passwd + log_must runat $TESTDIR/tmpfs-file.$$ diff group /etc/group + + log_must umount /tmp/$NEWFS_DEFAULT_FS.$$ +fi -log_must umount /tmp/$NEWFS_DEFAULT_FS.$$ log_pass "Files from $NEWFS_DEFAULT_FS,tmpfs with xattrs copied to zfs retain xattr info." diff --git a/tests/zfs-tests/tests/functional/xattr/xattr_007_neg.ksh b/tests/zfs-tests/tests/functional/xattr/xattr_007_neg.ksh index 6b3feeafc05b..977434cebeb9 100755 --- a/tests/zfs-tests/tests/functional/xattr/xattr_007_neg.ksh +++ b/tests/zfs-tests/tests/functional/xattr/xattr_007_neg.ksh @@ -69,13 +69,22 @@ log_must touch $TESTDIR/myfile2.$$ log_must zfs snapshot $TESTPOOL/$TESTFS@snap # we shouldn't be able to alter the first file's xattr -log_mustnot eval " runat $TESTDIR/.zfs/snapshot/snap/myfile.$$ \ - cp /etc/passwd . >/tmp/output.$$ 2>&1" -log_must grep -i Read-only /tmp/output.$$ +if is_linux; then + log_mustnot eval "attr -s cp $TESTDIR/.zfs/snapshot/snap/myfile.$$ \ + /tmp/output.$$ 2>&1" + log_must grep -i Read-only /tmp/output.$$ + log_must eval "attr -q -l $TESTDIR/.zfs/snapshot/snap/myfile2.$$ \ + >/tmp/output.$$ 2>&1" + log_must eval "attr -q -l $TESTDIR/myfile2.$$ >/tmp/expected_output.$$" +else + log_mustnot eval " runat $TESTDIR/.zfs/snapshot/snap/myfile.$$ \ + cp /etc/passwd . >/tmp/output.$$ 2>&1" + log_must grep -i Read-only /tmp/output.$$ + log_must eval "runat $TESTDIR/.zfs/snapshot/snap/myfile2.$$ \ + ls >/tmp/output.$$ 2>&1" + create_expected_output /tmp/expected_output.$$ SUNWattr_ro SUNWattr_rw +fi -log_must eval "runat $TESTDIR/.zfs/snapshot/snap/myfile2.$$ \ - ls >/tmp/output.$$ 2>&1" -create_expected_output /tmp/expected_output.$$ SUNWattr_ro SUNWattr_rw log_must diff /tmp/output.$$ /tmp/expected_output.$$ log_pass "create/write xattr on a snapshot fails" diff --git a/tests/zfs-tests/tests/functional/xattr/xattr_008_pos.ksh b/tests/zfs-tests/tests/functional/xattr/xattr_008_pos.ksh index 20319967c2e9..735f1859a706 100755 --- a/tests/zfs-tests/tests/functional/xattr/xattr_008_pos.ksh +++ b/tests/zfs-tests/tests/functional/xattr/xattr_008_pos.ksh @@ -49,6 +49,10 @@ function cleanup { done } +if is_linux; then + log_unsupported "Test case isn't applicable to Linux" +fi + log_assert "special . and .. dirs work as expected for xattrs" log_onexit cleanup diff --git a/tests/zfs-tests/tests/functional/xattr/xattr_009_neg.ksh b/tests/zfs-tests/tests/functional/xattr/xattr_009_neg.ksh index 6a953cf84178..ea5b40eec97f 100755 --- a/tests/zfs-tests/tests/functional/xattr/xattr_009_neg.ksh +++ b/tests/zfs-tests/tests/functional/xattr/xattr_009_neg.ksh @@ -40,6 +40,10 @@ # 3. Verify we're unable to create a hard link # +if is_linux; then + log_unsupported "Test case isn't applicable to Linux" +fi + function cleanup { log_must rm $TESTDIR/myfile.$$ diff --git a/tests/zfs-tests/tests/functional/xattr/xattr_010_neg.ksh b/tests/zfs-tests/tests/functional/xattr/xattr_010_neg.ksh index 43502bfff28b..db218c43418a 100755 --- a/tests/zfs-tests/tests/functional/xattr/xattr_010_neg.ksh +++ b/tests/zfs-tests/tests/functional/xattr/xattr_010_neg.ksh @@ -41,6 +41,10 @@ # # +if is_linux; then + log_unsupported "Test case isn't applicable to Linux" +fi + function cleanup { log_must rm $TESTDIR/myfile.$$ diff --git a/tests/zfs-tests/tests/functional/xattr/xattr_011_pos.ksh b/tests/zfs-tests/tests/functional/xattr/xattr_011_pos.ksh index 12f067489f20..9276d3a1af56 100755 --- a/tests/zfs-tests/tests/functional/xattr/xattr_011_pos.ksh +++ b/tests/zfs-tests/tests/functional/xattr/xattr_011_pos.ksh @@ -65,60 +65,74 @@ create_xattr $TESTDIR/myfile.$$ passwd /etc/passwd # and try various cpio options extracting the archives # with and without xattr support, checking for correct behaviour - -log_note "Checking cpio" -log_must touch $TESTDIR/cpio.$$ -create_xattr $TESTDIR/cpio.$$ passwd /etc/passwd -echo $TESTDIR/cpio.$$ | cpio -o@ > /tmp/xattr.$$.cpio -echo $TESTDIR/cpio.$$ | cpio -o > /tmp/noxattr.$$.cpio - -# we should have no xattr here -log_must cpio -iu < /tmp/xattr.$$.cpio -log_mustnot eval "runat $TESTDIR/cpio.$$ cat passwd > /dev/null 2>&1" - -# we should have an xattr here -log_must cpio -iu@ < /tmp/xattr.$$.cpio -log_must eval "runat $TESTDIR/cpio.$$ cat passwd > /dev/null 2>&1" - -# we should have no xattr here -log_must cpio -iu < /tmp/noxattr.$$.cpio -log_mustnot eval "runat $TESTDIR/cpio.$$ cat passwd > /dev/null 2>&1" - -# we should have no xattr here -log_must cpio -iu@ < /tmp/noxattr.$$.cpio -log_mustnot eval "runat $TESTDIR/cpio.$$ cat passwd > /dev/null 2>&1" -log_must rm $TESTDIR/cpio.$$ /tmp/xattr.$$.cpio /tmp/noxattr.$$.cpio - - +if is_linux; then + log_note "Checking cpio - unsupported" +else + log_note "Checking cpio" + log_must touch $TESTDIR/cpio.$$ + create_xattr $TESTDIR/cpio.$$ passwd /etc/passwd + echo $TESTDIR/cpio.$$ | cpio -o@ > /tmp/xattr.$$.cpio + echo $TESTDIR/cpio.$$ | cpio -o > /tmp/noxattr.$$.cpio + + # we should have no xattr here + log_must cpio -iu < /tmp/xattr.$$.cpio + log_mustnot eval "runat $TESTDIR/cpio.$$ cat passwd > /dev/null 2>&1" + + # we should have an xattr here + log_must cpio -iu@ < /tmp/xattr.$$.cpio + log_must eval "runat $TESTDIR/cpio.$$ cat passwd > /dev/null 2>&1" + + # we should have no xattr here + log_must cpio -iu < /tmp/noxattr.$$.cpio + log_mustnot eval "runat $TESTDIR/cpio.$$ cat passwd > /dev/null 2>&1" + + # we should have no xattr here + log_must cpio -iu@ < /tmp/noxattr.$$.cpio + log_mustnot eval "runat $TESTDIR/cpio.$$ cat passwd > /dev/null 2>&1" + log_must rm $TESTDIR/cpio.$$ /tmp/xattr.$$.cpio /tmp/noxattr.$$.cpio +fi log_note "Checking cp" # check that with the right flag, the xattr is preserved -log_must cp -@ $TESTDIR/myfile.$$ $TESTDIR/myfile2.$$ -compare_xattrs $TESTDIR/myfile.$$ $TESTDIR/myfile2.$$ passwd -log_must rm $TESTDIR/myfile2.$$ +if is_linux; then + log_must cp -a $TESTDIR/myfile.$$ $TESTDIR/myfile2.$$ -# without the right flag, there should be no xattr -log_must cp $TESTDIR/myfile.$$ $TESTDIR/myfile2.$$ -log_mustnot eval "runat $TESTDIR/myfile2.$$ ls passwd > /dev/null 2>&1" -log_must rm $TESTDIR/myfile2.$$ + compare_xattrs $TESTDIR/myfile.$$ $TESTDIR/myfile2.$$ passwd + log_must rm $TESTDIR/myfile2.$$ + # without the right flag, there should be no xattr + log_must cp $TESTDIR/myfile.$$ $TESTDIR/myfile2.$$ + log_mustnot attr -q -g passwd $TESTDIR/myfile2.$$ + log_must rm $TESTDIR/myfile2.$$ +else + log_must cp -@ $TESTDIR/myfile.$$ $TESTDIR/myfile2.$$ + compare_xattrs $TESTDIR/myfile.$$ $TESTDIR/myfile2.$$ passwd + log_must rm $TESTDIR/myfile2.$$ + + # without the right flag, there should be no xattr + log_must cp $TESTDIR/myfile.$$ $TESTDIR/myfile2.$$ + log_mustnot eval "runat $TESTDIR/myfile2.$$ ls passwd > /dev/null 2>&1" + log_must rm $TESTDIR/myfile2.$$ +fi -log_note "Checking find" # create a file without xattrs, and check that find -xattr only finds # our test file that has an xattr. -log_must mkdir $TESTDIR/noxattrs -log_must touch $TESTDIR/noxattrs/no-xattr - -find $TESTDIR -xattr | grep myfile.$$ -[[ $? -ne 0 ]] && \ - log_fail "find -xattr didn't find our file that had an xattr." -find $TESTDIR -xattr | grep no-xattr -[[ $? -eq 0 ]] && \ - log_fail "find -xattr found a file that didn't have an xattr." -log_must rm -rf $TESTDIR/noxattrs - - +if is_linux; then + log_note "Checking find - unsupported" +else + log_note "Checking find" + log_must mkdir $TESTDIR/noxattrs + log_must touch $TESTDIR/noxattrs/no-xattr + + find $TESTDIR -xattr | grep myfile.$$ + [[ $? -ne 0 ]] && \ + log_fail "find -xattr didn't find our file that had an xattr." + find $TESTDIR -xattr | grep no-xattr + [[ $? -eq 0 ]] && \ + log_fail "find -xattr found a file that didn't have an xattr." + log_must rm -rf $TESTDIR/noxattrs +fi log_note "Checking mv" # mv doesn't have any flags to preserve/ommit xattrs - they're @@ -129,65 +143,96 @@ log_must mv $TESTDIR/mvfile.$$ $TESTDIR/mvfile2.$$ verify_xattr $TESTDIR/mvfile2.$$ passwd /etc/passwd log_must rm $TESTDIR/mvfile2.$$ - -log_note "Checking pax" -log_must touch $TESTDIR/pax.$$ -create_xattr $TESTDIR/pax.$$ passwd /etc/passwd -log_must pax -w -f $TESTDIR/noxattr.pax $TESTDIR/pax.$$ -log_must pax -w@ -f $TESTDIR/xattr.pax $TESTDIR/pax.$$ -log_must rm $TESTDIR/pax.$$ - -# we should have no xattr here -log_must pax -r -f $TESTDIR/noxattr.pax -log_mustnot eval "runat $TESTDIR/pax.$$ cat passwd > /dev/null 2>&1" -log_must rm $TESTDIR/pax.$$ - -# we should have no xattr here -log_must pax -r@ -f $TESTDIR/noxattr.pax -log_mustnot eval "runat $TESTDIR/pax.$$ cat passwd > /dev/null 2>&1" -log_must rm $TESTDIR/pax.$$ - - -# we should have an xattr here -log_must pax -r@ -f $TESTDIR/xattr.pax -verify_xattr $TESTDIR/pax.$$ passwd /etc/passwd -log_must rm $TESTDIR/pax.$$ - -# we should have no xattr here -log_must pax -r -f $TESTDIR/xattr.pax $TESTDIR -log_mustnot eval "runat $TESTDIR/pax.$$ cat passwd > /dev/null 2>&1" -log_must rm $TESTDIR/pax.$$ $TESTDIR/noxattr.pax $TESTDIR/xattr.pax - +if is_linux; then + log_note "Checking pax - unsupported" +else + log_note "Checking pax" + log_must touch $TESTDIR/pax.$$ + create_xattr $TESTDIR/pax.$$ passwd /etc/passwd + log_must pax -w -f $TESTDIR/noxattr.pax $TESTDIR/pax.$$ + log_must pax -w@ -f $TESTDIR/xattr.pax $TESTDIR/pax.$$ + log_must rm $TESTDIR/pax.$$ + + # we should have no xattr here + log_must pax -r -f $TESTDIR/noxattr.pax + log_mustnot eval "runat $TESTDIR/pax.$$ cat passwd > /dev/null 2>&1" + log_must rm $TESTDIR/pax.$$ + + # we should have no xattr here + log_must pax -r@ -f $TESTDIR/noxattr.pax + log_mustnot eval "runat $TESTDIR/pax.$$ cat passwd > /dev/null 2>&1" + log_must rm $TESTDIR/pax.$$ + + # we should have an xattr here + log_must pax -r@ -f $TESTDIR/xattr.pax + verify_xattr $TESTDIR/pax.$$ passwd /etc/passwd + log_must rm $TESTDIR/pax.$$ + + # we should have no xattr here + log_must pax -r -f $TESTDIR/xattr.pax $TESTDIR + log_mustnot eval "runat $TESTDIR/pax.$$ cat passwd > /dev/null 2>&1" + log_must rm $TESTDIR/pax.$$ $TESTDIR/noxattr.pax $TESTDIR/xattr.pax +fi log_note "Checking tar" -log_must touch $TESTDIR/tar.$$ -create_xattr $TESTDIR/tar.$$ passwd /etc/passwd - -log_must cd $TESTDIR - -log_must tar cf noxattr.tar tar.$$ -log_must tar c@f xattr.tar tar.$$ -log_must rm $TESTDIR/tar.$$ - -# we should have no xattr here -log_must tar xf xattr.tar -log_mustnot eval "runat $TESTDIR/tar.$$ cat passwd > /dev/null 2>&1" -log_must rm $TESTDIR/tar.$$ - -# we should have an xattr here -log_must tar x@f xattr.tar -verify_xattr tar.$$ passwd /etc/passwd -log_must rm $TESTDIR/tar.$$ - -# we should have no xattr here -log_must tar xf $TESTDIR/noxattr.tar -log_mustnot eval "runat $TESTDIR/tar.$$ cat passwd > /dev/null 2>&1" -log_must rm $TESTDIR/tar.$$ - -# we should have no xattr here -log_must tar x@f $TESTDIR/noxattr.tar -log_mustnot eval "runat $TESTDIR/tar.$$ cat passwd > /dev/null 2>&1" -log_must rm $TESTDIR/tar.$$ $TESTDIR/noxattr.tar $TESTDIR/xattr.tar - +if is_linux; then + log_must touch $TESTDIR/tar.$$ + create_xattr $TESTDIR/tar.$$ passwd /etc/passwd + + log_must cd $TESTDIR + + log_must tar -cf noxattr.tar tar.$$ + log_must tar --xattrs -cf xattr.tar tar.$$ + log_must rm $TESTDIR/tar.$$ + + # we should have no xattr here + log_must tar --no-xattrs -xf xattr.tar + log_mustnot attr -q -g passwd $TESTDIR/tar.$$ + log_must rm $TESTDIR/tar.$$ + + # we should have an xattr here + log_must tar --xattrs -xf xattr.tar + verify_xattr tar.$$ passwd /etc/passwd + log_must rm $TESTDIR/tar.$$ + + # we should have no xattr here + log_must tar --no-xattrs -xf $TESTDIR/noxattr.tar + log_mustnot attr -q -g passwd $TESTDIR/tar.$$ + log_must rm $TESTDIR/tar.$$ + + # we should have no xattr here + log_must tar --xattrs -xf $TESTDIR/noxattr.tar + log_mustnot attr -q -g passwd $TESTDIR/tar.$$ + log_must rm $TESTDIR/tar.$$ $TESTDIR/noxattr.tar $TESTDIR/xattr.tar +else + log_must touch $TESTDIR/tar.$$ + create_xattr $TESTDIR/tar.$$ passwd /etc/passwd + + log_must cd $TESTDIR + + log_must tar cf noxattr.tar tar.$$ + log_must tar c@f xattr.tar tar.$$ + log_must rm $TESTDIR/tar.$$ + + # we should have no xattr here + log_must tar xf xattr.tar + log_mustnot eval "runat $TESTDIR/tar.$$ cat passwd > /dev/null 2>&1" + log_must rm $TESTDIR/tar.$$ + + # we should have an xattr here + log_must tar x@f xattr.tar + verify_xattr tar.$$ passwd /etc/passwd + log_must rm $TESTDIR/tar.$$ + + # we should have no xattr here + log_must tar xf $TESTDIR/noxattr.tar + log_mustnot eval "runat $TESTDIR/tar.$$ cat passwd > /dev/null 2>&1" + log_must rm $TESTDIR/tar.$$ + + # we should have no xattr here + log_must tar x@f $TESTDIR/noxattr.tar + log_mustnot eval "runat $TESTDIR/tar.$$ cat passwd > /dev/null 2>&1" + log_must rm $TESTDIR/tar.$$ $TESTDIR/noxattr.tar $TESTDIR/xattr.tar +fi log_assert "Basic applications work with xattrs: cpio cp find mv pax tar" diff --git a/tests/zfs-tests/tests/functional/xattr/xattr_012_pos.ksh b/tests/zfs-tests/tests/functional/xattr/xattr_012_pos.ksh index 26d6bd7dd75b..7241caf8eb63 100755 --- a/tests/zfs-tests/tests/functional/xattr/xattr_012_pos.ksh +++ b/tests/zfs-tests/tests/functional/xattr/xattr_012_pos.ksh @@ -79,10 +79,16 @@ fi FS_SIZE=$(zfs get -p -H -o value used $TESTPOOL/$TESTFS) -log_must runat $TESTDIR/myfile.$$ mkfile 200m xattr +if is_linux; then + # Linux setxattr() syscalls limits individual xattrs to 64k. Create + # 100 files, with 128 xattrs each of size 16k. 100*128*16k=200m + log_must xattrtest -k -f 100 -x 128 -s 16384 -p $TESTDIR +else + log_must runat $TESTDIR/myfile.$$ mkfile 200m xattr +fi #Make sure the newly created file is counted into zpool usage -log_must sync +sync_pool # now check to see if our pool disk usage has increased if is_global_zone diff --git a/tests/zfs-tests/tests/functional/xattr/xattr_013_pos.ksh b/tests/zfs-tests/tests/functional/xattr/xattr_013_pos.ksh index 50b8ffbfaca1..e9eed69552c8 100755 --- a/tests/zfs-tests/tests/functional/xattr/xattr_013_pos.ksh +++ b/tests/zfs-tests/tests/functional/xattr/xattr_013_pos.ksh @@ -65,13 +65,25 @@ log_must umount $TESTDIR log_must zfs mount -o noxattr $TESTPOOL/$TESTFS # check that we can't perform xattr operations -log_mustnot eval "runat $TESTDIR/myfile.$$ cat passwd > /dev/null 2>&1" -log_mustnot eval "runat $TESTDIR/myfile.$$ rm passwd > /dev/null 2>&1" -log_mustnot eval "runat $TESTDIR/myfile.$$ cp /etc/passwd . > /dev/null 2>&1" - -log_must touch $TESTDIR/new.$$ -log_mustnot eval "runat $TESTDIR/new.$$ cp /etc/passwd . > /dev/null 2>&1" -log_mustnot eval "runat $TESTDIR/new.$$ rm passwd > /dev/null 2>&1" +if is_linux; then + log_mustnot attr -q -g passwd $TESTDIR/myfile.$$ + log_mustnot attr -q -r passwd $TESTDIR/myfile.$$ + log_mustnot attr -q -s passwd $TESTDIR/myfile.$$ /dev/null 2>&1" + log_mustnot eval "runat $TESTDIR/myfile.$$ rm passwd > /dev/null 2>&1" + log_mustnot eval "runat $TESTDIR/myfile.$$ cp /etc/passwd . \ + > /dev/null 2>&1" + + log_must touch $TESTDIR/new.$$ + log_mustnot eval "runat $TESTDIR/new.$$ cp /etc/passwd . \ + > /dev/null 2>&1" + log_mustnot eval "runat $TESTDIR/new.$$ rm passwd > /dev/null 2>&1" +fi # now mount the filesystem again as normal log_must umount $TESTDIR @@ -82,7 +94,11 @@ verify_xattr $TESTDIR/myfile.$$ passwd /etc/passwd # there should be no xattr on the file we created while the fs was mounted # -o noxattr -log_mustnot eval "runat $TESTDIR/new.$$ cat passwd > /dev/null 2>&1" +if is_linux; then + log_mustnot attr -q -g passwd $TESTDIR/new.$$ +else + log_mustnot eval "runat $TESTDIR/new.$$ cat passwd > /dev/null 2>&1" +fi create_xattr $TESTDIR/new.$$ passwd /etc/passwd log_pass "The noxattr mount option functions as expected" diff --git a/tests/zfs-tests/tests/functional/xattr/xattr_common.kshlib b/tests/zfs-tests/tests/functional/xattr/xattr_common.kshlib index 56710093406c..d2399310b59e 100644 --- a/tests/zfs-tests/tests/functional/xattr/xattr_common.kshlib +++ b/tests/zfs-tests/tests/functional/xattr/xattr_common.kshlib @@ -29,6 +29,7 @@ # . $STF_SUITE/include/libtest.shlib +. $STF_SUITE/tests/functional/xattr/xattr.cfg # a function that takes a file, then creates and verifies # an xattr on that file. The xattr_contents is the file @@ -38,10 +39,15 @@ function create_xattr { # filename xattr_name xattr_contents typeset XATTR_NAME=$2 typeset XATTR_CONTENTS=$3 - # read any empty xattr on that file - log_must runat $FILE ls - # create the xattr - log_must runat $FILE cp $XATTR_CONTENTS $XATTR_NAME + if is_linux; then + log_mustnot attr -q -g $XATTR_NAME $FILE + log_must attr -q -s $XATTR_NAME $FILE < $XATTR_CONTENTS + else + # read any empty xattr on that file + log_must runat $FILE ls + # create the xattr + log_must runat $FILE cp $XATTR_CONTENTS $XATTR_NAME + fi verify_xattr $FILE $XATTR_NAME $XATTR_CONTENTS } @@ -53,8 +59,13 @@ function compare_xattrs { # filename1 filename2 xattr_name typeset FILE2=$2 typeset XATTR_NAME=$3 - runat $FILE1 cat $XATTR_NAME > /tmp/file1.$$ - runat $FILE2 cat $XATTR_NAME > /tmp/file2.$$ + if is_linux; then + attr -q -g $XATTR_NAME $FILE1 >/tmp/file1.$$ + attr -q -g $XATTR_NAME $FILE2 >/tmp/file2.$$ + else + runat $FILE1 cat $XATTR_NAME > /tmp/file1.$$ + runat $FILE2 cat $XATTR_NAME > /tmp/file2.$$ + fi log_must diff /tmp/file1.$$ /tmp/file2.$$ log_must rm /tmp/file1.$$ /tmp/file2.$$ @@ -66,7 +77,14 @@ function verify_xattr { # filename xattr_name xattr_contents typeset XATTR_CONTENTS=$3 # read the xattr, writing it to a temp file - log_must eval "runat $FILE cat $XATTR_NAME > /tmp/$XATTR_NAME.$$ 2>&1" + if is_linux; then + log_must eval \ + "attr -q -g $XATTR_NAME $FILE >/tmp/$XATTR_NAME.$$" + else + log_must eval \ + "runat $FILE cat $XATTR_NAME >/tmp/$XATTR_NAME.$$ 2>&1" + fi + log_must diff $XATTR_CONTENTS /tmp/$XATTR_NAME.$$ rm /tmp/$XATTR_NAME.$$ } @@ -76,8 +94,13 @@ function delete_xattr { # filename xattr_name typeset XATTR_NAME=$2 # delete the xattr - log_must runat $FILE rm $XATTR_NAME - log_mustnot eval "runat $FILE ls $XATTR_NAME > /dev/null 2>&1" + if is_linux; then + log_must attr -r $XATTR_NAME $FILE + log_mustnot attr -q -g $XATTR_NAME $FILE + else + log_must runat $FILE rm $XATTR_NAME + log_mustnot eval "runat $FILE ls $XATTR_NAME > /dev/null 2>&1" + fi } # not sure about this : really this should be testing write/append @@ -85,8 +108,15 @@ function verify_write_xattr { # filename xattr_name typeset FILE=$1 typeset XATTR_NAME=$2 - log_must eval "runat $FILE dd if=/etc/passwd of=$XATTR_NAME" - log_must eval "runat $FILE cat $XATTR_NAME > /tmp/$XATTR_NAME.$$ 2>&1" + if is_linux; then + log_must attr -q -s $XATTR_NAME $FILE < /etc/passwd + log_must eval \ + "attr -q -g $XATTR_NAME $FILE >/tmp/$XATTR_NAME.$$" + else + log_must eval "runat $FILE dd if=/etc/passwd of=$XATTR_NAME" + log_must eval \ + "runat $FILE cat $XATTR_NAME > /tmp/$XATTR_NAME.$$ 2>&1" + fi log_must dd if=/etc/passwd of=/tmp/passwd_dd.$$ log_must diff /tmp/passwd_dd.$$ /tmp/$XATTR_NAME.$$ log_must rm /tmp/passwd_dd.$$ /tmp/$XATTR_NAME.$$