aboutsummaryrefslogtreecommitdiff
path: root/sys/contrib/openzfs/tests/zfs-tests/tests/functional
diff options
context:
space:
mode:
Diffstat (limited to 'sys/contrib/openzfs/tests/zfs-tests/tests/functional')
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/Makefile.am95
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/acl/Makefile.am6
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/acl/acl_common.kshlib385
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/acl/off/.gitignore1
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/acl/off/Makefile.am14
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/acl/off/dosmode.ksh11
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/acl/off/dosmode_readonly_write.c72
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/acl/posix-sa/Makefile.am8
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/acl/posix/Makefile.am8
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/acl/posix/posix_001_pos.ksh68
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/acl/posix/posix_002_pos.ksh11
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/acl/posix/posix_003_pos.ksh12
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/alloc_class/Makefile.am21
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/alloc_class/alloc_class_004_pos.ksh3
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/alloc_class/alloc_class_005_pos.ksh4
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/alloc_class/alloc_class_010_pos.ksh2
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/alloc_class/alloc_class_011_neg.ksh2
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/append/cleanup.ksh (renamed from sys/contrib/openzfs/tests/zfs-tests/tests/functional/threadsappend/cleanup.ksh)9
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/append/file_append.ksh73
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/append/setup.ksh (renamed from sys/contrib/openzfs/tests/zfs-tests/tests/functional/threadsappend/setup.ksh)7
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/append/threadsappend_001_pos.ksh (renamed from sys/contrib/openzfs/tests/zfs-tests/tests/functional/threadsappend/threadsappend_001_pos.ksh)0
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/arc/Makefile.am8
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/arc/dbufstats_001_pos.ksh3
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/arc/setup.ksh2
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/atime/Makefile.am14
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/bootfs/Makefile.am12
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/bootfs/bootfs_001_pos.ksh6
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/bootfs/bootfs_002_neg.ksh6
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/bootfs/bootfs_003_pos.ksh8
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/bootfs/bootfs_004_neg.ksh6
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/bootfs/bootfs_006_pos.ksh10
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/btree/Makefile.am20
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/btree/btree_negative.ksh7
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/cache/Makefile.am20
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/cache/cache.kshlib8
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cache/cache_012_pos.ksh2
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/cachefile/Makefile.am12
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/cachefile/cachefile.cfg2
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/casenorm/Makefile.am25
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/casenorm/casenorm.kshlib14
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/casenorm/mixed_create_failure.ksh22
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/channel_program/Makefile.am6
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/channel_program/channel_common.kshlib35
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/channel_program/lua_core/Makefile.am46
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/channel_program/lua_core/tst.exists.ksh4
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/channel_program/lua_core/tst.integer_illegal.ksh4
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/channel_program/lua_core/tst.integer_overflow.ksh4
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/channel_program/lua_core/tst.language_functions_neg.ksh4
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/channel_program/lua_core/tst.language_functions_pos.ksh4
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/channel_program/lua_core/tst.return_large.ksh3
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/channel_program/lua_core/tst.return_nvlist_neg.ksh8
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/channel_program/lua_core/tst.return_nvlist_pos.ksh8
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/channel_program/lua_core/tst.timeout.ksh14
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/channel_program/synctask_core/Makefile.am53
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/channel_program/synctask_core/tst.terminate_by_signal.ksh13
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/chattr/Makefile.am6
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/chattr/setup.ksh4
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/checksum/.gitignore4
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/checksum/Makefile.am31
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/checksum/edonr_test.c215
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/checksum/filetest_001_pos.ksh5
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/checksum/run_edonr_test.ksh2
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/checksum/run_sha2_test.ksh2
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/checksum/run_skein_test.ksh2
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/checksum/sha2_test.c247
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/checksum/skein_test.c337
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/clean_mirror/Makefile.am12
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/Makefile.am67
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/cli_common.kshlib14
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zdb/Makefile.am20
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zdb/zdb_003_pos.ksh4
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zdb/zdb_004_pos.ksh6
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zdb/zdb_args_pos.ksh8
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zdb/zdb_block_size_histogram.ksh9
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zdb/zdb_checksum.ksh6
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zdb/zdb_decompress.ksh16
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zdb/zdb_decompress_zstd.ksh30
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zdb/zdb_display_block.ksh14
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zdb/zdb_object_range_neg.ksh2
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zdb/zdb_object_range_pos.ksh9
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zdb/zdb_objset_id.ksh56
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zdb/zdb_recover_2.ksh2
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs/Makefile.am7
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs/zfs_002_pos.ksh44
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs/zfs_003_neg.ksh14
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_bookmark/Makefile.am5
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_bookmark/zfs_bookmark_cliargs.ksh2
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_change-key/Makefile.am12
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_clone/Makefile.am17
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_clone/zfs_clone_003_pos.ksh1
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_clone/zfs_clone_007_pos.ksh3
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_clone/zfs_clone_010_pos.ksh2
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_copies/Makefile.am14
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_copies/zfs_copies_002_pos.ksh6
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_create/Makefile.am28
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_create/zfs_create_002_pos.ksh3
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_create/zfs_create_004_pos.ksh15
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_create/zfs_create_005_pos.ksh17
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_create/zfs_create_008_neg.ksh2
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_create/zfs_create_009_neg.ksh5
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_create/zfs_create_010_neg.ksh5
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_create/zfs_create_012_pos.ksh3
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_create/zfs_create_013_pos.ksh3
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_create/zfs_create_common.kshlib13
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_create/zfs_create_dryrun.ksh7
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_create/zfs_create_nomount.ksh2
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_create/zfs_create_verbose.ksh7
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_destroy/Makefile.am30
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_destroy/zfs_destroy_004_pos.ksh3
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_diff/.gitignore1
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_diff/Makefile.am18
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_diff/socket.c57
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_diff/zfs_diff_changes.ksh2
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_diff/zfs_diff_timestamp.ksh4
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_diff/zfs_diff_types.ksh10
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_get/Makefile.am18
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_get/zfs_get_001_pos.ksh7
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_get/zfs_get_002_pos.ksh2
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_get/zfs_get_003_pos.ksh5
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_get/zfs_get_004_pos.ksh9
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_get/zfs_get_005_neg.ksh4
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_get/zfs_get_008_pos.ksh7
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_get/zfs_get_009_pos.ksh11
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_ids_to_path/Makefile.am5
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_inherit/Makefile.am8
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_inherit/zfs_inherit_001_neg.ksh9
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_jail/Makefile.am6
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_load-key/Makefile.am18
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_load-key/zfs_load-key.ksh3
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_load-key/zfs_load-key_all.ksh3
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_load-key/zfs_load-key_common.kshlib3
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_mount/Makefile.am29
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_mount/zfs_mount.kshlib5
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_mount/zfs_mount_005_pos.ksh11
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_mount/zfs_mount_007_pos.ksh5
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_mount/zfs_multi_mount.ksh4
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_program/Makefile.am5
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_promote/Makefile.am16
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_property/Makefile.am5
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_property/zfs_written_property_001_pos.ksh5
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_receive/Makefile.am34
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_receive/zfs_receive_001_pos.ksh5
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_receive/zfs_receive_003_pos.ksh2
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_receive/zfs_receive_005_neg.ksh4
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_receive/zfs_receive_006_pos.ksh2
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_receive/zfs_receive_007_neg.ksh2
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_receive/zfs_receive_008_pos.ksh3
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_receive/zfs_receive_009_neg.ksh7
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_receive/zfs_receive_010_pos.ksh13
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_receive/zfs_receive_013_pos.ksh2
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_receive/zfs_receive_from_zstd.ksh28
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_receive/zfs_receive_new_props.ksh4
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_rename/Makefile.am26
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_rename/cleanup.ksh8
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_rename/setup.ksh9
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_rename/zfs_rename.kshlib7
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_rename/zfs_rename_014_neg.ksh6
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_rename/zfs_rename_nounmount.ksh11
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_reservation/Makefile.am6
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_reservation/zfs_reservation_002_pos.ksh12
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_rollback/Makefile.am12
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_rollback/zfs_rollback_common.kshlib21
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_send/Makefile.am20
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_send/zfs_send_001_pos.ksh8
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_send/zfs_send_002_pos.ksh8
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_send/zfs_send_006_pos.ksh4
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_send/zfs_send_007_pos.ksh9
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_set/Makefile.am35
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_set/canmount_001_pos.ksh10
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_set/canmount_002_pos.ksh10
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_set/canmount_003_pos.ksh4
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_set/mountpoint_001_pos.ksh4
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_set/mountpoint_002_pos.ksh4
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_set/mountpoint_003_pos.ksh9
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_set/property_alias_001_pos.ksh8
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_set/reservation_001_neg.ksh10
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_set/ro_props_001_pos.ksh7
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_set/snapdir_001_pos.ksh25
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_set/user_property_004_pos.ksh23
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_set/version_001_neg.ksh6
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_set/zfs_set_001_neg.ksh6
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_set/zfs_set_common.kshlib73
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_share/Makefile.am21
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_share/zfs_share_005_pos.ksh9
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_share/zfs_share_007_neg.ksh5
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_share/zfs_share_009_neg.ksh3
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_share/zfs_share_011_pos.ksh14
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_share/zfs_share_013_pos.ksh24
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_share/zfs_share_concurrent_shares.ksh133
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_snapshot/Makefile.am16
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_snapshot/zfs_snapshot_004_neg.ksh6
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_snapshot/zfs_snapshot_005_neg.ksh4
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_snapshot/zfs_snapshot_007_neg.ksh7
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_snapshot/zfs_snapshot_009_pos.ksh8
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_sysfs/Makefile.am10
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_unload-key/Makefile.am7
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_unload-key/zfs_unload-key_all.ksh3
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_unmount/Makefile.am20
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_unmount/zfs_unmount.kshlib2
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_unmount/zfs_unmount_006_pos.ksh1
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_unshare/Makefile.am11
l---------[-rwxr-xr-x]sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_unshare/setup.ksh40
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_unshare/zfs_unshare_001_pos.ksh4
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_unshare/zfs_unshare_002_pos.ksh3
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_unshare/zfs_unshare_006_pos.ksh23
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_unshare/zfs_unshare_008_pos.ksh58
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_upgrade/Makefile.am14
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_upgrade/zfs_upgrade_001_pos.ksh20
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_upgrade/zfs_upgrade_002_pos.ksh6
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_wait/Makefile.am9
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zhack/Makefile.am3
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool/Makefile.am8
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool/zpool_002_pos.ksh39
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool/zpool_003_pos.ksh39
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool/zpool_colors.ksh16
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_add/Makefile.am22
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_add/add-o_ashift.ksh16
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_add/add_nested_replacing_spare.ksh4
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_add/add_prop_ashift.ksh16
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_add/zpool_add.kshlib12
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_add/zpool_add_003_pos.ksh6
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_attach/Makefile.am6
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_attach/attach-o_ashift.ksh15
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_clear/Makefile.am11
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_clear/zpool_clear_001_pos.ksh99
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_create/Makefile.am50
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_create/create-o_ashift.ksh12
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create.shlib7
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_005_pos.ksh4
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_012_neg.ksh7
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_016_pos.ksh8
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_020_pos.ksh15
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_021_pos.ksh16
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_022_pos.ksh15
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_023_neg.ksh2
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_024_pos.ksh25
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_tempname.ksh6
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_destroy/Makefile.am8
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_destroy/zpool_destroy.cfg2
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_detach/Makefile.am5
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_events/.gitignore1
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_events/Makefile.am26
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_events/ereports.c173
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_events/zpool_events_clear_retained.ksh11
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_events/zpool_events_cliargs.ksh2
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_events/zpool_events_duplicates.ksh9
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_events/zpool_events_errors.ksh4
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_events/zpool_events_follow.ksh4
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_events/zpool_events_poolname.ksh13
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_expand/Makefile.am12
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_expand/zpool_expand_001_pos.ksh21
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_expand/zpool_expand_002_pos.ksh29
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_expand/zpool_expand_003_neg.ksh29
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_export/Makefile.am12
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_export/zpool_export.cfg6
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_export/zpool_export_002_pos.ksh17
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_get/Makefile.am12
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_get/zpool_get.cfg3
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_get/zpool_get_002_pos.ksh15
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_get/zpool_get_003_pos.ksh10
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_get/zpool_get_005_pos.ksh9
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_history/Makefile.am6
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_import/Makefile.am51
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_import/blockfiles/Makefile.am5
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_import/import_cachefile_shared_device.ksh8
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_import/import_rewind_config_changed.ksh8
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_import/zpool_import.kshlib61
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_import/zpool_import_001_pos.ksh9
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_import/zpool_import_002_pos.ksh7
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_import/zpool_import_012_pos.ksh7
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_import/zpool_import_all_001_pos.ksh11
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_import/zpool_import_errata3.ksh8
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_import/zpool_import_errata4.ksh18
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_import/zpool_import_features_002_neg.ksh6
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_import/zpool_import_missing_001_pos.ksh8
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_import/zpool_import_missing_003_pos.ksh13
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_import/zpool_import_rename_001_pos.ksh7
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_initialize/Makefile.am18
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_initialize/zpool_initialize_verify_initialized.ksh7
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_labelclear/Makefile.am9
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_offline/Makefile.am7
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_offline/zpool_offline_001_pos.ksh25
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_offline/zpool_offline_003_pos.ksh5
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_online/Makefile.am6
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_online/zpool_online_001_pos.ksh20
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_remove/Makefile.am10
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_reopen/Makefile.am15
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_reopen/zpool_reopen.cfg7
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_reopen/zpool_reopen.shlib13
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_replace/Makefile.am7
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_replace/replace-o_ashift.ksh14
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_replace/replace_prop_ashift.ksh14
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_resilver/Makefile.am9
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_resilver/zpool_resilver.cfg5
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_scrub/Makefile.am16
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_scrub/zpool_scrub.cfg4
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_set/Makefile.am9
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_set/zpool_set_001_pos.ksh2
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_split/Makefile.am19
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_split/zpool_split.cfg2
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_split/zpool_split_devices.ksh2
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_split/zpool_split_indirect.ksh4
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_split/zpool_split_props.ksh5
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_split/zpool_split_vdevs.ksh6
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_split/zpool_split_wholedisk.ksh2
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_status/Makefile.am7
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_status/zpool_status_003_pos.ksh70
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_status/zpool_status_004_pos.ksh81
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_sync/Makefile.am6
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_trim/Makefile.am25
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_upgrade/Makefile.am20
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_upgrade/blockfiles/Makefile.am54
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_upgrade/zpool_upgrade.kshlib3
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_upgrade/zpool_upgrade_008_pos.ksh2
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_wait/Makefile.am22
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_wait/scan/Makefile.am11
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_wait/zpool_wait.kshlib2
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_user/Makefile.am6
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_user/misc/Makefile.am52
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_user/misc/arc_summary_001_pos.ksh27
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_user/misc/arc_summary_002_neg.ksh4
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_user/misc/arcstat_001_pos.ksh5
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_user/misc/zdb_001_neg.ksh12
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_user/misc/zfs_001_neg.ksh2
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_user/misc/zfs_allow_001_neg.ksh11
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_user/misc/zfs_share_001_neg.ksh11
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_user/misc/zfs_unallow_001_neg.ksh9
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_user/misc/zfs_unshare_001_neg.ksh12
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_user/misc/zpool_001_neg.ksh2
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_user/misc/zpool_get_001_neg.ksh4
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_user/misc/zpool_set_001_neg.ksh2
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_user/zfs_list/Makefile.am15
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_user/zfs_list/zfs_list.kshlib2
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_user/zfs_list/zfs_list_003_pos.ksh5
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_user/zfs_list/zfs_list_007_pos.ksh9
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_user/zpool_iostat/Makefile.am12
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_user/zpool_iostat/zpool_iostat_002_pos.ksh2
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_user/zpool_list/Makefile.am6
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_user/zpool_status/Makefile.am8
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/compression/Makefile.am17
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/compression/compress_001_pos.ksh4
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/compression/compress_002_pos.ksh4
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/compression/l2arc_compressed_arc.ksh2
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/compression/l2arc_compressed_arc_disabled.ksh2
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/compression/l2arc_encrypted.ksh2
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/compression/l2arc_encrypted_no_compressed_arc.ksh2
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/cp_files/.gitignore1
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/cp_files/Makefile.am13
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/cp_files/cp_files.c58
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/cp_files/cp_files_001_pos.ksh7
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/crtime/Makefile.am5
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/ctime/.gitignore1
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/ctime/Makefile.am13
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/ctime/ctime.c377
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/ctime/ctime_001_pos.ksh2
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/deadman/Makefile.am8
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/delegate/Makefile.am28
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/delegate/delegate_common.kshlib71
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/delegate/setup.ksh4
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/delegate/zfs_allow_001_pos.ksh6
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/devices/Makefile.am11
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/dos_attributes/Makefile.am8
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/events/.gitignore1
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/events/Makefile.am18
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/events/events.cfg2
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/events/events_002_pos.ksh18
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/events/events_common.kshlib21
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/events/zed_fd_spill-zedlet.c36
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/events/zed_fd_spill.ksh9
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/exec/Makefile.am9
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/exec/exec_002_neg.ksh20
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/fallocate/Makefile.am6
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/fallocate/fallocate_punch-hole.ksh35
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/fallocate/fallocate_zero-range.ksh119
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/fallocate/setup.ksh5
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/fault/Makefile.am20
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/fault/auto_offline_001_pos.ksh9
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/fault/auto_online_001_pos.ksh15
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/fault/auto_replace_001_pos.ksh4
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/fault/auto_spare_shared.ksh5
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/fault/fault.cfg7
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/fault/zpool_status_-s.ksh13
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/features/Makefile.am3
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/features/async_destroy/Makefile.am5
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/features/large_dnode/Makefile.am13
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/features/large_dnode/large_dnode_001_pos.ksh2
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/features/large_dnode/large_dnode_005_pos.ksh4
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/features/large_dnode/large_dnode_009_pos.ksh2
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/grow/Makefile.am7
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/history/Makefile.am23
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/history/history_001_pos.ksh1
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/history/history_003_pos.ksh9
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/history/history_004_pos.ksh4
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/history/history_005_neg.ksh8
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/history/history_006_neg.ksh6
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/history/history_007_pos.ksh14
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/history/history_008_pos.ksh3
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/history/history_010_pos.ksh6
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/history/history_common.kshlib86
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/hkdf/Makefile.am17
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/hkdf/cleanup.ksh22
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/hkdf/run_hkdf_test.ksh30
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/hkdf/setup.ksh22
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/inheritance/Makefile.am57
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/inheritance/inherit.kshlib14
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/inheritance/inherit_001_pos.ksh10
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/inuse/Makefile.am14
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/inuse/inuse_001_pos.ksh8
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/inuse/inuse_003_pos.ksh24
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/inuse/inuse_004_pos.ksh18
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/inuse/inuse_006_pos.ksh2
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/inuse/inuse_007_pos.ksh2
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/io/Makefile.am13
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/io/io_uring.ksh2
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/io/libaio.ksh2
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/io/mmap.ksh2
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/io/posixaio.ksh2
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/io/psync.ksh2
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/io/sync.ksh2
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/l2arc/Makefile.am15
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/l2arc/l2arc_arcstats_pos.ksh2
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/l2arc/l2arc_l2miss_pos.ksh2
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/l2arc/l2arc_mfuonly_pos.ksh2
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/l2arc/persist_l2arc_001_pos.ksh5
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/l2arc/persist_l2arc_002_pos.ksh5
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/l2arc/persist_l2arc_003_neg.ksh2
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/l2arc/persist_l2arc_004_pos.ksh5
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/l2arc/persist_l2arc_005_pos.ksh5
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/large_files/Makefile.am6
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/largest_pool/Makefile.am6
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/largest_pool/largest_pool_001_pos.ksh5
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/libzfs/Makefile.am17
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/libzfs/many_fds.c54
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/limits/Makefile.am9
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/link_count/Makefile.am6
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/log_spacemap/Makefile.am2
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/log_spacemap/log_spacemap_import_logs.ksh7
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/migration/Makefile.am20
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/migration/cleanup.ksh6
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/migration/migration.cfg7
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/migration/migration.kshlib58
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/migration/migration_001_pos.ksh11
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/migration/migration_002_pos.ksh19
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/migration/migration_003_pos.ksh19
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/migration/migration_004_pos.ksh19
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/migration/migration_005_pos.ksh27
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/migration/migration_006_pos.ksh19
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/migration/migration_007_pos.ksh11
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/migration/migration_008_pos.ksh19
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/migration/migration_009_pos.ksh19
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/migration/migration_010_pos.ksh11
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/migration/migration_011_pos.ksh19
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/migration/migration_012_pos.ksh19
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/migration/setup.ksh3
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/mmap/Makefile.am11
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/mmap/mmap_libaio_001_pos.ksh4
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/mmap/mmap_sync_001_pos.ksh63
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/mmp/Makefile.am21
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/mmp/mmp.kshlib56
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/mmp/mmp_on_off.ksh6
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/mmp/mmp_on_thread.ksh4
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/mmp/mmp_write_distribution.ksh10
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/mount/Makefile.am7
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/mount/umount_unlinked_drain.ksh4
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/mount/umountall_001.ksh9
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/mv_files/Makefile.am11
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/mv_files/cleanup.ksh7
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/mv_files/mv_files.cfg2
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/mv_files/mv_files_001_pos.ksh6
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/mv_files/mv_files_002_pos.ksh7
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/mv_files/mv_files_common.kshlib4
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/nestedfs/Makefile.am5
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/no_space/Makefile.am12
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/no_space/enospc_002_pos.ksh4
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/no_space/enospc_df.ksh4
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/no_space/enospc_rm.ksh2
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/nopwrite/Makefile.am15
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/online_offline/Makefile.am10
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/online_offline/online_offline.cfg2
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/online_offline/online_offline_001_pos.ksh15
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/online_offline/online_offline_002_neg.ksh6
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/pam/.gitignore1
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/pam/Makefile.am8
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/pam/cleanup.ksh6
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/pam/setup.ksh5
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/pam/utilities.kshlib.in (renamed from sys/contrib/openzfs/tests/zfs-tests/tests/functional/pam/utilities.kshlib)15
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/pool_checkpoint/Makefile.am26
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/pool_checkpoint/checkpoint_lun_expsz.ksh10
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/pool_checkpoint/checkpoint_zdb.ksh42
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/pool_names/Makefile.am4
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/poolversion/Makefile.am6
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/poolversion/poolversion_001_pos.ksh3
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/poolversion/poolversion_002_pos.ksh4
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/privilege/Makefile.am6
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/privilege/setup.ksh3
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/procfs/Makefile.am8
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/procfs/pool_state.ksh2
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/procfs/procfs_list_basic.ksh6
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/procfs/procfs_list_concurrent_readers.ksh5
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/procfs/procfs_list_stale_read.ksh4
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/projectquota/Makefile.am27
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/projectquota/projectquota_003_pos.ksh10
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/projectquota/projectquota_common.kshlib15
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/projectquota/projectspace_004_pos.ksh4
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/projectquota/setup.ksh4
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/pyzfs/Makefile.am7
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/pyzfs/pyzfs_unittest.ksh.in15
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/quota/Makefile.am14
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/quota/quota.kshlib4
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/raidz/Makefile.am8
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/redacted_send/Makefile.am26
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/redacted_send/redacted.cfg6
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/redacted_send/redacted.kshlib6
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/redacted_send/redacted_embedded.ksh18
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/redacted_send/redacted_props.ksh4
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/redacted_send/redacted_resume.ksh4
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/redacted_send/redacted_size.ksh21
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/redundancy/Makefile.am22
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/redundancy/redundancy.kshlib30
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/redundancy/redundancy_draid.ksh4
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/redundancy/redundancy_draid_spare3.ksh4
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/redundancy/redundancy_raidz.ksh4
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/refquota/Makefile.am12
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/refreserv/Makefile.am14
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/refreserv/refreserv_002_pos.ksh3
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/removal/Makefile.am38
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/removal/removal.kshlib7
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/removal/remove_attach_mirror.ksh2
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/removal/remove_mirror_sanity.ksh4
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/rename_dirs/Makefile.am5
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/rename_dirs/rename_dirs_001_pos.ksh5
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/replacement/Makefile.am21
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/replacement/attach_rebuild.ksh10
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/replacement/attach_resilver.ksh10
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/replacement/detach.ksh10
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/replacement/rebuild_disabled_feature.ksh3
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/replacement/replace_rebuild.ksh5
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/replacement/replace_resilver.ksh5
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/replacement/resilver_restart_001.ksh2
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/replacement/resilver_restart_002.ksh10
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/reservation/Makefile.am30
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/reservation/reservation.shlib18
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/reservation/reservation_001_pos.ksh8
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/reservation/reservation_013_pos.ksh2
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/rootpool/Makefile.am7
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/rootpool/rootpool_002_neg.ksh2
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/rootpool/setup.ksh2
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/rsend/Makefile.am73
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/rsend/rsend.cfg5
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/rsend/rsend.kshlib111
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/rsend/rsend_011_pos.ksh8
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/rsend/rsend_012_pos.ksh36
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/rsend/send-c_props.ksh19
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/rsend/send-c_stream_size_estimate.ksh28
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/rsend/send-c_zstreamdump.ksh6
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/rsend/send-cpL_varied_recsize.ksh2
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/rsend/send_doall.ksh12
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/rsend/send_encrypted_truncated_files.ksh4
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/scrub_mirror/Makefile.am12
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/simd/Makefile.am2
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/simd/simd_supported.ksh10
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/slog/Makefile.am27
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/slog/slog.kshlib2
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/slog/slog_014_pos.ksh6
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/slog/slog_015_neg.ksh2
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/snapshot/Makefile.am28
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/snapshot/clone_001_pos.ksh8
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/snapshot/rollback_001_pos.ksh16
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/snapshot/rollback_002_pos.ksh22
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/snapshot/rollback_003_pos.ksh4
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/snapshot/snapshot_001_pos.ksh19
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/snapshot/snapshot_002_pos.ksh49
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/snapshot/snapshot_003_pos.ksh21
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/snapshot/snapshot_004_pos.ksh14
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/snapshot/snapshot_005_pos.ksh21
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/snapshot/snapshot_006_pos.ksh40
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/snapshot/snapshot_007_pos.ksh25
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/snapshot/snapshot_008_pos.ksh11
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/snapshot/snapshot_011_pos.ksh13
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/snapshot/snapshot_013_pos.ksh8
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/snapshot/snapshot_014_pos.ksh3
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/snapused/Makefile.am12
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/sparse/Makefile.am8
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/sparse/sparse.cfg2
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/stat/Makefile.am8
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/suid/.gitignore1
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/suid/Makefile.am17
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/suid/suid_write_to_file.c133
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/suid/suid_write_to_none.ksh2
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/suid/suid_write_to_sgid.ksh2
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/suid/suid_write_to_suid.ksh2
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/suid/suid_write_to_suid_sgid.ksh2
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/suid/suid_write_zil_replay.ksh16
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/threadsappend/.gitignore1
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/threadsappend/Makefile.am8
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/tmpfile/Makefile.am16
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/trim/Makefile.am12
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/trim/trim.kshlib13
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/trim/trim_l2arc.ksh6
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/truncate/.gitignore1
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/truncate/Makefile.am18
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/truncate/truncate.cfg2
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/truncate/truncate_test.c103
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/truncate/truncate_timestamps.ksh4
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/upgrade/Makefile.am10
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/upgrade/upgrade_projectquota_001_pos.ksh2
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/user_namespace/Makefile.am9
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/user_namespace/user_namespace_001.ksh4
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/userquota/Makefile.am29
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/userquota/setup.ksh4
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/userquota/userquota_004_pos.ksh10
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/userquota/userquota_common.kshlib20
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/userquota/userspace_encrypted.ksh3
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/vdev_zaps/Makefile.am14
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/vdev_zaps/vdev_zaps.kshlib44
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/vdev_zaps/vdev_zaps_001_pos.ksh2
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/vdev_zaps/vdev_zaps_002_pos.ksh2
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/vdev_zaps/vdev_zaps_003_pos.ksh2
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/vdev_zaps/vdev_zaps_004_pos.ksh8
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/vdev_zaps/vdev_zaps_005_pos.ksh4
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/vdev_zaps/vdev_zaps_006_pos.ksh2
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/vdev_zaps/vdev_zaps_007_pos.ksh6
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/write_dirs/Makefile.am6
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/xattr/Makefile.am22
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/xattr/cleanup.ksh4
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/xattr/setup.ksh3
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/xattr/xattr_003_neg.ksh4
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/xattr/xattr_004_pos.ksh2
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/xattr/xattr_010_neg.ksh2
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/xattr/xattr_011_pos.ksh8
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/xattr/xattr_012_pos.ksh21
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/xattr/xattr_013_pos.ksh6
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/xattr/xattr_common.kshlib18
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/zpool_influxdb/Makefile.am5
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/zpool_influxdb/zpool_influxdb.ksh11
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/zvol/Makefile.am10
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/zvol/zvol_ENOSPC/Makefile.am8
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/zvol/zvol_ENOSPC/zvol_ENOSPC.cfg2
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/zvol/zvol_cli/Makefile.am10
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/zvol/zvol_cli/zvol_cli.cfg2
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/zvol/zvol_common.shlib9
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/zvol/zvol_misc/Makefile.am19
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/zvol/zvol_misc/zvol_misc_002_pos.ksh15
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/zvol/zvol_misc/zvol_misc_004_pos.ksh5
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/zvol/zvol_misc/zvol_misc_005_neg.ksh5
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/zvol/zvol_misc/zvol_misc_common.kshlib5
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/zvol/zvol_swap/Makefile.am13
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/zvol/zvol_swap/cleanup.ksh4
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/zvol/zvol_swap/setup.ksh4
-rw-r--r--sys/contrib/openzfs/tests/zfs-tests/tests/functional/zvol/zvol_swap/zvol_swap.cfg6
-rwxr-xr-xsys/contrib/openzfs/tests/zfs-tests/tests/functional/zvol/zvol_swap/zvol_swap_003_pos.ksh2
651 files changed, 2090 insertions, 8111 deletions
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/Makefile.am
deleted file mode 100644
index 9164650e3419..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/Makefile.am
+++ /dev/null
@@ -1,95 +0,0 @@
-SUBDIRS = \
- acl \
- alloc_class \
- arc \
- atime \
- bootfs \
- btree \
- cache \
- cachefile \
- casenorm \
- channel_program \
- chattr \
- checksum \
- clean_mirror \
- cli_root \
- cli_user \
- compression \
- cp_files \
- crtime \
- ctime \
- deadman \
- delegate \
- devices \
- dos_attributes \
- events \
- exec \
- fallocate \
- fault \
- features \
- grow \
- history \
- hkdf \
- inheritance \
- inuse \
- io \
- l2arc \
- large_files \
- largest_pool \
- libzfs \
- limits \
- link_count \
- log_spacemap \
- migration \
- mmap \
- mmp \
- mount \
- mv_files \
- nestedfs \
- no_space \
- nopwrite \
- online_offline \
- pam \
- pool_checkpoint \
- pool_names \
- poolversion \
- privilege \
- procfs \
- projectquota \
- pyzfs \
- quota \
- raidz \
- redacted_send \
- redundancy \
- refquota \
- refreserv \
- removal \
- rename_dirs \
- replacement \
- reservation \
- rootpool \
- rsend \
- scrub_mirror \
- slog \
- snapshot \
- snapused \
- sparse \
- stat \
- suid \
- threadsappend \
- trim \
- truncate \
- upgrade \
- user_namespace \
- userquota \
- vdev_zaps \
- write_dirs \
- xattr \
- zpool_influxdb \
- zvol
-
-if BUILD_LINUX
-SUBDIRS += \
- simd \
- tmpfile
-endif
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/acl/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/acl/Makefile.am
deleted file mode 100644
index d752f63744cb..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/acl/Makefile.am
+++ /dev/null
@@ -1,6 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/acl
-dist_pkgdata_DATA = \
- acl.cfg \
- acl_common.kshlib
-
-SUBDIRS = off posix posix-sa
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/acl/acl_common.kshlib b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/acl/acl_common.kshlib
index ba08bcb48bef..5f4f91485e8e 100644
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/acl/acl_common.kshlib
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/acl/acl_common.kshlib
@@ -32,21 +32,6 @@
. $STF_SUITE/include/libtest.shlib
#
-# Get the given file/directory access mode
-#
-# $1 object -- file or directory
-#
-function get_mode #<obj>
-{
- typeset obj=$1
- if (( ${#obj} == 0 )); then
- return 1
- fi
-
- ls -ld $obj | awk '{print $1}'
-}
-
-#
# Get the given file/directory ACL
#
# $1 object -- file or directory
@@ -58,7 +43,7 @@ function get_acl #<obj>
return 1
fi
- ls -vd $obj | nawk '(NR != 1) {print $0}'
+ ls -vd $obj | awk '(NR != 1) {print $0}'
}
#
@@ -73,7 +58,7 @@ function get_compact_acl #<obj>
return 1
fi
- ls -Vd $obj | nawk '(NR != 1) {print $0}'
+ ls -Vd $obj | awk '(NR != 1) {print $0}'
}
#
@@ -98,7 +83,7 @@ function compare_acls #<src> <tgt>
get_acl $src > $tmpsrc
get_acl $tgt > $tmptgt
typeset -i ret=0
- diff $tmpsrc $tmptgt > /dev/null 2>&1
+ cmp $tmpsrc $tmptgt > /dev/null
ret=$?
rm -f $tmpsrc $tmptgt
@@ -108,7 +93,7 @@ function compare_acls #<src> <tgt>
get_compact_acl $src > $tmpsrc
get_compact_acl $tgt > $tmptgt
- diff $tmpsrc $tmptgt > /dev/null 2>&1
+ cmp $tmpsrc $tmptgt > /dev/null
ret=$?
rm -f $tmpsrc $tmptgt
@@ -116,36 +101,6 @@ function compare_acls #<src> <tgt>
}
#
-# Check that the given two objects have the same modes.
-# Return 0, if their modes are equal with each other. Otherwise, return 1.
-#
-# $1 source object
-# $2 target object
-#
-function compare_modes #<src> <tgt>
-{
- typeset src=$1
- typeset tgt=$2
- typeset -i i=0
- set -A mode
-
- (( ${#src} == 0 || ${#tgt} == 0 )) && return 1
- [[ $src == $tgt ]] && return 0
-
- typeset obj
- for obj in $src $tgt
- do
- mode[i]=$(get_mode $obj)
-
- (( i = i + 1 ))
- done
-
- [[ ${mode[0]} != ${mode[1]} ]] && return 1
-
- return 0
-}
-
-#
# Check that the given two objects have the same xattrs.
# Return 0, if their xattrs are equal with each other. Otherwise, return 1.
#
@@ -166,7 +121,7 @@ function compare_xattrs #<src> <tgt>
get_xattr $src > $tmpsrc
get_xattr $tgt > $tmptgt
typeset -i ret=0
- diff $tmpsrc $tmptgt > /dev/null 2>&1
+ cmp $tmpsrc $tmptgt > /dev/null
ret=$?
rm -f $tmpsrc $tmptgt
@@ -174,62 +129,6 @@ function compare_xattrs #<src> <tgt>
}
#
-# Check '+' is set for a given file/directory with 'ls [-l]' command
-#
-# $1 object -- file or directory.
-#
-function plus_sign_check_l #<obj>
-{
- typeset obj=$1
- if (( ${#obj} == 0 )); then
- return 1
- fi
-
- ls -ld $obj | awk '{print $1}' | grep "+$" > /dev/null
-
- return $?
-}
-
-#
-# Check '+' is set for a given file/directory with 'ls [-v]' command
-#
-# $1 object -- file or directory.
-#
-function plus_sign_check_v #<obj>
-{
- typeset obj=$1
- if (( ${#obj} == 0 )); then
- return 1
- fi
-
- ls -vd $obj | awk '(NR == 1) {print $1}' | grep "+$" > /dev/null
-
- return $?
-}
-
-#
-# A wrapper function of c program
-#
-# $1 legal login name
-# $2-n commands and options
-#
-function chgusr_exec #<login_name> <commands> [...]
-{
- chg_usr_exec $@
- return $?
-}
-
-#
-# Export the current user for the following usr_exec operating.
-#
-# $1 legal login name
-#
-function set_cur_usr #<login_name>
-{
- export ZFS_ACL_CUR_USER=$1
-}
-
-#
# Run commands by $ZFS_ACL_CUR_USER
#
# $1-n commands and options
@@ -237,83 +136,6 @@ function set_cur_usr #<login_name>
function usr_exec #<commands> [...]
{
chg_usr_exec "$ZFS_ACL_CUR_USER" $@
- return $?
-}
-
-#
-# Count how many ACEs for the specified file or directory.
-#
-# $1 file or directory name
-#
-function count_ACE #<file or dir name>
-{
- if [[ ! -e $1 ]]; then
- log_note "Need input file or directory name."
- return 1
- fi
-
- ls -vd $1 | nawk 'BEGIN {count=0}
- (NR != 1)&&(/[0-9]:/) {count++}
- END {print count}'
-
- return 0
-}
-
-#
-# Get specified number ACE content of specified file or directory.
-#
-# $1 file or directory name
-# $2 specified number
-#
-function get_ACE #<file or dir name> <specified number> <verbose|compact>
-{
- if [[ ! -e $1 || $2 -ge $(count_ACE $1) ]]; then
- return 1
- fi
-
- typeset file=$1
- typeset -i num=$2
- typeset format=${3:-verbose}
- typeset -i next_num=-1
-
- typeset tmpfile=$TEST_BASE_DIR/tmp_get_ACE.$$
- typeset line=""
- typeset args
-
- case $format in
- verbose) args="-vd"
- ;;
- compact) args="-Vd"
- ;;
- *) log_fail "Invalid parameter as ($format), " \
- "only verbose|compact is supported."
- ;;
- esac
-
- ls $args $file > $tmpfile
- (( $? != 0 )) && log_fail "FAIL: ls $args $file > $tmpfile"
- while read line; do
- [[ -z $line ]] && continue
- if [[ $args == -vd ]]; then
- if [[ $line == "$num":* ]]; then
- (( next_num = num + 1 ))
- fi
- if [[ $line == "$next_num":* ]]; then
- break
- fi
- if (( next_num != -1 )); then
- print -n $line
- fi
- else
- if (( next_num == num )); then
- print -n $line
- fi
- (( next_num += 1 ))
- fi
- done < $tmpfile
-
- rm -f $tmpfile
- (( $? != 0 )) && log_fail "FAIL: rm -f $tmpfile"
}
#
@@ -346,57 +168,6 @@ function cleanup
}
#
-# According to specified access or acl_spec, do relevant operating by using the
-# specified user.
-#
-# $1 specified user
-# $2 node
-# $3 acl_spec or access
-#
-function rwx_node #user node acl_spec|access
-{
- typeset user=$1
- typeset node=$2
- typeset acl_spec=$3
-
- if [[ $user == "" || $node == "" || $acl_spec == "" ]]; then
- log_note "node or acl_spec are not defined."
- return 1
- fi
-
- if [[ -d $node ]]; then
- case $acl_spec in
- *:read_data:*|read_data)
- chgusr_exec $user ls -l $node > /dev/null 2>&1
- return $? ;;
- *:write_data:*|write_data)
- if [[ -f ${node}/tmpfile ]]; then
- log_must rm -f ${node}/tmpfile
- fi
- chgusr_exec $user touch ${node}/tmpfile > \
- /dev/null 2>&1
- return $? ;;
- *"execute:"*|execute)
- chgusr_exec $user find $node > /dev/null 2>&1
- return $? ;;
- esac
- else
- case $acl_spec in
- *:read_data:*|read_data)
- chgusr_exec $user cat $node > /dev/null 2>&1
- return $? ;;
- *:write_data:*|write_data)
- chgusr_exec $user dd if=/usr/bin/ls of=$node > \
- /dev/null 2>&1
- return $? ;;
- *"execute:"*|execute)
- ZFS_ACL_ERR_STR=$(chgusr_exec $user $node 2>&1)
- return $? ;;
- esac
- fi
-}
-
-#
# Get the given file/directory xattr
#
# $1 object -- file or directory
@@ -409,134 +180,12 @@ function get_xattr #<obj>
return 1
fi
- for xattr in `runat $obj ls | \
- grep -E -v -e SUNWattr_ro -e SUNWattr_rw` ; do
- runat $obj sum $xattr
+ for xattr in $(runat $obj ls | grep -v 'SUNWattr_r[ow]'); do
+ runat $obj cksum $xattr
done
}
#
-# Get the owner of a file/directory
-#
-function get_owner #node
-{
- typeset node=$1
- typeset value
-
- if [[ -z $node ]]; then
- log_fail "node are not defined."
- fi
-
- if [[ -d $node ]]; then
- value=$(ls -dl $node | awk '{print $3}')
- elif [[ -e $node ]]; then
- value=$(ls -l $node | awk '{print $3}')
- fi
-
- echo $value
-}
-
-#
-# Get the group of a file/directory
-#
-function get_group #node
-{
- typeset node=$1
- typeset value
-
- if [[ -z $node ]]; then
- log_fail "node are not defined."
- fi
-
- if [[ -d $node ]]; then
- value=$(ls -dl $node | awk '{print $4}')
- elif [[ -e $node ]]; then
- value=$(ls -l $node | awk '{print $4}')
- fi
-
- echo $value
-}
-
-
-#
-# Get the group name that a UID belongs to
-#
-function get_user_group #uid
-{
- typeset uid=$1
- typeset value
-
- if [[ -z $uid ]]; then
- log_fail "UID not defined."
- fi
-
- value=$(id $uid)
-
- if [[ $? -eq 0 ]]; then
- value=${value##*\(}
- value=${value%%\)*}
- echo $value
- else
- log_fail "Invalid UID (uid)."
- fi
-}
-
-#
-# Get the specified item of the specified string
-#
-# $1: Item number, count from 0.
-# $2-n: strings
-#
-function getitem
-{
- typeset -i n=$1
- shift
-
- (( n += 1 ))
- eval echo \${$n}
-}
-
-#
-# This function calculate the specified directory files checksum and write
-# to the specified array.
-#
-# $1 directory in which the files will be cksum.
-# $2 file array name which was used to store file cksum information.
-# $3 attribute array name which was used to store attribute information.
-#
-function cksum_files #<dir> <file_array_name> <attribute_array_name>
-{
- typeset dir=$1
- typeset farr_name=$2
- typeset aarr_name=$3
-
- [[ ! -d $dir ]] && return
- typeset oldpwd=$PWD
- cd $dir
- typeset files=$(ls file*)
-
- typeset -i i=0
- typeset -i n=0
- while (( i < NUM_FILE )); do
- typeset f=$(getitem $i $files)
- eval $farr_name[$i]=\$\(\cksum $f\)
-
- typeset -i j=0
- while (( j < NUM_ATTR )); do
- eval $aarr_name[$n]=\$\(\runat \$f \cksum \
- attribute.$j\)
-
- (( j += 1 ))
- (( n += 1 ))
- done
-
- (( i += 1 ))
- done
-
- cd $oldpwd
-}
-
-#
# This function compare two cksum results array.
#
# $1 The array name which stored the cksum before operation.
@@ -564,26 +213,6 @@ function compare_cksum #<array1> <array2>
}
#
-# This function calculate all the files cksum information in current directory
-# and output them to the specified file.
-#
-# $1 directory from which the files will be cksum.
-# $2 cksum output file
-#
-function record_cksum #<outfile>
-{
- typeset dir=$1
- typeset outfile=$2
-
- [[ ! -d ${outfile%/*} ]] && usr_exec mkdir -p ${outfile%/*}
-
- usr_exec cd $dir ; find . -depth -type f -exec cksum {} \\\; | \
- sort > $outfile
- usr_exec cd $dir ; find . -depth -type f -xattr -exec runat {} \
- cksum attribute* \\\; | sort >> $outfile
-}
-
-#
# The function create_files creates the directories and files that the script
# will operate on to test extended attribute functionality.
#
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/acl/off/.gitignore b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/acl/off/.gitignore
deleted file mode 100644
index f3c93191cea9..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/acl/off/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/dosmode_readonly_write
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/acl/off/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/acl/off/Makefile.am
deleted file mode 100644
index ae6a9c69d934..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/acl/off/Makefile.am
+++ /dev/null
@@ -1,14 +0,0 @@
-include $(top_srcdir)/config/Rules.am
-
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/acl/off
-
-dist_pkgdata_SCRIPTS = \
- dosmode.ksh \
- posixmode.ksh \
- cleanup.ksh \
- setup.ksh
-
-pkgexecdir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/acl/off
-
-pkgexec_PROGRAMS = dosmode_readonly_write
-dosmode_readonly_write_SOURCES = dosmode_readonly_write.c
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/acl/off/dosmode.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/acl/off/dosmode.ksh
index 585aa025390c..bab2109b9d58 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/acl/off/dosmode.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/acl/off/dosmode.ksh
@@ -55,18 +55,15 @@ function hasflag
typeset path=$2
if is_linux; then
- read_dos_attributes $path | awk \
- '{ gsub(",", "\n", $1); print $1 }' | grep -qxF $flag
+ read_dos_attributes $path
else
- ls -lo $path | awk '{ gsub(",", "\n", $5); print $5 }' | \
- grep -qxF $flag
- fi
+ ls -lo $path | awk '{ print $5 }'
+ fi | grep -qwF $flag
}
log_assert "Verify DOS mode flags function correctly"
log_onexit cleanup
-tests_base=$STF_SUITE/tests/functional/acl/off
testfile=$TESTDIR/testfile
owner=$ZFS_ACL_STAFF1
other=$ZFS_ACL_STAFF2
@@ -159,7 +156,7 @@ log_must rm $testfile
# READONLY is set. We have a special test program for that.
log_must user_run $owner touch $testfile
log_mustnot user_run $other $changeflags rdonly $testfile
-log_must user_run $owner $tests_base/dosmode_readonly_write $testfile
+log_must user_run $owner dosmode_readonly_write $testfile
log_mustnot user_run $other $changeflags nordonly $testfile
log_must hasflag rdonly $testfile
if ! is_linux; then
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/acl/off/dosmode_readonly_write.c b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/acl/off/dosmode_readonly_write.c
deleted file mode 100644
index 0441d1c7b472..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/acl/off/dosmode_readonly_write.c
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
- *
- * Copyright (c) 2021 iXsystems, Inc.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * Test for correct behavior of DOS mode READONLY flag on a file.
- * We should be able to open a file RW, set READONLY, and still write to the fd.
- */
-
-#include <sys/stat.h>
-#include <err.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <stdio.h>
-#include <string.h>
-#include <unistd.h>
-
-#ifdef __linux__
-#include <stdint.h>
-#include <sys/fs/zfs.h>
-#endif
-
-int
-main(int argc, const char *argv[])
-{
- const char *buf = "We should be allowed to write this to the fd.\n";
- const char *path;
- int fd;
-
- if (argc != 2) {
- fprintf(stderr, "usage: %s PATH\n", argv[0]);
- return (EXIT_FAILURE);
- }
- path = argv[1];
- fd = open(path, O_CREAT|O_RDWR, 0777);
- if (fd == -1)
- err(EXIT_FAILURE, "%s: open failed", path);
-#ifdef __linux__
- uint64_t dosflags = ZFS_READONLY;
- if (ioctl(fd, ZFS_IOC_SETDOSFLAGS, &dosflags) == -1)
- err(EXIT_FAILURE, "%s: ZFS_IOC_SETDOSFLAGS failed", path);
-#else
- if (chflags(path, UF_READONLY) == -1)
- err(EXIT_FAILURE, "%s: chflags failed", path);
-#endif
- if (write(fd, buf, strlen(buf)) == -1)
- err(EXIT_FAILURE, "%s: write failed", path);
- if (close(fd) == -1)
- err(EXIT_FAILURE, "%s: close failed", path);
- return (EXIT_SUCCESS);
-}
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/acl/posix-sa/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/acl/posix-sa/Makefile.am
deleted file mode 100644
index 31d1237ce265..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/acl/posix-sa/Makefile.am
+++ /dev/null
@@ -1,8 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/acl/posix-sa
-dist_pkgdata_SCRIPTS = \
- cleanup.ksh \
- setup.ksh \
- posix_001_pos.ksh \
- posix_002_pos.ksh \
- posix_003_pos.ksh \
- posix_004_pos.ksh
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/acl/posix/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/acl/posix/Makefile.am
deleted file mode 100644
index e63f63185afe..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/acl/posix/Makefile.am
+++ /dev/null
@@ -1,8 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/acl/posix
-dist_pkgdata_SCRIPTS = \
- cleanup.ksh \
- setup.ksh \
- posix_001_pos.ksh \
- posix_002_pos.ksh \
- posix_003_pos.ksh \
- posix_004_pos.ksh
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/acl/posix/posix_001_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/acl/posix/posix_001_pos.ksh
index d62bf9c346b6..65c15388cf20 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/acl/posix/posix_001_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/acl/posix/posix_001_pos.ksh
@@ -57,41 +57,41 @@ log_onexit cleanup
log_note "Testing access to FILE"
log_must touch $TESTDIR/file.0
log_must setfacl -m g:$ZFS_ACL_STAFF_GROUP:rw $TESTDIR/file.0
-getfacl $TESTDIR/file.0 2> /dev/null | egrep -q \
- "^group:$ZFS_ACL_STAFF_GROUP:rw-$"
-if [ "$?" -eq "0" ]; then
- # Should be able to write to file
- log_must user_run $ZFS_ACL_STAFF1 \
- "echo 'echo test > /dev/null' > $TESTDIR/file.0"
+if ! getfacl $TESTDIR/file.0 2> /dev/null |
+ grep -qFx "group:$ZFS_ACL_STAFF_GROUP:rw-"
+then
+ log_note "$(getfacl $TESTDIR/file.0 2> /dev/null)"
+ log_fail "Group '$ZFS_ACL_STAFF_GROUP' does not have 'rw' as specified"
+fi
- # Since $TESTDIR is 777, create a new dir with controlled permissions
- # for testing that creating a new file is not allowed.
- log_must mkdir $TESTDIR/dir.0
- log_must chmod 700 $TESTDIR/dir.0
- log_must setfacl -m g:$ZFS_ACL_STAFF_GROUP:rw $TESTDIR/dir.0
- # Confirm permissions
- ls -l $TESTDIR |grep "dir.0" |grep -q "drwxrw----+"
- if [ "$?" -ne "0" ]; then
- msk=$(ls -l $TESTDIR |grep "dir.0" | awk '{print $1}')
- log_note "expected mask drwxrw----+ but found $msk"
- log_fail "Expected permissions were not set."
- fi
- getfacl $TESTDIR/dir.0 2> /dev/null | egrep -q \
- "^group:$ZFS_ACL_STAFF_GROUP:rw-$"
- if [ "$?" -ne "0" ]; then
- acl=$(getfacl $TESTDIR/dir.0 2> /dev/null)
- log_note $acl
- log_fail "ACL group:$ZFS_ACL_STAFF_GROUP:rw- was not set."
- fi
- # Should NOT be able to create new file
- log_mustnot user_run $ZFS_ACL_STAFF1 "touch $TESTDIR/dir.0/file.1"
+# Should be able to write to file
+log_must user_run $ZFS_ACL_STAFF1 \
+ "echo 'echo test > /dev/null' > $TESTDIR/file.0"
- # Root should be able to run file, but not user
- chmod +x $TESTDIR/file.0
- log_must $TESTDIR/file.0
- log_mustnot user_run $ZFS_ACL_STAFF1 $TESTDIR/file.0
+# Since $TESTDIR is 777, create a new dir with controlled permissions
+# for testing that creating a new file is not allowed.
+log_must mkdir $TESTDIR/dir.0
+log_must chmod 700 $TESTDIR/dir.0
+log_must setfacl -m g:$ZFS_ACL_STAFF_GROUP:rw $TESTDIR/dir.0
+# Confirm permissions
+msk=$(ls -ld $TESTDIR/dir.0 | awk '{print $1}')
+if ! [ "$msk" = "drwxrw----+" ]; then
+ log_note "expected mask drwxrw----+ but found $msk"
+ log_fail "Expected permissions were not set."
+fi
- log_pass "POSIX ACL mode works on files"
-else
- log_fail "Group '$ZFS_ACL_STAFF_GROUP' does not have 'rw' as specified"
+if ! getfacl $TESTDIR/dir.0 2> /dev/null |
+ grep -qFx "group:$ZFS_ACL_STAFF_GROUP:rw-"
+then
+ log_note "$(getfacl $TESTDIR/dir.0 2> /dev/null)"
+ log_fail "ACL group:$ZFS_ACL_STAFF_GROUP:rw- was not set."
fi
+# Should NOT be able to create new file
+log_mustnot user_run $ZFS_ACL_STAFF1 "touch $TESTDIR/dir.0/file.1"
+
+# Root should be able to run file, but not user
+chmod +x $TESTDIR/file.0
+log_must $TESTDIR/file.0
+log_mustnot user_run $ZFS_ACL_STAFF1 $TESTDIR/file.0
+
+log_pass "POSIX ACL mode works on files"
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/acl/posix/posix_002_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/acl/posix/posix_002_pos.ksh
index d9b5036458f8..ac718ec58897 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/acl/posix/posix_002_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/acl/posix/posix_002_pos.ksh
@@ -53,15 +53,14 @@ log_must mkdir $TESTDIR/dir.0
log_must chmod 700 $TESTDIR/dir.0
log_must setfacl -m g:$ZFS_ACL_STAFF_GROUP:wx $TESTDIR/dir.0
# Confirm permissions
-ls -l $TESTDIR |grep "dir.0" |grep -q "drwx-wx---+"
-if [ "$?" -ne "0" ]; then
- msk=$(ls -l $TESTDIR |grep "dir.0" | awk '{print $1}')
+if ! ls -l $TESTDIR | grep "dir.0" | grep -q "drwx-wx---+"; then
+ msk=$(ls -l $TESTDIR | awk '/dir.0/ {print $1}')
log_note "expected mask drwx-wx---+ but found $msk"
log_fail "Expected permissions were not set."
fi
-getfacl $TESTDIR/dir.0 2> /dev/null | egrep -q \
- "^group:$ZFS_ACL_STAFF_GROUP:-wx$"
-if [ "$?" -eq "0" ]; then
+if getfacl $TESTDIR/dir.0 2> /dev/null |
+ grep -q "^group:$ZFS_ACL_STAFF_GROUP:-wx$"
+then
# Should be able to create file in directory
log_must user_run $ZFS_ACL_STAFF1 "touch $TESTDIR/dir.0/file.0"
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/acl/posix/posix_003_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/acl/posix/posix_003_pos.ksh
index 1b04a024f2ad..bdd77bd37603 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/acl/posix/posix_003_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/acl/posix/posix_003_pos.ksh
@@ -43,16 +43,14 @@ log_note "Testing access to DIRECTORY"
log_must mkdir $ACLDIR
log_must setfacl -m g:$ZFS_ACL_STAFF_GROUP:wx $ACLDIR
log_must setfacl -d -m g:$ZFS_ACL_STAFF_GROUP:wx $ACLDIR
-getfacl $ACLDIR 2> /dev/null | egrep -q "$acl_str1"
-if [ "$?" -eq "0" ]; then
- getfacl $ACLDIR 2> /dev/null | egrep -q "$acl_str2"
-fi
-if [ "$?" -eq "0" ]; then
+if getfacl $ACLDIR 2> /dev/null | grep -q "$acl_str1" &&
+ getfacl $ACLDIR 2> /dev/null | grep -q "$acl_str2"
+then
log_must zfs unmount $TESTPOOL/$TESTFS
log_must zfs mount $TESTPOOL/$TESTFS
- log_must eval "getfacl $ACLDIR 2> /dev/null | egrep -q \"$acl_str1\""
- log_must eval "getfacl $ACLDIR 2> /dev/null | egrep -q \"$acl_str2\""
+ log_must eval "getfacl $ACLDIR 2> /dev/null | grep -q \"$acl_str1\""
+ log_must eval "getfacl $ACLDIR 2> /dev/null | grep -q \"$acl_str2\""
log_pass "POSIX ACLs survive remount"
else
log_fail "Group '$ZFS_ACL_STAFF_GROUP' does not have 'rwx'"
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/alloc_class/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/alloc_class/Makefile.am
deleted file mode 100644
index 7cffb2eac450..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/alloc_class/Makefile.am
+++ /dev/null
@@ -1,21 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/alloc_class
-dist_pkgdata_SCRIPTS = \
- setup.ksh \
- cleanup.ksh \
- alloc_class_001_pos.ksh \
- alloc_class_002_neg.ksh \
- alloc_class_003_pos.ksh \
- alloc_class_004_pos.ksh \
- alloc_class_005_pos.ksh \
- alloc_class_006_pos.ksh \
- alloc_class_007_pos.ksh \
- alloc_class_008_pos.ksh \
- alloc_class_009_pos.ksh \
- alloc_class_010_pos.ksh \
- alloc_class_011_neg.ksh \
- alloc_class_012_pos.ksh \
- alloc_class_013_pos.ksh
-
-dist_pkgdata_DATA = \
- alloc_class.cfg \
- alloc_class.kshlib
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/alloc_class/alloc_class_004_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/alloc_class/alloc_class_004_pos.ksh
index 79ac9364c257..04ce486adb83 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/alloc_class/alloc_class_004_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/alloc_class/alloc_class_004_pos.ksh
@@ -52,8 +52,7 @@ do
log_must zpool create $TESTPOOL $type $ZPOOL_DISKS \
special $stype $sdisks
- ac_value="$(zpool get -H -o property,value all | \
- egrep allocation_classes | nawk '{print $2}')"
+ ac_value="$(zpool get -H -o property,value all | awk '/allocation_classes/ {print $2}')"
if [ "$ac_value" = "active" ]; then
log_note "feature@allocation_classes is active"
else
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/alloc_class/alloc_class_005_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/alloc_class/alloc_class_005_pos.ksh
index 337114cdb59e..08c703e21acb 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/alloc_class/alloc_class_005_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/alloc_class/alloc_class_005_pos.ksh
@@ -42,7 +42,7 @@ do
log_must zpool create $TESTPOOL $type $ZPOOL_DISKS
fi
ac_value="$(zpool get -H -o property,value all | \
- egrep allocation_classes | awk '{print $2}')"
+ awk '/allocation_classes/ {print $2}')"
if [ "$ac_value" = "enabled" ]; then
log_note "feature@allocation_classes is enabled"
else
@@ -57,7 +57,7 @@ do
$CLASS_DISK0 $CLASS_DISK1
fi
ac_value="$(zpool get -H -o property,value all | \
- egrep allocation_classes | awk '{print $2}')"
+ awk '/allocation_classes/ {print $2}')"
if [ "$ac_value" = "active" ]; then
log_note "feature@allocation_classes is active"
else
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/alloc_class/alloc_class_010_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/alloc_class/alloc_class_010_pos.ksh
index 2c14c69d8b20..cbf5cbf89bdc 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/alloc_class/alloc_class_010_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/alloc_class/alloc_class_010_pos.ksh
@@ -39,7 +39,7 @@ for value in 0 512 1024 2048 4096 8192 16384 32768 65536 131072
do
log_must zfs set special_small_blocks=$value $TESTPOOL
ACTUAL=$(zfs get -p special_small_blocks $TESTPOOL | \
- grep special_small_blocks | awk '{print $3}')
+ awk '/special_small_blocks/ {print $3}')
if [ "$ACTUAL" != "$value" ]
then
log_fail "v. $ACTUAL set for $TESTPOOL, expected v. $value!"
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/alloc_class/alloc_class_011_neg.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/alloc_class/alloc_class_011_neg.ksh
index d804e5371ebb..0be49b858758 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/alloc_class/alloc_class_011_neg.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/alloc_class/alloc_class_011_neg.ksh
@@ -35,7 +35,7 @@ log_must disk_setup
log_must zpool create $TESTPOOL raidz $ZPOOL_DISKS special mirror \
$CLASS_DISK0 $CLASS_DISK1
-for value in 256 1025 2097152
+for value in 256 1025 33554432
do
log_mustnot zfs set special_small_blocks=$value $TESTPOOL
done
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/threadsappend/cleanup.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/append/cleanup.ksh
index 3166bd6ec16e..307feabd17c6 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/threadsappend/cleanup.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/append/cleanup.ksh
@@ -21,14 +21,9 @@
#
#
-# Copyright 2007 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
+# Copyright (c) 2022 by Triad National Security, LCC
#
-#
-# Copyright (c) 2013 by Delphix. All rights reserved.
-#
-
-. $STF_SUITE/include/libtest.shlib
+. ${STF_SUITE}/include/libtest.shlib
default_cleanup
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/append/file_append.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/append/file_append.ksh
new file mode 100755
index 000000000000..b40d10c05edb
--- /dev/null
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/append/file_append.ksh
@@ -0,0 +1,73 @@
+#!/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 (c) 2022 by Triad National Security, LCC
+#
+
+. $STF_SUITE/include/libtest.shlib
+
+#
+# DESCRIPTION:
+# Tests file offset using O_APPEND.
+#
+# STRATEGY:
+# 1. Open file using O_APPEND
+# 2. Write to the file using random number of blocks (1, 2, or 3)
+# 3. Verify that the file offset is correct using lseek after the write
+# 4. Repeat steps 2 and 3, 5 times
+# 5. Close the file.
+# 6. Repeat steps 1-5 but also open file with O_DIRECT
+#
+
+verify_runnable "global"
+
+log_assert "Ensure file offset is updated correctly when opened with O_APPEND"
+
+mntpt=$(get_prop mountpoint $TESTPOOL/$TESTFS)
+filename=$mntpt/append_file.txt
+bs=131072
+ITERATIONS=5
+expected=0
+
+# First test using buffered writes with O_APPEND
+for i in $(seq $ITERATIONS); do
+ num_blocks=$(random_int_between 1 3)
+ expected=$((expected + ( bs * num_blocks)))
+ log_must file_append -f $filename -e $expected -b $bs -n $num_blocks
+ curr_offset=$expected
+done
+
+log_must rm -f $filename
+
+expected=0
+
+# Repeat same test using O_DIRECT writes with O_APPEND
+for i in $(seq $ITERATIONS); do
+ num_blocks=$(random_int_between 1 3)
+ expected=$((expected + ( bs * num_blocks)))
+ log_must file_append -f $filename -e $expected -b $bs -n $num_blocks -d
+done
+
+log_must rm -f $filename
+
+log_pass "File offset updated correctly when opening a file with O_APPEND."
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/threadsappend/setup.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/append/setup.ksh
index 4fc55cd47803..e692d7b1bc0c 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/threadsappend/setup.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/append/setup.ksh
@@ -21,12 +21,7 @@
#
#
-# Copyright 2007 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-
-#
-# Copyright (c) 2013 by Delphix. All rights reserved.
+# Copyright (c) 2022 by Triad National Security, LCC
#
. $STF_SUITE/include/libtest.shlib
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/threadsappend/threadsappend_001_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/append/threadsappend_001_pos.ksh
index 8154214a0ca7..8154214a0ca7 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/threadsappend/threadsappend_001_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/append/threadsappend_001_pos.ksh
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/arc/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/arc/Makefile.am
deleted file mode 100644
index 809d0346f872..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/arc/Makefile.am
+++ /dev/null
@@ -1,8 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/arc
-dist_pkgdata_SCRIPTS = \
- cleanup.ksh \
- setup.ksh \
- arcstats_runtime_tuning.ksh \
- dbufstats_001_pos.ksh \
- dbufstats_002_pos.ksh \
- dbufstats_003_pos.ksh
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/arc/dbufstats_001_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/arc/dbufstats_001_pos.ksh
index 712309eda72f..aaab800b60ab 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/arc/dbufstats_001_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/arc/dbufstats_001_pos.ksh
@@ -56,8 +56,7 @@ function testdbufstat # stat_name dbufstat_filter
[[ -n "$2" ]] && filter="-F $2"
if is_linux; then
- from_dbufstat=$(grep -w "$name" "$DBUFSTATS_FILE" |
- awk '{ print $3 }')
+ read -r _ _ from_dbufstat _ < <(grep -w "$name" "$DBUFSTATS_FILE")
else
from_dbufstat=$(awk "/dbufstats\.$name:/ { print \$2 }" \
"$DBUFSTATS_FILE")
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/arc/setup.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/arc/setup.ksh
index 37b8f352cc64..60699d365eb5 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/arc/setup.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/arc/setup.ksh
@@ -26,5 +26,7 @@
. $STF_SUITE/include/libtest.shlib
+is_freebsd && ! python3 -c 'import sysctl' 2>/dev/null && log_unsupported "python3 sysctl module missing"
+
DISK=${DISKS%% *}
default_setup $DISK
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/atime/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/atime/Makefile.am
deleted file mode 100644
index 63d510b99e75..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/atime/Makefile.am
+++ /dev/null
@@ -1,14 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/atime
-dist_pkgdata_SCRIPTS = \
- cleanup.ksh \
- setup.ksh \
- atime_001_pos.ksh \
- atime_002_neg.ksh \
- atime_003_pos.ksh \
- root_atime_off.ksh \
- root_atime_on.ksh \
- root_relatime_on.ksh
-
-dist_pkgdata_DATA = \
- atime.cfg \
- atime_common.kshlib
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/bootfs/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/bootfs/Makefile.am
deleted file mode 100644
index 15a6e202c311..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/bootfs/Makefile.am
+++ /dev/null
@@ -1,12 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/bootfs
-dist_pkgdata_SCRIPTS = \
- cleanup.ksh \
- setup.ksh \
- bootfs_001_pos.ksh \
- bootfs_002_neg.ksh \
- bootfs_003_pos.ksh \
- bootfs_004_neg.ksh \
- bootfs_005_neg.ksh \
- bootfs_006_pos.ksh \
- bootfs_007_pos.ksh \
- bootfs_008_pos.ksh
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/bootfs/bootfs_001_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/bootfs/bootfs_001_pos.ksh
index 3e9357063bed..6f2f54ebdddc 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/bootfs/bootfs_001_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/bootfs/bootfs_001_pos.ksh
@@ -59,12 +59,6 @@ function cleanup {
fi
}
-zpool set 2>&1 | grep bootfs > /dev/null
-if [ $? -ne 0 ]
-then
- log_unsupported "bootfs pool property not supported on this release."
-fi
-
log_assert "Valid datasets are accepted as bootfs property values"
log_onexit cleanup
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/bootfs/bootfs_002_neg.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/bootfs/bootfs_002_neg.ksh
index a5bc7753e96e..172b69400807 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/bootfs/bootfs_002_neg.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/bootfs/bootfs_002_neg.ksh
@@ -60,12 +60,6 @@ function cleanup {
}
-zpool set 2>&1 | grep bootfs > /dev/null
-if [ $? -ne 0 ]
-then
- log_unsupported "bootfs pool property not supported on this release."
-fi
-
log_assert "Invalid datasets are rejected as boot property values"
log_onexit cleanup
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/bootfs/bootfs_003_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/bootfs/bootfs_003_pos.ksh
index e719b94e2763..78559dd186c8 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/bootfs/bootfs_003_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/bootfs/bootfs_003_pos.ksh
@@ -54,12 +54,6 @@ function cleanup {
}
-zpool set 2>&1 | grep bootfs > /dev/null
-if [ $? -ne 0 ]
-then
- log_unsupported "bootfs pool property not supported on this release."
-fi
-
log_onexit cleanup
log_assert "Valid pool names are accepted by zpool set bootfs"
@@ -74,7 +68,7 @@ do
log_must zfs create $POOL/$TESTFS
log_must zpool set bootfs=$POOL/$TESTFS $POOL
- RES=$(zpool get bootfs $POOL | tail -1 | awk '{print $3}' )
+ RES=$(zpool get bootfs $POOL | awk 'END {print $3}' )
if [ $RES != "$POOL/$TESTFS" ]
then
log_fail "Expected $RES == $POOL/$TESTFS"
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/bootfs/bootfs_004_neg.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/bootfs/bootfs_004_neg.ksh
index 97b456aade3e..5ea0f6c1a95f 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/bootfs/bootfs_004_neg.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/bootfs/bootfs_004_neg.ksh
@@ -55,12 +55,6 @@ function cleanup {
}
-zpool set 2>&1 | grep bootfs > /dev/null
-if [ $? -ne 0 ]
-then
- log_unsupported "bootfs pool property not supported on this release."
-fi
-
log_assert "Invalid pool names are rejected by zpool set bootfs"
log_onexit cleanup
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/bootfs/bootfs_006_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/bootfs/bootfs_006_pos.ksh
index d29fe7e89c50..2738d3916e2c 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/bootfs/bootfs_006_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/bootfs/bootfs_006_pos.ksh
@@ -44,12 +44,6 @@
verify_runnable "global"
-zpool set 2>&1 | grep bootfs > /dev/null
-if [ $? -ne 0 ]
-then
- log_unsupported "bootfs pool property not supported on this release."
-fi
-
VDEV1=$TESTDIR/bootfs_006_pos_a.$$.dat
VDEV2=$TESTDIR/bootfs_006_pos_b.$$.dat
VDEV3=$TESTDIR/bootfs_006_pos_c.$$.dat
@@ -60,7 +54,7 @@ function verify_bootfs { # $POOL
log_must zfs create $POOL/$TESTFS
log_must zpool set bootfs=$POOL/$TESTFS $POOL
- VAL=$(zpool get bootfs $POOL | tail -1 | awk '{print $3}' )
+ VAL=$(zpool get bootfs $POOL | awk 'END {print $3}' )
if [ $VAL != "$POOL/$TESTFS" ]
then
log_must zpool status -v $POOL
@@ -74,7 +68,7 @@ function verify_no_bootfs { # $POOL
POOL=$1
log_must zfs create $POOL/$TESTFS
log_mustnot zpool set bootfs=$POOL/$TESTFS $POOL
- VAL=$(zpool get bootfs $POOL | tail -1 | awk '{print $3}' )
+ VAL=$(zpool get bootfs $POOL | awk 'END {print $3}' )
if [ $VAL == "$POOL/$TESTFS" ]
then
log_must zpool status -v $POOL
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/btree/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/btree/Makefile.am
deleted file mode 100644
index 333209d98f2b..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/btree/Makefile.am
+++ /dev/null
@@ -1,20 +0,0 @@
-#
-# This file and its contents are supplied under the terms of the
-# Common Development and Distribution License ("CDDL"), version 1.0.
-# You may only use this file in accordance with the terms of version
-# 1.0 of the CDDL.
-#
-# A full copy of the text of the CDDL should have accompanied this
-# source. A copy of the CDDL is also available via the Internet at
-# http://www.illumos.org/license/CDDL.
-#
-
-#
-# Copyright (c) 2019 by Delphix. All rights reserved.
-#
-
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/btree
-
-dist_pkgdata_SCRIPTS = \
- btree_positive.ksh \
- btree_negative.ksh
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/btree/btree_negative.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/btree/btree_negative.ksh
index cefcbc51e796..667ac87b4fea 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/btree/btree_negative.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/btree/btree_negative.ksh
@@ -29,10 +29,7 @@
# looks for return values that correspond to a core dump and cause a test
# failure.
-btree_test -n insert_duplicate
-[[ $? -eq 0 ]] && log_fail "Failure from insert_duplicate"
-
-btree_test -n remove_missing
-[[ $? -eq 0 ]] && log_fail "Failure from remove_missing"
+btree_test -n insert_duplicate && log_fail "Failure from insert_duplicate"
+btree_test -n remove_missing && log_fail "Failure from remove_missing"
log_pass "Btree negative tests passed"
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cache/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cache/Makefile.am
deleted file mode 100644
index f28130ee9e4d..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cache/Makefile.am
+++ /dev/null
@@ -1,20 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cache
-dist_pkgdata_SCRIPTS = \
- cleanup.ksh \
- setup.ksh \
- cache_001_pos.ksh \
- cache_002_pos.ksh \
- cache_003_pos.ksh \
- cache_004_neg.ksh \
- cache_005_neg.ksh \
- cache_006_pos.ksh \
- cache_007_neg.ksh \
- cache_008_neg.ksh \
- cache_009_pos.ksh \
- cache_010_pos.ksh \
- cache_011_pos.ksh \
- cache_012_pos.ksh
-
-dist_pkgdata_DATA = \
- cache.cfg \
- cache.kshlib
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cache/cache.kshlib b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cache/cache.kshlib
index 2e258e22cd39..9948c6280185 100644
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cache/cache.kshlib
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cache/cache.kshlib
@@ -94,7 +94,7 @@ function verify_cache_device
#
# mirror:/disks/d ONLINE mirror:/disks/e ONLINE stripe:/disks/f ONLINE
#
- set -A dev_stat_tab $(zpool status -v $pool | nawk 'BEGIN {start=0} \
+ set -A dev_stat_tab $(zpool status -v $pool | awk 'BEGIN {start=0} \
/\tcache/ {start=1}
/\tmirror/ || /\tspares/ || /^$/ {start=0}
(start==1) && /\t (\/|[a-zA-Z])/ \
@@ -146,9 +146,3 @@ function verify_cache_device
log_note "Can not find device: $device"
return 1
}
-
-function verify_cache_support
-{
- zpool upgrade -v | grep "Cache devices" > /dev/null 2>&1
- return $?
-}
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cache/cache_012_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cache/cache_012_pos.ksh
index edefe9c1bf68..be250158bf7e 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cache/cache_012_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cache/cache_012_pos.ksh
@@ -44,6 +44,8 @@
verify_runnable "global"
+command -v fio > /dev/null || log_unsupported "fio missing"
+
log_assert "Looping around a cache device succeeds."
function cleanup
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cachefile/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cachefile/Makefile.am
deleted file mode 100644
index 53d8c8c6c9d5..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cachefile/Makefile.am
+++ /dev/null
@@ -1,12 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cachefile
-dist_pkgdata_SCRIPTS = \
- cleanup.ksh \
- setup.ksh \
- cachefile_001_pos.ksh \
- cachefile_002_pos.ksh \
- cachefile_003_pos.ksh \
- cachefile_004_pos.ksh
-
-dist_pkgdata_DATA = \
- cachefile.cfg \
- cachefile.kshlib
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cachefile/cachefile.cfg b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cachefile/cachefile.cfg
index d93ec3ed6f3b..bd48cfdf2f87 100644
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cachefile/cachefile.cfg
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cachefile/cachefile.cfg
@@ -33,5 +33,5 @@ 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}')
+export DISK_ARRAY_NUM=$(echo ${DISKS} | awk '{print NF}')
set_device_dir
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/casenorm/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/casenorm/Makefile.am
deleted file mode 100644
index b284a2560b27..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/casenorm/Makefile.am
+++ /dev/null
@@ -1,25 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/casenorm
-dist_pkgdata_SCRIPTS = \
- setup.ksh \
- cleanup.ksh \
- case_all_values.ksh \
- insensitive_formd_delete.ksh \
- insensitive_formd_lookup.ksh \
- insensitive_none_delete.ksh \
- insensitive_none_lookup.ksh \
- mixed_create_failure.ksh \
- mixed_formd_delete.ksh \
- mixed_formd_lookup_ci.ksh \
- mixed_formd_lookup.ksh \
- mixed_none_delete.ksh \
- mixed_none_lookup_ci.ksh \
- mixed_none_lookup.ksh \
- norm_all_values.ksh \
- sensitive_formd_delete.ksh \
- sensitive_formd_lookup.ksh \
- sensitive_none_delete.ksh \
- sensitive_none_lookup.ksh
-
-dist_pkgdata_DATA = \
- casenorm.cfg \
- casenorm.kshlib
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/casenorm/casenorm.kshlib b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/casenorm/casenorm.kshlib
index f0fe1bbaa886..ad5b5367ae48 100644
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/casenorm/casenorm.kshlib
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/casenorm/casenorm.kshlib
@@ -50,13 +50,8 @@ function delete_file
{
typeset name=$TESTDIR/$1
- rm $name >/dev/null 2>&1
-
- if [[ $? -ne 0 ]] ; then
- return 1
- fi
-
- if [[ -f $name ]] ; then
+ rm $name >/dev/null 2>&1 || return 1
+ if [ -f $name ]; then
return 2
fi
}
@@ -86,10 +81,7 @@ function lookup_file_ci
function lookup_any
{
for name in $NAMES_ALL ; do
- lookup_file $name
- if [[ $? -eq 0 ]] ; then
- return 0
- fi
+ lookup_file $name && return
done
return 1
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/casenorm/mixed_create_failure.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/casenorm/mixed_create_failure.ksh
index 51b5bb3f6584..208be91dea42 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/casenorm/mixed_create_failure.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/casenorm/mixed_create_failure.ksh
@@ -70,6 +70,7 @@ function test_ops
{
typeset obj_type=$1
typeset testdir=$2
+ typeset save_name=
target_obj='target-file'
@@ -83,7 +84,7 @@ function test_ops
log_note "Created test dir $test_path"
if [[ $obj_type = "symlink" || $obj_type = "hardlink" ]]; then
- touch $test_path/$target_obj
+ > $test_path/$target_obj
log_note "Created target: $test_path/$target_obj"
op="$op $test_path/$target_obj"
fi
@@ -100,29 +101,24 @@ function test_ops
save_name="$test_path/$name"
break;
else
- log_err "$cmd failed with unexpected error : $out"
+ log_fail "$cmd failed: $out"
fi
fi
done
+ [ -n "$save_name" ] || log_fail "Didn't ENOSPC!"
- log_note 'Test rename \"sample_name\" rename'
+ log_note 'Test rename "sample_name" rename'
TMP_OBJ="$test_path/tmp_obj"
cmd="$op $TMP_OBJ"
- out=$($cmd 2>&1)
- ret=$?
- if (($ret != 0)); then
- log_err "cmd:$cmd failed out:$out"
- fi
+ log_must $cmd
# Now, try to rename the tmp_obj to the name which we failed to add earlier.
# This should fail as well.
- out=$(mv $TMP_OBJ $save_name 2>&1)
- ret=$?
- if (($ret != 0)); then
+ if ! out=$(mv $TMP_OBJ $save_name 2>&1); then
if [[ $out = *@(No space left on device)* ]]; then
- log_note "$cmd failed as expected : $out"
+ log_note "$cmd failed as expected: $out"
else
- log_err "$cmd failed with : $out"
+ log_fail "$cmd failed: $out"
fi
fi
}
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/channel_program/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/channel_program/Makefile.am
deleted file mode 100644
index 3886863d1dfb..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/channel_program/Makefile.am
+++ /dev/null
@@ -1,6 +0,0 @@
-SUBDIRS = \
- lua_core \
- synctask_core
-
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/channel_program
-dist_pkgdata_DATA = channel_common.kshlib
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/channel_program/channel_common.kshlib b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/channel_program/channel_common.kshlib
index a828ba29065e..c937e90614c8 100644
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/channel_program/channel_common.kshlib
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/channel_program/channel_common.kshlib
@@ -47,9 +47,10 @@ function log_program
zfs program $cmdargs >$tmpout 2>$tmperr
typeset ret=$?
- log_note "input:\n$(cat $tmpin)"
- log_note "output:\n$(cat $tmpout)"
- log_note "error:\n$(cat $tmperr)"
+ log_note $'input:\n'"$(<$tmpin)"
+ log_note $'output:\n'"$(<$tmpout)"
+ log_note $'error:\n'"$(<$tmperr)"
+ log_note "ret: $ret"
#
# Verify correct return value
@@ -64,35 +65,29 @@ function log_program
# respectively.
#
if [[ -f "$basename.out" ]] && [[ $expectexit -eq 0 ]]; then
-
- outdiff=$(diff "$basename.out" "$tmpout")
- if [[ $? -ne 0 ]]; then
+ if ! outdiff=$(diff "$basename.out" "$tmpout"); then
output=$(<$tmpout)
rm $tmpout $tmperr $tmpin
- log_fail "Output mismatch. Expected:\n" \
- "$(<$basename.out)\nBut got:\n$output\n" \
- "Diff:\n$outdiff"
+ log_fail $'Output mismatch. Expected:\n' \
+ "$(<$basename.out)"$'\nBut got:\n'"$output"$'\n' \
+ $'Diff:\n'"$outdiff"
fi
elif [[ -f "$basename.err" ]] && [[ $expectexit -ne 0 ]]; then
-
- outdiff=$(diff "$basename.err" "$tmperr")
- if [[ $? -ne 0 ]]; then
+ if ! outdiff=$(diff "$basename.err" "$tmperr"); then
outputerror=$(<$tmperr)
rm $tmpout $tmperr $tmpin
- log_fail "Error mismatch. Expected:\n" \
- "$(<$basename.err)\nBut got:\n$outputerror\n" \
- "Diff:\n$outdiff"
+ log_fail $'Error mismatch. Expected:\n' \
+ "$(<$basename.err)"$'\nBut got:\n'"$outputerror"$'\n' \
+ $'Diff:\n'"$outdiff"
fi
elif [[ -n $expecterror ]] && [[ $expectexit -ne 0 ]]; then
-
- grep -q "$expecterror" $tmperr
- if [[ $? -ne 0 ]]; then
+ if ! grep -q "$expecterror" $tmperr; then
outputerror=$(<$tmperr)
rm $tmpout $tmperr $tmpin
- log_fail "Error mismatch. Expected to contain:\n" \
- "$expecterror\nBut got:\n$outputerror\n"
+ log_fail $'Error mismatch. Expected to contain:\n' \
+ "$expecterror"$'\nBut got:\n'"$outputerror"$'\n'
fi
elif [[ $expectexit -ne 0 ]]; then
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/channel_program/lua_core/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/channel_program/lua_core/Makefile.am
deleted file mode 100644
index fb352081190c..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/channel_program/lua_core/Makefile.am
+++ /dev/null
@@ -1,46 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/channel_program/lua_core
-dist_pkgdata_SCRIPTS = \
- cleanup.ksh \
- setup.ksh \
- tst.args_to_lua.ksh \
- tst.divide_by_zero.ksh \
- tst.exists.ksh \
- tst.integer_illegal.ksh \
- tst.integer_overflow.ksh \
- tst.language_functions_neg.ksh \
- tst.language_functions_pos.ksh \
- tst.large_prog.ksh \
- tst.libraries.ksh \
- tst.memory_limit.ksh \
- tst.nested_neg.ksh \
- tst.nested_pos.ksh \
- tst.nvlist_to_lua.ksh \
- tst.recursive_neg.ksh \
- tst.recursive_pos.ksh \
- tst.return_large.ksh \
- tst.return_nvlist_neg.ksh \
- tst.return_nvlist_pos.ksh \
- tst.return_recursive_table.ksh \
- tst.stack_gsub.ksh \
- tst.timeout.ksh
-
-dist_pkgdata_DATA = \
- tst.args_to_lua.out \
- tst.args_to_lua.zcp \
- tst.divide_by_zero.err \
- tst.divide_by_zero.zcp \
- tst.exists.zcp \
- tst.large_prog.out \
- tst.large_prog.zcp \
- tst.lib_base.lua \
- tst.lib_coroutine.lua \
- tst.lib_strings.lua \
- tst.lib_table.lua \
- tst.nested_neg.zcp \
- tst.nested_pos.zcp \
- tst.recursive.zcp \
- tst.return_large.zcp \
- tst.return_recursive_table.zcp \
- tst.stack_gsub.err \
- tst.stack_gsub.zcp \
- tst.timeout.zcp
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/channel_program/lua_core/tst.exists.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/channel_program/lua_core/tst.exists.ksh
index eba01b17c80e..34f29d9c039d 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/channel_program/lua_core/tst.exists.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/channel_program/lua_core/tst.exists.ksh
@@ -38,8 +38,6 @@ log_must_program $TESTPOOL $ZCP_ROOT/lua_core/tst.exists.zcp \
$TESTPOOL/$TESTCLONE
log_mustnot_checkerror_program "not in the target pool" \
- $TESTPOOL - <<-EOF
- return zfs.exists('rpool')
-EOF
+ $TESTPOOL - <<<"return zfs.exists('rpool')"
log_pass "zfs.exists() gives correct results"
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/channel_program/lua_core/tst.integer_illegal.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/channel_program/lua_core/tst.integer_illegal.ksh
index c34f2afd9e18..1c70bc85920a 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/channel_program/lua_core/tst.integer_illegal.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/channel_program/lua_core/tst.integer_illegal.ksh
@@ -32,9 +32,7 @@ set -A args "1.0" \
typeset -i i=0
while (( i < ${#args[*]} )); do
- log_mustnot_checkerror_program "malformed number" $TESTPOOL - <<-EOF
- return ${args[i]}
- EOF
+ log_mustnot_checkerror_program "malformed number" $TESTPOOL - <<<"return ${args[i]}"
((i = i + 1))
done
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/channel_program/lua_core/tst.integer_overflow.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/channel_program/lua_core/tst.integer_overflow.ksh
index c129bae51b04..be2129792499 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/channel_program/lua_core/tst.integer_overflow.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/channel_program/lua_core/tst.integer_overflow.ksh
@@ -25,8 +25,6 @@ verify_runnable "global"
log_assert "overflowing a 64-bit integer should wrap around"
-log_must_program $TESTPOOL - <<-EOF
- assert(18446744073709551615 + 1 == (-18446744073709551616))
-EOF
+log_must_program $TESTPOOL - <<<"assert(18446744073709551615 + 1 == (-18446744073709551616))"
log_pass "overflowing a 64-bit integer should wrap around"
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/channel_program/lua_core/tst.language_functions_neg.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/channel_program/lua_core/tst.language_functions_neg.ksh
index 0125d76c7036..3f91db2be9c3 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/channel_program/lua_core/tst.language_functions_neg.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/channel_program/lua_core/tst.language_functions_neg.ksh
@@ -43,9 +43,7 @@ log_assert "Runtime errors in lua scripts fail as expected."
typeset -i i=0
while (( i < ${#args[*]} )); do
- log_mustnot_checkerror_program "execution failed" $TESTPOOL - <<-EOF
- ${args[i]}
- EOF
+ log_mustnot_checkerror_program "execution failed" $TESTPOOL - <<<"${args[i]}"
((i = i + 1))
done
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/channel_program/lua_core/tst.language_functions_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/channel_program/lua_core/tst.language_functions_pos.ksh
index 924d8e2c6944..019622cf84cc 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/channel_program/lua_core/tst.language_functions_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/channel_program/lua_core/tst.language_functions_pos.ksh
@@ -33,9 +33,7 @@ log_assert "Simple lua scripts pass."
typeset -i i=0
while (( i < ${#args[*]} )); do
- log_must_program $TESTPOOL - <<-EOF
- ${args[i]}
- EOF
+ log_must_program $TESTPOOL - <<<"${args[i]}"
((i = i + 1))
done
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/channel_program/lua_core/tst.return_large.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/channel_program/lua_core/tst.return_large.ksh
index bbaeb54f59a5..ae42665cd9f5 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/channel_program/lua_core/tst.return_large.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/channel_program/lua_core/tst.return_large.ksh
@@ -41,8 +41,7 @@ log_must zfs create $fs
output_lines=$(log_must zfs program $TESTPOOL \
$ZCP_ROOT/lua_core/tst.return_large.zcp | wc -l)
-[[ $output_lines -lt 5000 ]] &&
- log_fail "Expected return of full list but only got $output_lines lines"
+log_must [ $output_lines -ge 5000 ]
#
# Make sure we fail if the return is over the memory limit
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/channel_program/lua_core/tst.return_nvlist_neg.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/channel_program/lua_core/tst.return_nvlist_neg.ksh
index 10afa6727847..a8d4dd31d84b 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/channel_program/lua_core/tst.return_nvlist_neg.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/channel_program/lua_core/tst.return_nvlist_neg.ksh
@@ -45,17 +45,13 @@ set -A args 'function() return 1 end' \
typeset -i last_index=$((${#args[*]} - 1))
for i in $(seq 0 $last_index); do
log_note "running program: ${args[i]}"
- log_mustnot_checkerror_program "execution failed" $TESTPOOL - <<-EOF
- return ${args[i]}
- EOF
+ log_mustnot_checkerror_program "execution failed" $TESTPOOL - <<<"return ${args[i]}"
((i = i + 1))
done
for i in $(seq 0 $last_index); do
log_note "running program: ${args[i]}"
- log_mustnot_checkerror_program "execution failed" $TESTPOOL - <<-EOF
- error(${args[i]})
- EOF
+ log_mustnot_checkerror_program "execution failed" $TESTPOOL - <<<"error(${args[i]})"
((i = i + 1))
done
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/channel_program/lua_core/tst.return_nvlist_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/channel_program/lua_core/tst.return_nvlist_pos.ksh
index 8b4ef6e760b0..75ade2b45d12 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/channel_program/lua_core/tst.return_nvlist_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/channel_program/lua_core/tst.return_nvlist_pos.ksh
@@ -39,18 +39,14 @@ log_assert "Returning valid lua constructs works."
typeset -i i=0
while (( i < ${#args[*]} )); do
log_note "running program: return ${args[i]}"
- log_must_program $TESTPOOL - <<-EOF
- return ${args[i]}
- EOF
+ log_must_program $TESTPOOL - <<<"return ${args[i]}"
((i = i + 1))
done
typeset -i i=0
while (( i < ${#args[*]} )); do
log_note "running program: error(${args[i]})"
- log_mustnot_checkerror_program "in function 'error'" $TESTPOOL - <<-EOF
- error(${args[i]})
- EOF
+ log_mustnot_checkerror_program "in function 'error'" $TESTPOOL - <<<"error(${args[i]})"
((i = i + 1))
done
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/channel_program/lua_core/tst.timeout.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/channel_program/lua_core/tst.timeout.ksh
index 22ea37548173..905a3c327cce 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/channel_program/lua_core/tst.timeout.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/channel_program/lua_core/tst.timeout.ksh
@@ -34,15 +34,11 @@ function test_instr_limit
{
typeset lim=$1
- error=$(zfs program -t $lim $TESTPOOL $ZCP_ROOT/lua_core/tst.timeout.zcp 2>&1)
- [[ $? -ne 0 ]] || log_fail "Channel program with limit $lim exited 0: $error"
-
- instrs_run=$(echo $error | awk -F "chunk" '{print $2}' | awk '{print $1}')
- if [[ $instrs_run -lt $(( $lim - 100 )) ]]; then
- log_fail "Runtime (${instrs_run} instr) < limit (${lim} - 100 instr)"
- elif [[ $instrs_run -gt $(( $lim + 100 )) ]]; then
- log_fail "Runtime (${instrs_run} instr) > limit (${lim} + 100 instr)"
- fi
+ log_mustnot eval 'error=$(zfs program -t '$lim' $TESTPOOL $ZCP_ROOT/lua_core/tst.timeout.zcp 2>&1)'
+
+ read -r instrs_run _ < <(echo $error | awk -F "chunk" '{print $2}')
+ log_must [ $instrs_run -ge $(( $lim - 100 )) ]
+ log_must [ $instrs_run -le $(( $lim + 100 )) ]
log_note "With limit $lim the program ended after $instrs_run instructions"
}
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/channel_program/synctask_core/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/channel_program/synctask_core/Makefile.am
deleted file mode 100644
index 4d9aa9cebbfc..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/channel_program/synctask_core/Makefile.am
+++ /dev/null
@@ -1,53 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/channel_program/synctask_core
-dist_pkgdata_SCRIPTS = \
- cleanup.ksh \
- setup.ksh \
- tst.destroy_fs.ksh \
- tst.destroy_snap.ksh \
- tst.get_count_and_limit.ksh \
- tst.get_index_props.ksh \
- tst.get_mountpoint.ksh \
- tst.get_neg.ksh \
- tst.get_number_props.ksh \
- tst.get_string_props.ksh \
- tst.get_type.ksh \
- tst.get_userquota.ksh \
- tst.get_written.ksh \
- tst.inherit.ksh \
- tst.list_bookmarks.ksh \
- tst.list_children.ksh \
- tst.list_clones.ksh \
- tst.list_holds.ksh \
- tst.list_snapshots.ksh \
- tst.list_system_props.ksh \
- tst.list_user_props.ksh \
- tst.parse_args_neg.ksh \
- tst.promote_conflict.ksh \
- tst.promote_multiple.ksh \
- tst.promote_simple.ksh \
- tst.rollback_mult.ksh \
- tst.rollback_one.ksh \
- tst.set_props.ksh \
- tst.snapshot_destroy.ksh \
- tst.snapshot_neg.ksh \
- tst.snapshot_recursive.ksh \
- tst.bookmark.create.ksh \
- tst.bookmark.copy.ksh \
- tst.snapshot_simple.ksh \
- tst.terminate_by_signal.ksh
-
-dist_pkgdata_DATA = \
- tst.get_index_props.out \
- tst.get_index_props.zcp \
- tst.get_number_props.out \
- tst.get_number_props.zcp \
- tst.get_string_props.out \
- tst.get_string_props.zcp \
- tst.promote_conflict.zcp \
- tst.set_props.zcp \
- tst.snapshot_destroy.zcp \
- tst.snapshot_neg.zcp \
- tst.snapshot_recursive.zcp \
- tst.snapshot_simple.zcp \
- tst.bookmark.create.zcp \
- tst.bookmark.copy.zcp
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/channel_program/synctask_core/tst.terminate_by_signal.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/channel_program/synctask_core/tst.terminate_by_signal.ksh
index 2c9014a08483..53d5b819daf6 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/channel_program/synctask_core/tst.terminate_by_signal.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/channel_program/synctask_core/tst.terminate_by_signal.ksh
@@ -86,13 +86,10 @@ log_pos kill $CHILD
# Make sure the channel program did not fully complete by enforcing
# that not all of the snapshots were created.
#
-snap_count=$(zfs list -t snapshot | grep $TESTPOOL | wc -l)
+snap_count=$(zfs list -t snapshot | grep -c $TESTPOOL)
log_note "$snap_count snapshots created by ZCP"
-if [ "$snap_count" -eq 0 ]; then
- log_fail "Channel program failed to run."
-elif [ "$snap_count" -gt 90 ]; then
- log_fail "Too many snapshots after a cancel ($snap_count)."
-else
- log_pass "Canceling a long-running channel program works."
-fi
+log_mustnot [ "$snap_count" -eq 0 ]
+log_mustnot [ "$snap_count" -gt 90 ]
+
+log_pass "Cancelling a long-running channel program works."
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/chattr/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/chattr/Makefile.am
deleted file mode 100644
index 431208e587ec..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/chattr/Makefile.am
+++ /dev/null
@@ -1,6 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/chattr
-dist_pkgdata_SCRIPTS = \
- setup.ksh \
- cleanup.ksh \
- chattr_001_pos.ksh \
- chattr_002_neg.ksh
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/chattr/setup.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/chattr/setup.ksh
index d4b3cdcaba92..85c9b6ea6351 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/chattr/setup.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/chattr/setup.ksh
@@ -47,10 +47,8 @@ log_must add_user $QGROUP $QUSER2
#
# chmod 0750 $HOME
#
-user_run $QUSER1 zfs list
-if [ $? -ne 0 ]; then
+user_run $QUSER1 zfs list ||
log_unsupported "Test user $QUSER1 cannot execute zfs utilities"
-fi
DISK=${DISKS%% *}
default_setup $DISK
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/checksum/.gitignore b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/checksum/.gitignore
deleted file mode 100644
index 0411d5aa47dc..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/checksum/.gitignore
+++ /dev/null
@@ -1,4 +0,0 @@
-skein_test
-edonr_test
-sha2_test
-
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/checksum/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/checksum/Makefile.am
deleted file mode 100644
index 717098aa0723..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/checksum/Makefile.am
+++ /dev/null
@@ -1,31 +0,0 @@
-include $(top_srcdir)/config/Rules.am
-
-LDADD = \
- $(abs_top_builddir)/lib/libicp/libicp.la \
- $(abs_top_builddir)/lib/libspl/libspl_assert.la
-
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/checksum
-
-dist_pkgdata_SCRIPTS = \
- setup.ksh \
- cleanup.ksh \
- run_edonr_test.ksh \
- run_sha2_test.ksh \
- run_skein_test.ksh \
- filetest_001_pos.ksh \
- filetest_002_pos.ksh
-
-dist_pkgdata_DATA = \
- default.cfg
-
-pkgexecdir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/checksum
-
-pkgexec_PROGRAMS = \
- edonr_test \
- skein_test \
- sha2_test
-
-skein_test_SOURCES = skein_test.c
-sha2_test_SOURCES = sha2_test.c
-
-edonr_test_SOURCES = edonr_test.c
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/checksum/edonr_test.c b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/checksum/edonr_test.c
deleted file mode 100644
index c6365a4147e6..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/checksum/edonr_test.c
+++ /dev/null
@@ -1,215 +0,0 @@
-/*
- * 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://opensource.org/licenses/CDDL-1.0.
- * 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 2013 Saso Kiselkov. All rights reserved.
- */
-
-/*
- * This is just to keep the compiler happy about sys/time.h not declaring
- * gettimeofday due to -D_KERNEL (we can do this since we're actually
- * running in userspace, but we need -D_KERNEL for the remaining Edon-R code).
- */
-#ifdef _KERNEL
-#undef _KERNEL
-#endif
-
-#include <sys/edonr.h>
-#include <stdlib.h>
-#include <string.h>
-#include <stdio.h>
-#include <sys/time.h>
-#include <sys/stdtypes.h>
-
-/*
- * Test messages from:
- * http://csrc.nist.gov/groups/ST/toolkit/documents/Examples/SHA_All.pdf
- */
-const char *test_msg0 = "abc";
-const char *test_msg1 = "abcdbcdecdefdefgefghfghighijhijkijkljklmklmn"
- "lmnomnopnopq";
-const char *test_msg2 = "abcdefghbcdefghicdefghijdefghijkefghijklfghi"
- "jklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu";
-
-/*
- * Test digests computed by hand. There's no formal standard or spec for edonr.
- */
-const uint8_t edonr_224_test_digests[][28] = {
- {
- /* for test_msg0 */
- 0x56, 0x63, 0xc4, 0x93, 0x95, 0x20, 0xfa, 0xf6,
- 0x12, 0x31, 0x65, 0xa4, 0x66, 0xf2, 0x56, 0x01,
- 0x95, 0x2e, 0xa9, 0xe4, 0x24, 0xdd, 0xc9, 0x6b,
- 0xef, 0xd0, 0x40, 0x94
- },
- {
- /* for test_msg1 */
- 0xd0, 0x13, 0xe4, 0x87, 0x4d, 0x06, 0x8d, 0xca,
- 0x4e, 0x14, 0xb9, 0x37, 0x2f, 0xce, 0x12, 0x20,
- 0x60, 0xf8, 0x5c, 0x0a, 0xfd, 0x7a, 0x7d, 0x97,
- 0x88, 0x2b, 0x05, 0x75
- }
- /* no test vector for test_msg2 */
-};
-
-const uint8_t edonr_256_test_digests[][32] = {
- {
- /* for test_msg0 */
- 0x54, 0xd7, 0x8b, 0x13, 0xc7, 0x4e, 0xda, 0x5a,
- 0xed, 0xc2, 0x71, 0xcc, 0x88, 0x1f, 0xb2, 0x2f,
- 0x83, 0x99, 0xaf, 0xd3, 0x04, 0x0b, 0x6a, 0x39,
- 0x2d, 0x73, 0x94, 0x05, 0x50, 0x8d, 0xd8, 0x51
- },
- {
- /* for test_msg1 */
- 0x49, 0x2d, 0x0b, 0x19, 0xab, 0x1e, 0xde, 0x3a,
- 0xea, 0x9b, 0xf2, 0x39, 0x3a, 0xb1, 0x21, 0xde,
- 0x21, 0xf6, 0x80, 0x1f, 0xad, 0xbe, 0x8b, 0x07,
- 0xc7, 0xfb, 0xe6, 0x99, 0x0e, 0x4d, 0x73, 0x63
- }
- /* no test vectorfor test_msg2 */
-};
-
-const uint8_t edonr_384_test_digests[][48] = {
- {
- /* for test_msg0 */
- 0x0e, 0x7c, 0xd7, 0x85, 0x78, 0x77, 0xe0, 0x89,
- 0x5b, 0x1c, 0xdf, 0x49, 0xf4, 0x1d, 0x20, 0x9c,
- 0x72, 0x7d, 0x2e, 0x57, 0x9b, 0x9b, 0x9a, 0xdc,
- 0x60, 0x27, 0x97, 0x82, 0xb9, 0x90, 0x72, 0xec,
- 0x7e, 0xce, 0xd3, 0x16, 0x5f, 0x47, 0x75, 0x48,
- 0xfa, 0x60, 0x72, 0x7e, 0x01, 0xc7, 0x7c, 0xc6
- },
- {
- /* no test vector for test_msg1 */
- 0
- },
- {
- /* for test_msg2 */
- 0xe2, 0x34, 0xa1, 0x02, 0x83, 0x76, 0xae, 0xe6,
- 0x82, 0xd9, 0x38, 0x32, 0x0e, 0x00, 0x78, 0xd2,
- 0x34, 0xdb, 0xb9, 0xbd, 0xf0, 0x08, 0xa8, 0x0f,
- 0x63, 0x1c, 0x3d, 0x4a, 0xfd, 0x0a, 0xe9, 0x59,
- 0xdc, 0xd4, 0xce, 0xcd, 0x8d, 0x67, 0x6c, 0xea,
- 0xbb, 0x1a, 0x32, 0xed, 0x5c, 0x6b, 0xf1, 0x7f
- }
-};
-
-const uint8_t edonr_512_test_digests[][64] = {
- {
- /* for test_msg0 */
- 0x1b, 0x14, 0xdb, 0x15, 0x5f, 0x1d, 0x40, 0x65,
- 0x94, 0xb8, 0xce, 0xf7, 0x0a, 0x43, 0x62, 0xec,
- 0x6b, 0x5d, 0xe6, 0xa5, 0xda, 0xf5, 0x0e, 0xc9,
- 0x99, 0xe9, 0x87, 0xc1, 0x9d, 0x30, 0x49, 0xe2,
- 0xde, 0x59, 0x77, 0xbb, 0x05, 0xb1, 0xbb, 0x22,
- 0x00, 0x50, 0xa1, 0xea, 0x5b, 0x46, 0xa9, 0xf1,
- 0x74, 0x0a, 0xca, 0xfb, 0xf6, 0xb4, 0x50, 0x32,
- 0xad, 0xc9, 0x0c, 0x62, 0x83, 0x72, 0xc2, 0x2b
- },
- {
- /* no test vector for test_msg1 */
- 0
- },
- {
- /* for test_msg2 */
- 0x53, 0x51, 0x07, 0x0d, 0xc5, 0x1c, 0x3b, 0x2b,
- 0xac, 0xa5, 0xa6, 0x0d, 0x02, 0x52, 0xcc, 0xb4,
- 0xe4, 0x92, 0x1a, 0x96, 0xfe, 0x5a, 0x69, 0xe7,
- 0x6d, 0xad, 0x48, 0xfd, 0x21, 0xa0, 0x84, 0x5a,
- 0xd5, 0x7f, 0x88, 0x0b, 0x3e, 0x4a, 0x90, 0x7b,
- 0xc5, 0x03, 0x15, 0x18, 0x42, 0xbb, 0x94, 0x9e,
- 0x1c, 0xba, 0x74, 0x39, 0xa6, 0x40, 0x9a, 0x34,
- 0xb8, 0x43, 0x6c, 0xb4, 0x69, 0x21, 0x58, 0x3c
- }
-};
-
-int
-main(int argc, char *argv[])
-{
- boolean_t failed = B_FALSE;
- uint64_t cpu_mhz = 0;
-
- if (argc == 2)
- cpu_mhz = atoi(argv[1]);
-
-#define EDONR_ALGO_TEST(_m, mode, testdigest) \
- do { \
- EdonRState ctx; \
- uint8_t digest[mode / 8]; \
- EdonRInit(&ctx, mode); \
- EdonRUpdate(&ctx, (const uint8_t *) _m, strlen(_m) * 8);\
- EdonRFinal(&ctx, digest); \
- (void) printf("Edon-R-%-6sMessage: " #_m \
- "\tResult: ", #mode); \
- if (memcmp(digest, testdigest, mode / 8) == 0) { \
- (void) printf("OK\n"); \
- } else { \
- (void) printf("FAILED!\n"); \
- failed = B_TRUE; \
- } \
- } while (0)
-
-#define EDONR_PERF_TEST(mode) \
- do { \
- EdonRState ctx; \
- uint8_t digest[mode / 8]; \
- uint8_t block[131072]; \
- uint64_t delta; \
- double cpb = 0; \
- int i; \
- struct timeval start, end; \
- memset(block, 0, sizeof (block)); \
- (void) gettimeofday(&start, NULL); \
- EdonRInit(&ctx, mode); \
- for (i = 0; i < 8192; i++) \
- EdonRUpdate(&ctx, block, sizeof (block) * 8); \
- EdonRFinal(&ctx, digest); \
- (void) gettimeofday(&end, NULL); \
- delta = (end.tv_sec * 1000000llu + end.tv_usec) - \
- (start.tv_sec * 1000000llu + start.tv_usec); \
- if (cpu_mhz != 0) { \
- cpb = (cpu_mhz * 1e6 * ((double)delta / \
- 1000000)) / (8192 * 128 * 1024); \
- } \
- (void) printf("Edon-R-%-6s%llu us (%.02f CPB)\n", #mode,\
- (u_longlong_t)delta, cpb); \
- } while (0)
-
- (void) printf("Running algorithm correctness tests:\n");
- EDONR_ALGO_TEST(test_msg0, 224, edonr_224_test_digests[0]);
- EDONR_ALGO_TEST(test_msg1, 224, edonr_224_test_digests[1]);
- EDONR_ALGO_TEST(test_msg0, 256, edonr_256_test_digests[0]);
- EDONR_ALGO_TEST(test_msg1, 256, edonr_256_test_digests[1]);
- EDONR_ALGO_TEST(test_msg0, 384, edonr_384_test_digests[0]);
- EDONR_ALGO_TEST(test_msg2, 384, edonr_384_test_digests[2]);
- EDONR_ALGO_TEST(test_msg0, 512, edonr_512_test_digests[0]);
- EDONR_ALGO_TEST(test_msg2, 512, edonr_512_test_digests[2]);
- if (failed)
- return (1);
-
- (void) printf("Running performance tests (hashing 1024 MiB of "
- "data):\n");
- EDONR_PERF_TEST(256);
- EDONR_PERF_TEST(512);
-
- return (0);
-}
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/checksum/filetest_001_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/checksum/filetest_001_pos.ksh
index 615b41f312b6..c9cefcd43dae 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/checksum/filetest_001_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/checksum/filetest_001_pos.ksh
@@ -85,7 +85,7 @@ log_must zpool import $TESTPOOL
log_must zpool scrub $TESTPOOL
log_must wait_scrubbed $TESTPOOL
-cksum=$(zpool status -P -v $TESTPOOL | grep "$firstvdev" | awk '{print $5}')
+cksum=$(zpool status -P -v $TESTPOOL | awk -v v="$firstvdev" '$0 ~ v {print $5}')
log_assert "Normal file write test saw $cksum checksum errors"
log_must [ $cksum -eq 0 ]
@@ -105,8 +105,7 @@ while [[ $j -lt ${#CHECKSUM_TYPES[*]} ]]; do
log_must zpool scrub $TESTPOOL
log_must wait_scrubbed $TESTPOOL
- cksum=$(zpool status -P -v $TESTPOOL | grep "$firstvdev" | \
- awk '{print $5}')
+ cksum=$(zpool status -P -v $TESTPOOL | awk -v v="$firstvdev" '$0 ~ v {print $5}')
log_assert "Checksum '$type' caught $cksum checksum errors"
log_must [ $cksum -ne 0 ]
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/checksum/run_edonr_test.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/checksum/run_edonr_test.ksh
index 42e88a8c8e3f..de5b21918edb 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/checksum/run_edonr_test.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/checksum/run_edonr_test.ksh
@@ -25,6 +25,6 @@
log_assert "Run the tests for the EdonR hash algorithm."
freq=$(get_cpu_freq)
-log_must $STF_SUITE/tests/functional/checksum/edonr_test $freq
+log_must edonr_test $freq
log_pass "EdonR tests passed."
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/checksum/run_sha2_test.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/checksum/run_sha2_test.ksh
index e238d7a53e6d..23954a5d35fe 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/checksum/run_sha2_test.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/checksum/run_sha2_test.ksh
@@ -25,6 +25,6 @@
log_assert "Run the tests for the SHA-2 hash algorithm."
freq=$(get_cpu_freq)
-log_must $STF_SUITE/tests/functional/checksum/sha2_test $freq
+log_must sha2_test $freq
log_pass "SHA-2 tests passed."
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/checksum/run_skein_test.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/checksum/run_skein_test.ksh
index b3a33c3ca8bc..d59bde206d77 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/checksum/run_skein_test.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/checksum/run_skein_test.ksh
@@ -25,6 +25,6 @@
log_assert "Run the tests for the Skein hash algorithm."
freq=$(get_cpu_freq)
-log_must $STF_SUITE/tests/functional/checksum/skein_test $freq
+log_must skein_test $freq
log_pass "Skein tests passed."
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/checksum/sha2_test.c b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/checksum/sha2_test.c
deleted file mode 100644
index dc4173e1059a..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/checksum/sha2_test.c
+++ /dev/null
@@ -1,247 +0,0 @@
-/*
- * 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://opensource.org/licenses/CDDL-1.0.
- * 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 2013 Saso Kiselkov. All rights reserved.
- */
-
-/*
- * This is just to keep the compiler happy about sys/time.h not declaring
- * gettimeofday due to -D_KERNEL (we can do this since we're actually
- * running in userspace, but we need -D_KERNEL for the remaining SHA2 code).
- */
-#ifdef _KERNEL
-#undef _KERNEL
-#endif
-
-#include <stdarg.h>
-#include <stdlib.h>
-#include <string.h>
-#include <stdio.h>
-#include <sys/time.h>
-#define _SHA2_IMPL
-#include <sys/sha2.h>
-#include <sys/stdtypes.h>
-
-
-/*
- * Test messages from:
- * http://csrc.nist.gov/groups/ST/toolkit/documents/Examples/SHA_All.pdf
- */
-
-const char *test_msg0 = "abc";
-const char *test_msg1 = "abcdbcdecdefdefgefghfghighijhijkijkljklmklmn"
- "lmnomnopnopq";
-const char *test_msg2 = "abcdefghbcdefghicdefghijdefghijkefghijklfghi"
- "jklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu";
-
-/*
- * Test digests from:
- * http://csrc.nist.gov/groups/ST/toolkit/documents/Examples/SHA_All.pdf
- */
-const uint8_t sha256_test_digests[][32] = {
- {
- /* for test_msg0 */
- 0xBA, 0x78, 0x16, 0xBF, 0x8F, 0x01, 0xCF, 0xEA,
- 0x41, 0x41, 0x40, 0xDE, 0x5D, 0xAE, 0x22, 0x23,
- 0xB0, 0x03, 0x61, 0xA3, 0x96, 0x17, 0x7A, 0x9C,
- 0xB4, 0x10, 0xFF, 0x61, 0xF2, 0x00, 0x15, 0xAD
- },
- {
- /* for test_msg1 */
- 0x24, 0x8D, 0x6A, 0x61, 0xD2, 0x06, 0x38, 0xB8,
- 0xE5, 0xC0, 0x26, 0x93, 0x0C, 0x3E, 0x60, 0x39,
- 0xA3, 0x3C, 0xE4, 0x59, 0x64, 0xFF, 0x21, 0x67,
- 0xF6, 0xEC, 0xED, 0xD4, 0x19, 0xDB, 0x06, 0xC1
- }
- /* no test vector for test_msg2 */
-};
-
-const uint8_t sha384_test_digests[][48] = {
- {
- /* for test_msg0 */
- 0xCB, 0x00, 0x75, 0x3F, 0x45, 0xA3, 0x5E, 0x8B,
- 0xB5, 0xA0, 0x3D, 0x69, 0x9A, 0xC6, 0x50, 0x07,
- 0x27, 0x2C, 0x32, 0xAB, 0x0E, 0xDE, 0xD1, 0x63,
- 0x1A, 0x8B, 0x60, 0x5A, 0x43, 0xFF, 0x5B, 0xED,
- 0x80, 0x86, 0x07, 0x2B, 0xA1, 0xE7, 0xCC, 0x23,
- 0x58, 0xBA, 0xEC, 0xA1, 0x34, 0xC8, 0x25, 0xA7
- },
- {
- /* no test vector for test_msg1 */
- 0
- },
- {
- /* for test_msg2 */
- 0x09, 0x33, 0x0C, 0x33, 0xF7, 0x11, 0x47, 0xE8,
- 0x3D, 0x19, 0x2F, 0xC7, 0x82, 0xCD, 0x1B, 0x47,
- 0x53, 0x11, 0x1B, 0x17, 0x3B, 0x3B, 0x05, 0xD2,
- 0x2F, 0xA0, 0x80, 0x86, 0xE3, 0xB0, 0xF7, 0x12,
- 0xFC, 0xC7, 0xC7, 0x1A, 0x55, 0x7E, 0x2D, 0xB9,
- 0x66, 0xC3, 0xE9, 0xFA, 0x91, 0x74, 0x60, 0x39
- }
-};
-
-const uint8_t sha512_test_digests[][64] = {
- {
- /* for test_msg0 */
- 0xDD, 0xAF, 0x35, 0xA1, 0x93, 0x61, 0x7A, 0xBA,
- 0xCC, 0x41, 0x73, 0x49, 0xAE, 0x20, 0x41, 0x31,
- 0x12, 0xE6, 0xFA, 0x4E, 0x89, 0xA9, 0x7E, 0xA2,
- 0x0A, 0x9E, 0xEE, 0xE6, 0x4B, 0x55, 0xD3, 0x9A,
- 0x21, 0x92, 0x99, 0x2A, 0x27, 0x4F, 0xC1, 0xA8,
- 0x36, 0xBA, 0x3C, 0x23, 0xA3, 0xFE, 0xEB, 0xBD,
- 0x45, 0x4D, 0x44, 0x23, 0x64, 0x3C, 0xE8, 0x0E,
- 0x2A, 0x9A, 0xC9, 0x4F, 0xA5, 0x4C, 0xA4, 0x9F
- },
- {
- /* no test vector for test_msg1 */
- 0
- },
- {
- /* for test_msg2 */
- 0x8E, 0x95, 0x9B, 0x75, 0xDA, 0xE3, 0x13, 0xDA,
- 0x8C, 0xF4, 0xF7, 0x28, 0x14, 0xFC, 0x14, 0x3F,
- 0x8F, 0x77, 0x79, 0xC6, 0xEB, 0x9F, 0x7F, 0xA1,
- 0x72, 0x99, 0xAE, 0xAD, 0xB6, 0x88, 0x90, 0x18,
- 0x50, 0x1D, 0x28, 0x9E, 0x49, 0x00, 0xF7, 0xE4,
- 0x33, 0x1B, 0x99, 0xDE, 0xC4, 0xB5, 0x43, 0x3A,
- 0xC7, 0xD3, 0x29, 0xEE, 0xB6, 0xDD, 0x26, 0x54,
- 0x5E, 0x96, 0xE5, 0x5B, 0x87, 0x4B, 0xE9, 0x09
- }
-};
-
-const uint8_t sha512_224_test_digests[][28] = {
- {
- /* for test_msg0 */
- 0x46, 0x34, 0x27, 0x0F, 0x70, 0x7B, 0x6A, 0x54,
- 0xDA, 0xAE, 0x75, 0x30, 0x46, 0x08, 0x42, 0xE2,
- 0x0E, 0x37, 0xED, 0x26, 0x5C, 0xEE, 0xE9, 0xA4,
- 0x3E, 0x89, 0x24, 0xAA
- },
- {
- /* no test vector for test_msg1 */
- 0
- },
- {
- /* for test_msg2 */
- 0x23, 0xFE, 0xC5, 0xBB, 0x94, 0xD6, 0x0B, 0x23,
- 0x30, 0x81, 0x92, 0x64, 0x0B, 0x0C, 0x45, 0x33,
- 0x35, 0xD6, 0x64, 0x73, 0x4F, 0xE4, 0x0E, 0x72,
- 0x68, 0x67, 0x4A, 0xF9
- }
-};
-
-const uint8_t sha512_256_test_digests[][32] = {
- {
- /* for test_msg0 */
- 0x53, 0x04, 0x8E, 0x26, 0x81, 0x94, 0x1E, 0xF9,
- 0x9B, 0x2E, 0x29, 0xB7, 0x6B, 0x4C, 0x7D, 0xAB,
- 0xE4, 0xC2, 0xD0, 0xC6, 0x34, 0xFC, 0x6D, 0x46,
- 0xE0, 0xE2, 0xF1, 0x31, 0x07, 0xE7, 0xAF, 0x23
- },
- {
- /* no test vector for test_msg1 */
- 0
- },
- {
- /* for test_msg2 */
- 0x39, 0x28, 0xE1, 0x84, 0xFB, 0x86, 0x90, 0xF8,
- 0x40, 0xDA, 0x39, 0x88, 0x12, 0x1D, 0x31, 0xBE,
- 0x65, 0xCB, 0x9D, 0x3E, 0xF8, 0x3E, 0xE6, 0x14,
- 0x6F, 0xEA, 0xC8, 0x61, 0xE1, 0x9B, 0x56, 0x3A
- }
-};
-
-int
-main(int argc, char *argv[])
-{
- boolean_t failed = B_FALSE;
- uint64_t cpu_mhz = 0;
-
- if (argc == 2)
- cpu_mhz = atoi(argv[1]);
-
-#define SHA2_ALGO_TEST(_m, mode, diglen, testdigest) \
- do { \
- SHA2_CTX ctx; \
- uint8_t digest[diglen / 8]; \
- SHA2Init(SHA ## mode ## _MECH_INFO_TYPE, &ctx); \
- SHA2Update(&ctx, _m, strlen(_m)); \
- SHA2Final(digest, &ctx); \
- (void) printf("SHA%-9sMessage: " #_m \
- "\tResult: ", #mode); \
- if (memcmp(digest, testdigest, diglen / 8) == 0) { \
- (void) printf("OK\n"); \
- } else { \
- (void) printf("FAILED!\n"); \
- failed = B_TRUE; \
- } \
- } while (0)
-
-#define SHA2_PERF_TEST(mode, diglen) \
- do { \
- SHA2_CTX ctx; \
- uint8_t digest[diglen / 8]; \
- uint8_t block[131072]; \
- uint64_t delta; \
- double cpb = 0; \
- int i; \
- struct timeval start, end; \
- memset(block, 0, sizeof (block)); \
- (void) gettimeofday(&start, NULL); \
- SHA2Init(SHA ## mode ## _MECH_INFO_TYPE, &ctx); \
- for (i = 0; i < 8192; i++) \
- SHA2Update(&ctx, block, sizeof (block)); \
- SHA2Final(digest, &ctx); \
- (void) gettimeofday(&end, NULL); \
- delta = (end.tv_sec * 1000000llu + end.tv_usec) - \
- (start.tv_sec * 1000000llu + start.tv_usec); \
- if (cpu_mhz != 0) { \
- cpb = (cpu_mhz * 1e6 * ((double)delta / \
- 1000000)) / (8192 * 128 * 1024); \
- } \
- (void) printf("SHA%-9s%llu us (%.02f CPB)\n", #mode, \
- (u_longlong_t)delta, cpb); \
- } while (0)
-
- (void) printf("Running algorithm correctness tests:\n");
- SHA2_ALGO_TEST(test_msg0, 256, 256, sha256_test_digests[0]);
- SHA2_ALGO_TEST(test_msg1, 256, 256, sha256_test_digests[1]);
- SHA2_ALGO_TEST(test_msg0, 384, 384, sha384_test_digests[0]);
- SHA2_ALGO_TEST(test_msg2, 384, 384, sha384_test_digests[2]);
- SHA2_ALGO_TEST(test_msg0, 512, 512, sha512_test_digests[0]);
- SHA2_ALGO_TEST(test_msg2, 512, 512, sha512_test_digests[2]);
- SHA2_ALGO_TEST(test_msg0, 512_224, 224, sha512_224_test_digests[0]);
- SHA2_ALGO_TEST(test_msg2, 512_224, 224, sha512_224_test_digests[2]);
- SHA2_ALGO_TEST(test_msg0, 512_256, 256, sha512_256_test_digests[0]);
- SHA2_ALGO_TEST(test_msg2, 512_256, 256, sha512_256_test_digests[2]);
-
- if (failed)
- return (1);
-
- (void) printf("Running performance tests (hashing 1024 MiB of "
- "data):\n");
- SHA2_PERF_TEST(256, 256);
- SHA2_PERF_TEST(512, 512);
-
- return (0);
-}
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/checksum/skein_test.c b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/checksum/skein_test.c
deleted file mode 100644
index 99b47b4532fc..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/checksum/skein_test.c
+++ /dev/null
@@ -1,337 +0,0 @@
-/*
- * 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://opensource.org/licenses/CDDL-1.0.
- * 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 2013 Saso Kiselkov. All rights reserved.
- */
-
-/*
- * This is just to keep the compiler happy about sys/time.h not declaring
- * gettimeofday due to -D_KERNEL (we can do this since we're actually
- * running in userspace, but we need -D_KERNEL for the remaining Skein code).
- */
-#ifdef _KERNEL
-#undef _KERNEL
-#endif
-
-#include <sys/skein.h>
-#include <stdlib.h>
-#include <string.h>
-#include <stdio.h>
-#include <sys/time.h>
-#include <sys/stdtypes.h>
-
-/*
- * Skein test suite using values from the Skein V1.3 specification found at:
- * http://www.skein-hash.info/sites/default/files/skein1.3.pdf
- */
-
-/*
- * Test messages from the Skein spec, Appendix C.
- */
-const uint8_t test_msg0[] = {
- 0xFF
-};
-
-const uint8_t test_msg1[] = {
- 0xFF, 0xFE, 0xFD, 0xFC, 0xFB, 0xFA, 0xF9, 0xF8,
- 0xF7, 0xF6, 0xF5, 0xF4, 0xF3, 0xF2, 0xF1, 0xF0,
- 0xEF, 0xEE, 0xED, 0xEC, 0xEB, 0xEA, 0xE9, 0xE8,
- 0xE7, 0xE6, 0xE5, 0xE4, 0xE3, 0xE2, 0xE1, 0xE0
-};
-
-const uint8_t test_msg2[] = {
- 0xFF, 0xFE, 0xFD, 0xFC, 0xFB, 0xFA, 0xF9, 0xF8,
- 0xF7, 0xF6, 0xF5, 0xF4, 0xF3, 0xF2, 0xF1, 0xF0,
- 0xEF, 0xEE, 0xED, 0xEC, 0xEB, 0xEA, 0xE9, 0xE8,
- 0xE7, 0xE6, 0xE5, 0xE4, 0xE3, 0xE2, 0xE1, 0xE0,
- 0xDF, 0xDE, 0xDD, 0xDC, 0xDB, 0xDA, 0xD9, 0xD8,
- 0xD7, 0xD6, 0xD5, 0xD4, 0xD3, 0xD2, 0xD1, 0xD0,
- 0xCF, 0xCE, 0xCD, 0xCC, 0xCB, 0xCA, 0xC9, 0xC8,
- 0xC7, 0xC6, 0xC5, 0xC4, 0xC3, 0xC2, 0xC1, 0xC0
-};
-
-const uint8_t test_msg3[] = {
- 0xFF, 0xFE, 0xFD, 0xFC, 0xFB, 0xFA, 0xF9, 0xF8,
- 0xF7, 0xF6, 0xF5, 0xF4, 0xF3, 0xF2, 0xF1, 0xF0,
- 0xEF, 0xEE, 0xED, 0xEC, 0xEB, 0xEA, 0xE9, 0xE8,
- 0xE7, 0xE6, 0xE5, 0xE4, 0xE3, 0xE2, 0xE1, 0xE0,
- 0xDF, 0xDE, 0xDD, 0xDC, 0xDB, 0xDA, 0xD9, 0xD8,
- 0xD7, 0xD6, 0xD5, 0xD4, 0xD3, 0xD2, 0xD1, 0xD0,
- 0xCF, 0xCE, 0xCD, 0xCC, 0xCB, 0xCA, 0xC9, 0xC8,
- 0xC7, 0xC6, 0xC5, 0xC4, 0xC3, 0xC2, 0xC1, 0xC0,
- 0xBF, 0xBE, 0xBD, 0xBC, 0xBB, 0xBA, 0xB9, 0xB8,
- 0xB7, 0xB6, 0xB5, 0xB4, 0xB3, 0xB2, 0xB1, 0xB0,
- 0xAF, 0xAE, 0xAD, 0xAC, 0xAB, 0xAA, 0xA9, 0xA8,
- 0xA7, 0xA6, 0xA5, 0xA4, 0xA3, 0xA2, 0xA1, 0xA0,
- 0x9F, 0x9E, 0x9D, 0x9C, 0x9B, 0x9A, 0x99, 0x98,
- 0x97, 0x96, 0x95, 0x94, 0x93, 0x92, 0x91, 0x90,
- 0x8F, 0x8E, 0x8D, 0x8C, 0x8B, 0x8A, 0x89, 0x88,
- 0x87, 0x86, 0x85, 0x84, 0x83, 0x82, 0x81, 0x80
-};
-
-const uint8_t test_msg4[] = {
- 0xFF, 0xFE, 0xFD, 0xFC, 0xFB, 0xFA, 0xF9, 0xF8,
- 0xF7, 0xF6, 0xF5, 0xF4, 0xF3, 0xF2, 0xF1, 0xF0,
- 0xEF, 0xEE, 0xED, 0xEC, 0xEB, 0xEA, 0xE9, 0xE8,
- 0xE7, 0xE6, 0xE5, 0xE4, 0xE3, 0xE2, 0xE1, 0xE0,
- 0xDF, 0xDE, 0xDD, 0xDC, 0xDB, 0xDA, 0xD9, 0xD8,
- 0xD7, 0xD6, 0xD5, 0xD4, 0xD3, 0xD2, 0xD1, 0xD0,
- 0xCF, 0xCE, 0xCD, 0xCC, 0xCB, 0xCA, 0xC9, 0xC8,
- 0xC7, 0xC6, 0xC5, 0xC4, 0xC3, 0xC2, 0xC1, 0xC0,
- 0xBF, 0xBE, 0xBD, 0xBC, 0xBB, 0xBA, 0xB9, 0xB8,
- 0xB7, 0xB6, 0xB5, 0xB4, 0xB3, 0xB2, 0xB1, 0xB0,
- 0xAF, 0xAE, 0xAD, 0xAC, 0xAB, 0xAA, 0xA9, 0xA8,
- 0xA7, 0xA6, 0xA5, 0xA4, 0xA3, 0xA2, 0xA1, 0xA0,
- 0x9F, 0x9E, 0x9D, 0x9C, 0x9B, 0x9A, 0x99, 0x98,
- 0x97, 0x96, 0x95, 0x94, 0x93, 0x92, 0x91, 0x90,
- 0x8F, 0x8E, 0x8D, 0x8C, 0x8B, 0x8A, 0x89, 0x88,
- 0x87, 0x86, 0x85, 0x84, 0x83, 0x82, 0x81, 0x80,
- 0x7F, 0x7E, 0x7D, 0x7C, 0x7B, 0x7A, 0x79, 0x78,
- 0x77, 0x76, 0x75, 0x74, 0x73, 0x72, 0x71, 0x70,
- 0x6F, 0x6E, 0x6D, 0x6C, 0x6B, 0x6A, 0x69, 0x68,
- 0x67, 0x66, 0x65, 0x64, 0x63, 0x62, 0x61, 0x60,
- 0x5F, 0x5E, 0x5D, 0x5C, 0x5B, 0x5A, 0x59, 0x58,
- 0x57, 0x56, 0x55, 0x54, 0x53, 0x52, 0x51, 0x50,
- 0x4F, 0x4E, 0x4D, 0x4C, 0x4B, 0x4A, 0x49, 0x48,
- 0x47, 0x46, 0x45, 0x44, 0x43, 0x42, 0x41, 0x40,
- 0x3F, 0x3E, 0x3D, 0x3C, 0x3B, 0x3A, 0x39, 0x38,
- 0x37, 0x36, 0x35, 0x34, 0x33, 0x32, 0x31, 0x30,
- 0x2F, 0x2E, 0x2D, 0x2C, 0x2B, 0x2A, 0x29, 0x28,
- 0x27, 0x26, 0x25, 0x24, 0x23, 0x22, 0x21, 0x20,
- 0x1F, 0x1E, 0x1D, 0x1C, 0x1B, 0x1A, 0x19, 0x18,
- 0x17, 0x16, 0x15, 0x14, 0x13, 0x12, 0x11, 0x10,
- 0x0F, 0x0E, 0x0D, 0x0C, 0x0B, 0x0A, 0x09, 0x08,
- 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x00
-};
-
-/*
- * Test digests from the Skein spec, Appendix C.
- */
-const uint8_t skein_256_test_digests[][32] = {
- {
- /* for test_msg0 */
- 0x0B, 0x98, 0xDC, 0xD1, 0x98, 0xEA, 0x0E, 0x50,
- 0xA7, 0xA2, 0x44, 0xC4, 0x44, 0xE2, 0x5C, 0x23,
- 0xDA, 0x30, 0xC1, 0x0F, 0xC9, 0xA1, 0xF2, 0x70,
- 0xA6, 0x63, 0x7F, 0x1F, 0x34, 0xE6, 0x7E, 0xD2
- },
- {
- /* for test_msg1 */
- 0x8D, 0x0F, 0xA4, 0xEF, 0x77, 0x7F, 0xD7, 0x59,
- 0xDF, 0xD4, 0x04, 0x4E, 0x6F, 0x6A, 0x5A, 0xC3,
- 0xC7, 0x74, 0xAE, 0xC9, 0x43, 0xDC, 0xFC, 0x07,
- 0x92, 0x7B, 0x72, 0x3B, 0x5D, 0xBF, 0x40, 0x8B
- },
- {
- /* for test_msg2 */
- 0xDF, 0x28, 0xE9, 0x16, 0x63, 0x0D, 0x0B, 0x44,
- 0xC4, 0xA8, 0x49, 0xDC, 0x9A, 0x02, 0xF0, 0x7A,
- 0x07, 0xCB, 0x30, 0xF7, 0x32, 0x31, 0x82, 0x56,
- 0xB1, 0x5D, 0x86, 0x5A, 0xC4, 0xAE, 0x16, 0x2F
- }
- /* no test digests for test_msg3 and test_msg4 */
-};
-
-const uint8_t skein_512_test_digests[][64] = {
- {
- /* for test_msg0 */
- 0x71, 0xB7, 0xBC, 0xE6, 0xFE, 0x64, 0x52, 0x22,
- 0x7B, 0x9C, 0xED, 0x60, 0x14, 0x24, 0x9E, 0x5B,
- 0xF9, 0xA9, 0x75, 0x4C, 0x3A, 0xD6, 0x18, 0xCC,
- 0xC4, 0xE0, 0xAA, 0xE1, 0x6B, 0x31, 0x6C, 0xC8,
- 0xCA, 0x69, 0x8D, 0x86, 0x43, 0x07, 0xED, 0x3E,
- 0x80, 0xB6, 0xEF, 0x15, 0x70, 0x81, 0x2A, 0xC5,
- 0x27, 0x2D, 0xC4, 0x09, 0xB5, 0xA0, 0x12, 0xDF,
- 0x2A, 0x57, 0x91, 0x02, 0xF3, 0x40, 0x61, 0x7A
- },
- {
- /* no test vector for test_msg1 */
- 0,
- },
- {
- /* for test_msg2 */
- 0x45, 0x86, 0x3B, 0xA3, 0xBE, 0x0C, 0x4D, 0xFC,
- 0x27, 0xE7, 0x5D, 0x35, 0x84, 0x96, 0xF4, 0xAC,
- 0x9A, 0x73, 0x6A, 0x50, 0x5D, 0x93, 0x13, 0xB4,
- 0x2B, 0x2F, 0x5E, 0xAD, 0xA7, 0x9F, 0xC1, 0x7F,
- 0x63, 0x86, 0x1E, 0x94, 0x7A, 0xFB, 0x1D, 0x05,
- 0x6A, 0xA1, 0x99, 0x57, 0x5A, 0xD3, 0xF8, 0xC9,
- 0xA3, 0xCC, 0x17, 0x80, 0xB5, 0xE5, 0xFA, 0x4C,
- 0xAE, 0x05, 0x0E, 0x98, 0x98, 0x76, 0x62, 0x5B
- },
- {
- /* for test_msg3 */
- 0x91, 0xCC, 0xA5, 0x10, 0xC2, 0x63, 0xC4, 0xDD,
- 0xD0, 0x10, 0x53, 0x0A, 0x33, 0x07, 0x33, 0x09,
- 0x62, 0x86, 0x31, 0xF3, 0x08, 0x74, 0x7E, 0x1B,
- 0xCB, 0xAA, 0x90, 0xE4, 0x51, 0xCA, 0xB9, 0x2E,
- 0x51, 0x88, 0x08, 0x7A, 0xF4, 0x18, 0x87, 0x73,
- 0xA3, 0x32, 0x30, 0x3E, 0x66, 0x67, 0xA7, 0xA2,
- 0x10, 0x85, 0x6F, 0x74, 0x21, 0x39, 0x00, 0x00,
- 0x71, 0xF4, 0x8E, 0x8B, 0xA2, 0xA5, 0xAD, 0xB7
- }
- /* no test digests for test_msg4 */
-};
-
-const uint8_t skein_1024_test_digests[][128] = {
- {
- /* for test_msg0 */
- 0xE6, 0x2C, 0x05, 0x80, 0x2E, 0xA0, 0x15, 0x24,
- 0x07, 0xCD, 0xD8, 0x78, 0x7F, 0xDA, 0x9E, 0x35,
- 0x70, 0x3D, 0xE8, 0x62, 0xA4, 0xFB, 0xC1, 0x19,
- 0xCF, 0xF8, 0x59, 0x0A, 0xFE, 0x79, 0x25, 0x0B,
- 0xCC, 0xC8, 0xB3, 0xFA, 0xF1, 0xBD, 0x24, 0x22,
- 0xAB, 0x5C, 0x0D, 0x26, 0x3F, 0xB2, 0xF8, 0xAF,
- 0xB3, 0xF7, 0x96, 0xF0, 0x48, 0x00, 0x03, 0x81,
- 0x53, 0x1B, 0x6F, 0x00, 0xD8, 0x51, 0x61, 0xBC,
- 0x0F, 0xFF, 0x4B, 0xEF, 0x24, 0x86, 0xB1, 0xEB,
- 0xCD, 0x37, 0x73, 0xFA, 0xBF, 0x50, 0xAD, 0x4A,
- 0xD5, 0x63, 0x9A, 0xF9, 0x04, 0x0E, 0x3F, 0x29,
- 0xC6, 0xC9, 0x31, 0x30, 0x1B, 0xF7, 0x98, 0x32,
- 0xE9, 0xDA, 0x09, 0x85, 0x7E, 0x83, 0x1E, 0x82,
- 0xEF, 0x8B, 0x46, 0x91, 0xC2, 0x35, 0x65, 0x65,
- 0x15, 0xD4, 0x37, 0xD2, 0xBD, 0xA3, 0x3B, 0xCE,
- 0xC0, 0x01, 0xC6, 0x7F, 0xFD, 0xE1, 0x5B, 0xA8
- },
- {
- /* no test vector for test_msg1 */
- 0
- },
- {
- /* no test vector for test_msg2 */
- 0
- },
- {
- /* for test_msg3 */
- 0x1F, 0x3E, 0x02, 0xC4, 0x6F, 0xB8, 0x0A, 0x3F,
- 0xCD, 0x2D, 0xFB, 0xBC, 0x7C, 0x17, 0x38, 0x00,
- 0xB4, 0x0C, 0x60, 0xC2, 0x35, 0x4A, 0xF5, 0x51,
- 0x18, 0x9E, 0xBF, 0x43, 0x3C, 0x3D, 0x85, 0xF9,
- 0xFF, 0x18, 0x03, 0xE6, 0xD9, 0x20, 0x49, 0x31,
- 0x79, 0xED, 0x7A, 0xE7, 0xFC, 0xE6, 0x9C, 0x35,
- 0x81, 0xA5, 0xA2, 0xF8, 0x2D, 0x3E, 0x0C, 0x7A,
- 0x29, 0x55, 0x74, 0xD0, 0xCD, 0x7D, 0x21, 0x7C,
- 0x48, 0x4D, 0x2F, 0x63, 0x13, 0xD5, 0x9A, 0x77,
- 0x18, 0xEA, 0xD0, 0x7D, 0x07, 0x29, 0xC2, 0x48,
- 0x51, 0xD7, 0xE7, 0xD2, 0x49, 0x1B, 0x90, 0x2D,
- 0x48, 0x91, 0x94, 0xE6, 0xB7, 0xD3, 0x69, 0xDB,
- 0x0A, 0xB7, 0xAA, 0x10, 0x6F, 0x0E, 0xE0, 0xA3,
- 0x9A, 0x42, 0xEF, 0xC5, 0x4F, 0x18, 0xD9, 0x37,
- 0x76, 0x08, 0x09, 0x85, 0xF9, 0x07, 0x57, 0x4F,
- 0x99, 0x5E, 0xC6, 0xA3, 0x71, 0x53, 0xA5, 0x78
- },
- {
- /* for test_msg4 */
- 0x84, 0x2A, 0x53, 0xC9, 0x9C, 0x12, 0xB0, 0xCF,
- 0x80, 0xCF, 0x69, 0x49, 0x1B, 0xE5, 0xE2, 0xF7,
- 0x51, 0x5D, 0xE8, 0x73, 0x3B, 0x6E, 0xA9, 0x42,
- 0x2D, 0xFD, 0x67, 0x66, 0x65, 0xB5, 0xFA, 0x42,
- 0xFF, 0xB3, 0xA9, 0xC4, 0x8C, 0x21, 0x77, 0x77,
- 0x95, 0x08, 0x48, 0xCE, 0xCD, 0xB4, 0x8F, 0x64,
- 0x0F, 0x81, 0xFB, 0x92, 0xBE, 0xF6, 0xF8, 0x8F,
- 0x7A, 0x85, 0xC1, 0xF7, 0xCD, 0x14, 0x46, 0xC9,
- 0x16, 0x1C, 0x0A, 0xFE, 0x8F, 0x25, 0xAE, 0x44,
- 0x4F, 0x40, 0xD3, 0x68, 0x00, 0x81, 0xC3, 0x5A,
- 0xA4, 0x3F, 0x64, 0x0F, 0xD5, 0xFA, 0x3C, 0x3C,
- 0x03, 0x0B, 0xCC, 0x06, 0xAB, 0xAC, 0x01, 0xD0,
- 0x98, 0xBC, 0xC9, 0x84, 0xEB, 0xD8, 0x32, 0x27,
- 0x12, 0x92, 0x1E, 0x00, 0xB1, 0xBA, 0x07, 0xD6,
- 0xD0, 0x1F, 0x26, 0x90, 0x70, 0x50, 0x25, 0x5E,
- 0xF2, 0xC8, 0xE2, 0x4F, 0x71, 0x6C, 0x52, 0xA5
- }
-};
-
-int
-main(int argc, char *argv[])
-{
- boolean_t failed = B_FALSE;
- uint64_t cpu_mhz = 0;
-
- if (argc == 2)
- cpu_mhz = atoi(argv[1]);
-
-#define SKEIN_ALGO_TEST(_m, mode, diglen, testdigest) \
- do { \
- Skein ## mode ## _Ctxt_t ctx; \
- uint8_t digest[diglen / 8]; \
- (void) Skein ## mode ## _Init(&ctx, diglen); \
- (void) Skein ## mode ## _Update(&ctx, _m, sizeof (_m)); \
- (void) Skein ## mode ## _Final(&ctx, digest); \
- (void) printf("Skein" #mode "/" #diglen \
- "\tMessage: " #_m "\tResult: "); \
- if (memcmp(digest, testdigest, diglen / 8) == 0) { \
- (void) printf("OK\n"); \
- } else { \
- (void) printf("FAILED!\n"); \
- failed = B_TRUE; \
- } \
- } while (0)
-
-#define SKEIN_PERF_TEST(mode, diglen) \
- do { \
- Skein ## mode ## _Ctxt_t ctx; \
- uint8_t digest[diglen / 8]; \
- uint8_t block[131072]; \
- uint64_t delta; \
- double cpb = 0; \
- int i; \
- struct timeval start, end; \
- memset(block, 0, sizeof (block)); \
- (void) gettimeofday(&start, NULL); \
- (void) Skein ## mode ## _Init(&ctx, diglen); \
- for (i = 0; i < 8192; i++) { \
- (void) Skein ## mode ## _Update(&ctx, block, \
- sizeof (block)); \
- } \
- (void) Skein ## mode ## _Final(&ctx, digest); \
- (void) gettimeofday(&end, NULL); \
- delta = (end.tv_sec * 1000000llu + end.tv_usec) - \
- (start.tv_sec * 1000000llu + start.tv_usec); \
- if (cpu_mhz != 0) { \
- cpb = (cpu_mhz * 1e6 * ((double)delta / \
- 1000000)) / (8192 * 128 * 1024); \
- } \
- (void) printf("Skein" #mode "/" #diglen "\t%llu us " \
- "(%.02f CPB)\n", (u_longlong_t)delta, cpb); \
- } while (0)
-
- (void) printf("Running algorithm correctness tests:\n");
- SKEIN_ALGO_TEST(test_msg0, _256, 256, skein_256_test_digests[0]);
- SKEIN_ALGO_TEST(test_msg1, _256, 256, skein_256_test_digests[1]);
- SKEIN_ALGO_TEST(test_msg2, _256, 256, skein_256_test_digests[2]);
- SKEIN_ALGO_TEST(test_msg0, _512, 512, skein_512_test_digests[0]);
- SKEIN_ALGO_TEST(test_msg2, _512, 512, skein_512_test_digests[2]);
- SKEIN_ALGO_TEST(test_msg3, _512, 512, skein_512_test_digests[3]);
- SKEIN_ALGO_TEST(test_msg0, 1024, 1024, skein_1024_test_digests[0]);
- SKEIN_ALGO_TEST(test_msg3, 1024, 1024, skein_1024_test_digests[3]);
- SKEIN_ALGO_TEST(test_msg4, 1024, 1024, skein_1024_test_digests[4]);
- if (failed)
- return (1);
-
- (void) printf("Running performance tests (hashing 1024 MiB of "
- "data):\n");
- SKEIN_PERF_TEST(_256, 256);
- SKEIN_PERF_TEST(_512, 512);
- SKEIN_PERF_TEST(1024, 1024);
-
- return (0);
-}
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/clean_mirror/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/clean_mirror/Makefile.am
deleted file mode 100644
index 2bc67709fffb..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/clean_mirror/Makefile.am
+++ /dev/null
@@ -1,12 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/clean_mirror
-dist_pkgdata_SCRIPTS = \
- cleanup.ksh \
- setup.ksh \
- clean_mirror_001_pos.ksh \
- clean_mirror_002_pos.ksh \
- clean_mirror_003_pos.ksh \
- clean_mirror_004_pos.ksh
-
-dist_pkgdata_DATA = \
- clean_mirror_common.kshlib \
- default.cfg
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/Makefile.am
deleted file mode 100644
index 9951f96f31ef..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/Makefile.am
+++ /dev/null
@@ -1,67 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root
-dist_pkgdata_DATA = \
- cli_common.kshlib
-
-SUBDIRS = \
- zdb \
- zfs \
- zfs_bookmark \
- zfs_change-key \
- zfs_clone \
- zfs_copies \
- zfs_create \
- zfs_destroy \
- zfs_diff \
- zfs_get \
- zfs_ids_to_path \
- zfs_inherit \
- zfs_jail \
- zfs_load-key \
- zfs_mount \
- zfs_program \
- zfs_promote \
- zfs_property \
- zfs_receive \
- zfs_rename \
- zfs_reservation \
- zfs_rollback \
- zfs_send \
- zfs_set \
- zfs_share \
- zfs_snapshot \
- zfs_sysfs \
- zfs_unload-key \
- zfs_unmount \
- zfs_unshare \
- zfs_upgrade \
- zfs_wait \
- zhack \
- zpool \
- zpool_add \
- zpool_attach \
- zpool_clear \
- zpool_create \
- zpool_destroy \
- zpool_detach \
- zpool_events \
- zpool_expand \
- zpool_export \
- zpool_get \
- zpool_history \
- zpool_import \
- zpool_initialize \
- zpool_labelclear \
- zpool_offline \
- zpool_online \
- zpool_remove \
- zpool_reopen \
- zpool_replace \
- zpool_resilver \
- zpool_scrub \
- zpool_set \
- zpool_split \
- zpool_status \
- zpool_sync \
- zpool_trim \
- zpool_upgrade \
- zpool_wait
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/cli_common.kshlib b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/cli_common.kshlib
index 4788de598663..1e4917affff7 100644
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/cli_common.kshlib
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/cli_common.kshlib
@@ -31,21 +31,13 @@
. $STF_SUITE/include/libtest.shlib
#
-# Get the checksum and size of the file.
-#
-function get_cksum # <file path>
-{
- return $(cksum $1 | awk '{print $1 $2}')
-}
-
-#
-# Compare the check sum of target files with the original file
+# Compare the checksum of target files with the original file
#
function compare_cksum #<orig_data> <target_data1>...<target_datan>
{
typeset orig_data=$1
- typeset orig_sum=$(get_cksum $orig_data)
+ typeset orig_sum=$(cksum < $orig_data)
typeset target_sum=""
typeset bad_data_list=""
typeset -i bad_count=0
@@ -58,7 +50,7 @@ function compare_cksum #<orig_data> <target_data1>...<target_datan>
continue
fi
- target_sum=$(get_cksum $data)
+ target_sum=$(cksum < $data)
if [[ $target_sum != $orig_sum ]]; then
bad_data_list="$bad_data_list $data"
(( bad_count +=1 ))
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zdb/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zdb/Makefile.am
deleted file mode 100644
index c1d4bf5a47ba..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zdb/Makefile.am
+++ /dev/null
@@ -1,20 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zdb
-dist_pkgdata_SCRIPTS = \
- zdb_002_pos.ksh \
- zdb_003_pos.ksh \
- zdb_004_pos.ksh \
- zdb_005_pos.ksh \
- zdb_006_pos.ksh \
- zdb_args_neg.ksh \
- zdb_args_pos.ksh \
- zdb_block_size_histogram.ksh \
- zdb_checksum.ksh \
- zdb_decompress.ksh \
- zdb_decompress_zstd.ksh \
- zdb_object_range_neg.ksh \
- zdb_object_range_pos.ksh \
- zdb_display_block.ksh \
- zdb_label_checksum.ksh \
- zdb_objset_id.ksh \
- zdb_recover.ksh \
- zdb_recover_2.ksh
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zdb/zdb_003_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zdb/zdb_003_pos.ksh
index 36f1929dd193..0e4dcf8e6f1e 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zdb/zdb_003_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zdb/zdb_003_pos.ksh
@@ -60,8 +60,8 @@ log_note "$DEVS"
log_must dd if=/dev/${DISK[0]} of=/dev/${DISK[1]} bs=1K count=256 conv=notrunc
for x in 0 1 ; do
- config_count=$(zdb -l $DEV_RDSKDIR/${DISK[$x]} | grep -c features_for_read)
- (( $? != 0)) && log_fail "failed to get config_count from DISK[$x]"
+ config_count=$(zdb -l $DEV_RDSKDIR/${DISK[$x]} | grep -c features_for_read) ||
+ log_fail "failed to get config_count from DISK[$x]"
log_note "vdev $x: message_count $config_count"
[ $config_count -ne ${config_count[$x]} ] && \
log_fail "zdb produces an incorrect number of configuration dumps."
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zdb/zdb_004_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zdb/zdb_004_pos.ksh
index 2c6e6e9be070..52bcc0311375 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zdb/zdb_004_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zdb/zdb_004_pos.ksh
@@ -70,12 +70,14 @@ log_must dd if=$DEV_RDSKDIR/${DISK[0]} of=$DEV_RDSKDIR/${DISK[1]} bs=1K count=25
ubs=$(zdb -lu ${DISK[1]} | grep -e LABEL -e Uberblock -e 'labels = ')
log_note "vdev 1: ubs $ubs"
+set -o pipefail
ub_dump_counts=$(zdb -lu ${DISK[1]} | \
awk ' /LABEL/ {label=$NF; blocks[label]=0};
/Uberblock/ {blocks[label]++};
- END {print blocks[0],blocks[1],blocks[2],blocks[3]}')
-(( $? != 0)) && log_fail "failed to get ub_dump_counts from DISK[1]"
+ END {print blocks[0],blocks[1],blocks[2],blocks[3]}') ||
+ log_fail "failed to get ub_dump_counts from DISK[1]"
log_note "vdev 1: ub_dump_counts $ub_dump_counts"
+set +o pipefail
set -A dump_count $ub_dump_counts
for label in 0 1 2 3; do
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zdb/zdb_args_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zdb/zdb_args_pos.ksh
index 4c2fc15ec025..75654c29b1ef 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zdb/zdb_args_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zdb/zdb_args_pos.ksh
@@ -59,7 +59,7 @@ function test_imported_pool
{
typeset -a args=("-A" "-b" "-C" "-c" "-d" "-D" "-G" "-h" "-i" "-L" \
"-M" "-P" "-s" "-v" "-Y" "-y")
- for i in ${args[@]}; do
+ for i in ${args[@]}; do
log_must eval "zdb $i $TESTPOOL >/dev/null"
done
}
@@ -69,7 +69,7 @@ function test_exported_pool
log_must zpool export $TESTPOOL
typeset -a args=("-A" "-b" "-C" "-c" "-d" "-D" "-F" "-G" "-h" "-i" "-L" "-M" \
"-P" "-s" "-v" "-X" "-Y" "-y")
- for i in ${args[@]}; do
+ for i in ${args[@]}; do
log_must eval "zdb -e $i $TESTPOOL >/dev/null"
done
log_must zpool import $TESTPOOL
@@ -81,7 +81,7 @@ function test_vdev
VDEVS=$(get_pool_devices ${TESTPOOL} ${DEV_RDSKDIR})
log_note $VDEVS
set -A VDEV_ARRAY $VDEVS
- for i in ${args[@]}; do
+ for i in ${args[@]}; do
log_must eval "zdb -l $i ${VDEV_ARRAY[0]} >/dev/null"
done
}
@@ -89,7 +89,7 @@ function test_vdev
function test_metaslab
{
typeset -a args=("-A" "-L" "-P" "-Y")
- for i in ${args[@]}; do
+ for i in ${args[@]}; do
log_must eval "zdb -m $i $TESTPOOL >/dev/null"
done
}
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zdb/zdb_block_size_histogram.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zdb/zdb_block_size_histogram.ksh
index 6ad93d87ca9a..0a4d24fa695a 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zdb/zdb_block_size_histogram.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zdb/zdb_block_size_histogram.ksh
@@ -115,8 +115,7 @@ function histo_populate_test_pool
of=/${pool}/B_${this_rs}/file_${filenum} \
bs=${this_rs} count=${thiscount} \
iflag=fullblock 2>&1 | \
- egrep -v -e "records in" -e "records out" \
- -e "bytes.*copied"
+ grep -ve "records in" -e "records out" -e "bytes.*copied"
((filenum+=1))
done
done
@@ -146,8 +145,6 @@ function histo_check_test_pool
typeset -i this_rs
typeset -i this_ri
typeset -i sum_filesizes=0
- typeset dumped
- typeset stripped
let histo_check_pool_size=$(get_pool_prop size ${pool})
if [[ ! ${histo_check_pool_size} =~ ${re_number} ]]; then
@@ -158,11 +155,9 @@ function histo_check_test_pool
log_fail "hctp: max_pool_record_size is not numeric ${max_pool_record_size}"
fi
- dumped="${TEST_BASE_DIR}/${pool}_dump.txt"
stripped="${TEST_BASE_DIR}/${pool}_stripped.txt"
zdb -Pbbb ${pool} | \
- tee ${dumped} | \
sed -e '1,/^block[ ][ ]*psize[ ][ ]*lsize.*$/d' \
-e '/^size[ ]*Count/d' -e '/^$/,$d' \
> ${stripped}
@@ -247,6 +242,8 @@ function histo_check_test_pool
fi
fi
done < ${stripped}
+ rm "${stripped}"
+
if [ ${fail_value} -gt 0 ]; then
if [ ${error_count} -eq 1 ]; then
log_note "hctp: There was ${error_count} error"
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zdb/zdb_checksum.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zdb/zdb_checksum.ksh
index 4f661262a72d..d79933fd5b59 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zdb/zdb_checksum.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zdb/zdb_checksum.ksh
@@ -53,13 +53,13 @@ log_note "file $init_data has object number $obj"
sync_pool $TESTPOOL
output=$(zdb -ddddddbbbbbb $TESTPOOL/$TESTFS $obj 2> /dev/null \
- |grep -m 1 "L0 DVA" |head -n1)
+ | grep -m 1 "L0 DVA")
dva=$(sed -Ene 's/^.+DVA\[0\]=<([^>]+)>.*$/\1/p' <<< "$output")
log_note "block 0 of $init_data has a DVA of $dva"
cksum_expected=$(sed -Ene 's/^.+ cksum=([a-z0-9:]+)$/\1/p' <<< "$output")
log_note "expecting cksum $cksum_expected"
output=$(zdb -R $TESTPOOL $dva:c 2> /dev/null)
-result=$(grep $cksum_expected <<< "$output")
-(( $? != 0 )) && log_fail "zdb -R failed to print the correct checksum"
+grep -q $cksum_expected <<<"$output" ||
+ log_fail "zdb -R failed to print the correct checksum"
log_pass "zdb -R generates the correct checksum"
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zdb/zdb_decompress.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zdb/zdb_decompress.ksh
index 1ebcbfb44953..f10d13fb5d70 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zdb/zdb_decompress.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zdb/zdb_decompress.ksh
@@ -73,7 +73,7 @@ obj=${array[0]}
log_note "file $init_data has object number $obj"
output=$(zdb -ddddddbbbbbb $TESTPOOL/$TESTFS $obj 2> /dev/null \
- |grep -m 1 "L0 DVA" |head -n1)
+ |grep -m 1 "L0 DVA")
dva=$(sed -Ene 's/^.+DVA\[0\]=<([^>]+)>.*$/\1/p' <<< "$output")
log_note "block 0 of $init_data has a DVA of $dva"
@@ -81,15 +81,13 @@ log_note "block 0 of $init_data has a DVA of $dva"
size_str=$(sed -Ene 's/^.+ size=([^ ]+) .*$/\1/p' <<< "$output")
log_note "block size $size_str"
-vdev=$(echo "$dva" |awk '{split($0,array,":")} END{print array[1]}')
-offset=$(echo "$dva" |awk '{split($0,array,":")} END{print array[2]}')
+vdev=$(echo "$dva" | cut -d: -f1)
+offset=$(echo "$dva" | cut -d: -f2)
output=$(zdb -R $TESTPOOL $vdev:$offset:$size_str:d 2> /dev/null)
-echo $output |grep $pattern > /dev/null
-(( $? != 0 )) && log_fail "zdb -R :d failed to decompress the data properly"
+echo $output | grep -q $pattern || log_fail "zdb -R :d failed to decompress the data properly"
output=$(zdb -R $TESTPOOL $vdev:$offset:$size_str:dr 2> /dev/null)
-echo $output |grep $four_k > /dev/null
-(( $? != 0 )) && log_fail "zdb -R :dr failed to decompress the data properly"
+echo $output | grep -q $four_k || log_fail "zdb -R :dr failed to decompress the data properly"
output=$(zdb -R $TESTPOOL $vdev:$offset:$size_str:dr 2> /dev/null)
result=${#output}
@@ -97,8 +95,8 @@ result=${#output}
"zdb -R failed to decompress the data to the length (${#output} != $size_str)"
# decompress using lsize
-lsize=$(echo $size_str |awk '{split($0,array,"/")} END{print array[1]}')
-psize=$(echo $size_str |awk '{split($0,array,"/")} END{print array[2]}')
+lsize=$(echo $size_str | cut -d/ -f1)
+psize=$(echo $size_str | cut -d/ -f2)
output=$(zdb -R $TESTPOOL $vdev:$offset:$lsize:dr 2> /dev/null)
result=${#output}
(( $result != $blksize)) && log_fail \
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zdb/zdb_decompress_zstd.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zdb/zdb_decompress_zstd.ksh
index 238d49560461..c7e10bac4570 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zdb/zdb_decompress_zstd.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zdb/zdb_decompress_zstd.ksh
@@ -63,52 +63,44 @@ done
sync_pool $TESTPOOL true
# get object number of file
-listing=$(ls -i $init_data)
-set -A array $listing
-obj=${array[0]}
+read -r obj _ < <(ls -i $init_data)
log_note "file $init_data has object number $obj"
output=$(zdb -Zddddddbbbbbb $TESTPOOL/$TESTFS $obj 2> /dev/null \
- |grep -m 1 "L0 DVA" |head -n1)
+ | grep -m 1 "L0 DVA")
dva=$(sed -Ene 's/^.+DVA\[0\]=<([^>]+)>.*$/\1/p' <<< "$output")
log_note "block 0 of $init_data has a DVA of $dva"
# use the length reported by zdb -ddddddbbbbbb
size_str=$(sed -Ene 's/^.+ size=([^ ]+) .*$/\1/p' <<< "$output")
# convert sizes to decimal
-lsize=$(echo $size_str |awk '{split($0,array,"/")} END{print array[1]}')
+IFS='/' read -r lsize psize _ <<<"$size_str"
lsize_orig=$lsize
-lsize=${lsize%?}
-lsize_bytes=$((16#$lsize))
-psize=$(echo $size_str |awk '{split($0,array,"/")} END{print array[2]}')
psize_orig=$psize
+lsize=${lsize%?}
psize=${psize%?}
+lsize_bytes=$((16#$lsize))
psize_bytes=$((16#$psize))
log_note "block size $size_str"
# Get the ZSTD header reported by zdb -Z
-zstd_str=$(sed -Ene 's/^.+ ZSTD:size=([^:]+):version=([^:]+):level=([^:]+):.*$/\1:\2:\3/p' <<< "$output")
-zstd_size=$(echo "$zstd_str" |awk '{split($0,array,":")} END{print array[1]}')
+read -r zstd_size zstd_version zstd_level < <(sed -Ene 's/^.+ ZSTD:size=([^:]+):version=([^:]+):level=([^:]+):.*$/\1 \2 \3/p' <<<"$output")
log_note "ZSTD compressed size $zstd_size"
(( $psize_bytes < $zstd_size )) && log_fail \
"zdb -Z failed: physical block size was less than header content length ($psize_bytes < $zstd_size)"
-zstd_version=$(echo "$zstd_str" |awk '{split($0,array,":")} END{print array[2]}')
log_note "ZSTD version $zstd_version"
-zstd_level=$(echo "$zstd_str" |awk '{split($0,array,":")} END{print array[3]}')
log_note "ZSTD level $zstd_level"
(( $zstd_level != $random_level )) && log_fail \
"zdb -Z failed: compression level did not match header level ($zstd_level < $random_level)"
-vdev=$(echo "$dva" |awk '{split($0,array,":")} END{print array[1]}')
-offset=$(echo "$dva" |awk '{split($0,array,":")} END{print array[2]}')
+IFS=':' read -r vdev offset _ <<<"$dva"
# Check the first 1024 bytes
output=$(ZDB_NO_ZLE="true" zdb -R $TESTPOOL $vdev:$offset:$size_str:dr 2> /dev/null)
-outsize=$(wc -c <<< "$output")
-(( $outsize != $blksize )) && log_fail \
-"zdb -Z failed to decompress the data to the expected length ($outsize != $lsize_bytes)"
-cmp $init_data - <<< "$output"
-(( $? != 0 )) && log_fail "zdb -R :dr failed to decompress the data properly"
+(( ${#output} + 1 != $blksize )) && log_fail \
+"zdb -Z failed to decompress the data to the expected length (${#output} != $lsize_bytes)"
+cmp $init_data - <<< "$output" ||
+ log_fail "zdb -R :dr failed to decompress the data properly"
log_pass "zdb -Z flag (ZSTD compression header) works as expected"
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zdb/zdb_display_block.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zdb/zdb_display_block.ksh
index 5cc4575851f7..bab0dea2969b 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zdb/zdb_display_block.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zdb/zdb_display_block.ksh
@@ -69,16 +69,16 @@ obj=${array[0]}
log_note "file $init_data has object number $obj"
output=$(zdb -ddddddbbbbbb $TESTPOOL/$TESTFS $obj 2> /dev/null \
- |grep -m 1 "L1 DVA" |head -n1)
+ |grep -m 1 "L1 DVA" )
dva=$(sed -Ene 's/^.+DVA\[0\]=<([^>]+)>.*/\1/p' <<< "$output")
log_note "first L1 block $init_data has a DVA of $dva"
output=$(zdb -ddddddbbbbbb $TESTPOOL/$TESTFS $obj 2> /dev/null \
- |grep -m 1 "L0 DVA" |head -n1)
+ |grep -m 1 "L0 DVA" )
blk_out0=${output##*>}
blk_out0=${blk_out0##+([[:space:]])}
output=$(zdb -ddddddbbbbbb $TESTPOOL/$TESTFS $obj 2> /dev/null \
- |grep -m 1 "1000 L0 DVA" |head -n1)
+ |grep -m 1 "1000 L0 DVA" )
blk_out1=${output##*>}
blk_out1=${blk_out1##+([[:space:]])}
@@ -106,11 +106,11 @@ if [ "$output" != "$blk_out1" ]; then
log_fail "zdb -R :b80d (block 1 display/decompress) failed"
fi
-vdev=$(echo "$dva" |awk '{split($0,array,":")} END{print array[1]}')
-offset=$(echo "$dva" |awk '{split($0,array,":")} END{print array[2]}')
+vdev=$(echo "$dva" | cut -d: -f1)
+offset=$(echo "$dva" | cut -d: -f2)
output=$(export ZDB_NO_ZLE=\"true\";\
zdb -R $TESTPOOL $vdev:$offset:$l1_read_size:id 2> /dev/null)
-block_cnt=$(echo "$output" | grep 'L0' | wc -l)
+block_cnt=$(echo "$output" | grep -c 'L0')
if [ $block_cnt -ne $write_count ]; then
log_fail "zdb -R :id (indirect block display) failed"
fi
@@ -120,7 +120,7 @@ vdev="$vdev.0"
log_note "Reading from DVA $vdev:$offset:$l1_read_size"
output=$(export ZDB_NO_ZLE=\"true\";\
zdb -R $TESTPOOL $vdev:$offset:$l1_read_size:id 2> /dev/null)
-block_cnt=$(echo "$output" | grep 'L0' | wc -l)
+block_cnt=$(echo "$output" | grep -c 'L0')
if [ $block_cnt -ne $write_count ]; then
log_fail "zdb -R 0.0:offset:length:id (indirect block display) failed"
fi
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zdb/zdb_object_range_neg.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zdb/zdb_object_range_neg.ksh
index e2014405853d..e4664b52eb94 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zdb/zdb_object_range_neg.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zdb/zdb_object_range_neg.ksh
@@ -65,7 +65,7 @@ done
# Specifying a non-existent object identifier returns an error
obj_id_highest=$(zdb -P -dd $TESTPOOL/$TESTFS 2>/dev/null |
- egrep "^ +-?([0-9]+ +){7}" | sort -n | tail -n 1 | awk '{print $1}')
+ grep -E "^ +-?([0-9]+ +){7}" | sort -n | awk 'END {print $1}')
obj_id_invalid=$(( $obj_id_highest + 1 ))
log_mustnot zdb -dd $TESTPOOL/$TESTFS $obj_id_invalid
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zdb/zdb_object_range_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zdb/zdb_object_range_pos.ksh
index 1e63ac7d2f4e..2c85e6e932a6 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zdb/zdb_object_range_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zdb/zdb_object_range_pos.ksh
@@ -42,8 +42,8 @@ function get_object_list_range
begin=$2
end=$3
get_object_list $dataset |
- while read line; do
- obj=$(echo $line | awk '{print $1}')
+ while read -r line; do
+ read -r obj _ <<<"$line"
if [[ $obj -ge $begin && $obj -le $end ]] ; then
echo "$line"
elif [[ $obj -gt $end ]] ; then
@@ -60,8 +60,7 @@ function get_object_list_range
function get_object_list
{
zdb -P -dd $@ 2>/dev/null |
- egrep "^ +-?([0-9]+ +){7}" |
- sed 's/^[[:space:]]*//' |
+ sed -E '/^ +-?([0-9]+ +){7}/!d;s/^[[:space:]]*//' |
sort -n
}
@@ -142,7 +141,7 @@ log_must test "\n$actual\n" == "\n$expected\n"
# Specifying individual object IDs works
objects="$start1 $end1 $start2 $end2"
expected="$objects"
-actual=$(get_object_list $TESTPOOL/$TESTFS $objects | awk '{print $1}' | tr '\n' ' ')
+actual=$(get_object_list $TESTPOOL/$TESTFS $objects | awk '{printf("%s ", $1)}' | tr '\n' ' ')
log_must test "${actual% }" == "$expected"
# Get all objects in the meta-objset to test m (spacemap) and z (zap) flags
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zdb/zdb_objset_id.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zdb/zdb_objset_id.ksh
index accb125280f0..fdda9ba22638 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zdb/zdb_objset_id.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zdb/zdb_objset_id.ksh
@@ -67,9 +67,7 @@ obj=${array[0]}
log_note "file $init_data has object number $obj"
sync_pool $TESTPOOL
-output=$(zdb -d $TESTPOOL/$TESTFS)
-objset_id=$(echo $output | awk '{split($0,array,",")} END{print array[2]}' |
- awk '{split($0,array," ")} END{print array[2]}')
+IFS=", " read -r _ _ _ _ objset_id _ < <(zdb -d $TESTPOOL/$TESTFS)
objset_hex=$(printf "0x%X" $objset_id)
log_note "objset $TESTPOOL/$TESTFS has objset ID $objset_id ($objset_hex)"
@@ -77,54 +75,32 @@ for id in "$objset_id" "$objset_hex"
do
log_note "zdb -dddddd $TESTPOOL/$id $obj"
output=$(zdb -dddddd $TESTPOOL/$id $obj)
- reason="($TESTPOOL/$TESTFS not in zdb output)"
- echo $output |grep "$TESTPOOL/$TESTFS" > /dev/null
- (( $? != 0 )) && log_fail \
- "zdb -dddddd $TESTPOOL/$id $obj failed $reason"
- reason="(file1 not in zdb output)"
- echo $output |grep "file1" > /dev/null
- (( $? != 0 )) && log_fail \
- "zdb -dddddd $TESTPOOL/$id $obj failed $reason"
- obj=$(printf "0x%X" $obj)
+ echo $output | grep -q "$TESTPOOL/$TESTFS" ||
+ log_fail "zdb -dddddd $TESTPOOL/$id $obj failed ($TESTPOOL/$TESTFS not in zdb output)"
+ echo $output | grep -q "file1" ||
+ log_fail "zdb -dddddd $TESTPOOL/$id $obj failed (file1 not in zdb output)"
+ obj=$(printf "0x%X" $obj)
log_note "zdb -NNNNNN $TESTPOOL/$id $obj"
- output=$(zdb -NNNNNN $TESTPOOL/$id $obj)
- reason="($TESTPOOL/$TESTFS not in zdb output)"
- echo $output |grep "$TESTPOOL/$TESTFS" > /dev/null
- (( $? != 0 )) && log_fail \
- "zdb -NNNNNN $TESTPOOL/$id $obj failed $reason"
- reason="(file1 not in zdb output)"
- echo $output |grep "file1" > /dev/null
- (( $? != 0 )) && log_fail \
- "zdb -NNNNNN $TESTPOOL/$id $obj failed $reason"
+ output=$(zdb -NNNNNN $TESTPOOL/$id $obj)
+ echo $output | grep -q "$TESTPOOL/$TESTFS" ||
+ log_fail "zdb -NNNNNN $TESTPOOL/$id $obj failed ($TESTPOOL/$TESTFS not in zdb output)"
+ echo $output | grep -q "file1" ||
+ log_fail "zdb -NNNNNN $TESTPOOL/$id $obj failed (file1 not in zdb output)"
done
if is_linux; then
- output=$(ls -1 /proc/spl/kstat/zfs/$TESTPOOL |grep objset- |tail -1)
+ output=$(ls -1 /proc/spl/kstat/zfs/$TESTPOOL | grep objset- | tail -1)
objset_hex=${output#*-}
- name_from_proc=$(cat /proc/spl/kstat/zfs/$TESTPOOL/$output |
- grep dataset_name | awk '{split($0,array," ")} END{print array[3]}')
+ name_from_proc=$(grep dataset_name /proc/spl/kstat/zfs/$TESTPOOL/$output | cut -d' ' -f3)
log_note "checking zdb output for $name_from_proc"
- reason="(name $name_from_proc from proc not in zdb output)"
- log_note "zdb -dddddd $TESTPOOL/$objset_hex"
- output=$(zdb -dddddd $TESTPOOL/$objset_hex)
- echo $output |grep "$name_from_proc" > /dev/null
- (( $? != 0 )) && log_fail \
- "zdb -dddddd $TESTPOOL/$objset_hex failed $reason"
+ log_must eval "zdb -dddddd $TESTPOOL/$objset_hex | grep -q \"$name_from_proc\""
fi
log_must zfs create $hex_ds
log_must zfs create $num_ds
-output=$(zdb -d $hex_ds)
-reason="($TESTPOOL/0x400 not in zdb output)"
-echo $output |grep "$hex_ds" > /dev/null
-(( $? != 0 )) && log_fail \
- "zdb -d $hex_ds failed $reason"
-output=$(zdb -d $num_ds)
-reason="($num_ds not in zdb output)"
-echo $output |grep "$num_ds" > /dev/null
-(( $? != 0 )) && log_fail \
- "zdb -d $num_ds failed $reason"
+log_must eval "zdb -d $hex_ds | grep -q \"$hex_ds\""
+log_must eval "zdb -d $num_ds | grep -q \"$num_ds\""
# force numeric interpretation, expect fail
log_mustnot zdb -N $hex_ds
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zdb/zdb_recover_2.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zdb/zdb_recover_2.ksh
index 6470327a1765..d4529ff01105 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zdb/zdb_recover_2.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zdb/zdb_recover_2.ksh
@@ -48,7 +48,7 @@ verify_disk_count "$DISKS" 2
default_mirror_setup_noexit $DISKS
file_write -o create -w -f $init_data -b $blksize -c $write_count
-log_must echo "zfs" >> $init_data
+echo "zfs" >> $init_data
sync_pool $TESTPOOL
output=$(zdb -r $TESTPOOL/$TESTFS file1 $tmpfile)
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs/Makefile.am
deleted file mode 100644
index 8b0ee276a3b0..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs/Makefile.am
+++ /dev/null
@@ -1,7 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zfs
-dist_pkgdata_SCRIPTS = \
- setup.ksh \
- cleanup.ksh \
- zfs_001_neg.ksh \
- zfs_002_pos.ksh \
- zfs_003_neg.ksh
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs/zfs_002_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs/zfs_002_pos.ksh
index 796b38928ec7..044ccb185c48 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs/zfs_002_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs/zfs_002_pos.ksh
@@ -48,33 +48,23 @@ function cleanup
{
unset ZFS_ABORT
- if is_freebsd && [[ -n $savedcorefile ]]; then
- sysctl kern.corefile=$savedcorefile
- fi
+ log_must pop_coredump_pattern "$coresavepath"
- if [[ -d $corepath ]]; then
- rm -rf $corepath
- fi
for ds in $fs1 $fs $ctr; do
datasetexists $ds && destroy_dataset $ds -rRf
done
}
-log_assert "With ZFS_ABORT set, all zfs commands can abort and generate a " \
- "core file."
+log_assert "With ZFS_ABORT set, all zfs commands can abort and generate a core file."
log_onexit cleanup
+ctr=$TESTPOOL/$TESTCTR
+log_must zfs create -p $ctr
+
# Preparation work for testing
-savedcorefile=""
-corepath=$TESTDIR/core
+corepath=/$ctr
corefile=$corepath/core.zfs
-if [[ -d $corepath ]]; then
- rm -rf $corepath
-fi
-log_must mkdir $corepath
-
-ctr=$TESTPOOL/$TESTCTR
-log_must zfs create $ctr
+coresavepath=$corepath/save
fs=$ctr/$TESTFS
fs1=$ctr/$TESTFS1
@@ -93,24 +83,12 @@ typeset badparams=("" "create" "destroy" "snapshot" "rollback" "clone" \
"promote" "rename" "list -*" "set" "get -*" "inherit" "mount -A" \
"unmount" "share" "unshare" "send" "receive")
-if is_linux; then
- ulimit -c unlimited
- echo "$corefile" >/proc/sys/kernel/core_pattern
- echo 0 >/proc/sys/kernel/core_uses_pid
-elif is_freebsd; then
- ulimit -c unlimited
- savedcorefile=$(sysctl -n kern.corefile)
- log_must sysctl kern.corefile=$corepath/core.%N
-else
- log_must coreadm -p ${corepath}/core.%f
-fi
-
+log_must eval "push_coredump_pattern \"$corepath\" > \"$coresavepath\""
log_must export ZFS_ABORT=yes
for subcmd in "${cmds[@]}" "${badparams[@]}"; do
- log_mustnot eval "zfs $subcmd >/dev/null 2>&1"
- log_must rm $corefile
+ log_mustnot eval "zfs $subcmd"
+ log_must rm "$corefile"
done
-log_pass "With ZFS_ABORT set, zfs command can abort and generate core file " \
- "as expected."
+log_pass "With ZFS_ABORT set, zfs command can abort and generate core file as expected."
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs/zfs_003_neg.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs/zfs_003_neg.ksh
index 0438bae8f6ce..6c85e0c13ab4 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs/zfs_003_neg.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs/zfs_003_neg.ksh
@@ -45,7 +45,15 @@
verify_runnable "global"
+function cleanup
+{
+ for file in $ZFS_DEV $MNTTAB; do
+ log_must eval "[ -e ${file} ] || mv ${file}.bak $file"
+ done
+}
+
log_assert "zfs fails with unexpected scenario."
+log_onexit cleanup
#verify zfs failed if ZFS_DEV cannot be opened
ZFS_DEV=/dev/zfs
@@ -56,13 +64,11 @@ if is_linux; then
fi
for file in $ZFS_DEV $MNTTAB; do
- if [[ -e $file ]]; then
- mv $file ${file}.bak
- fi
+ log_must mv $file ${file}.bak
for cmd in "" "list" "get all" "mount"; do
log_mustnot eval "zfs $cmd >/dev/null 2>&1"
done
- mv ${file}.bak $file
+ log_must mv ${file}.bak $file
done
log_pass "zfs fails with unexpected scenario as expected."
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_bookmark/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_bookmark/Makefile.am
deleted file mode 100644
index e71fbc85ca84..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_bookmark/Makefile.am
+++ /dev/null
@@ -1,5 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zfs_bookmark
-dist_pkgdata_SCRIPTS = \
- setup.ksh \
- cleanup.ksh \
- zfs_bookmark_cliargs.ksh
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_bookmark/zfs_bookmark_cliargs.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_bookmark/zfs_bookmark_cliargs.ksh
index 3a1cddb5c64a..ec21c81aba1b 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_bookmark/zfs_bookmark_cliargs.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_bookmark/zfs_bookmark_cliargs.ksh
@@ -62,6 +62,8 @@ function cleanup
bkmarkexists "$DATASET#$TESTBMCOPY" && \
destroy_dataset "$DATASET#$TESTBMCOPY"
+
+ log_must rm -f "$TEST_BASE_DIR/zfstest_datastream.$$"
}
log_assert "'zfs bookmark' should work only when passed valid arguments."
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_change-key/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_change-key/Makefile.am
deleted file mode 100644
index 72d6e4700e17..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_change-key/Makefile.am
+++ /dev/null
@@ -1,12 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zfs_change-key
-dist_pkgdata_SCRIPTS = \
- setup.ksh \
- cleanup.ksh \
- zfs_change-key.ksh \
- zfs_change-key_child.ksh \
- zfs_change-key_clones.ksh \
- zfs_change-key_inherit.ksh \
- zfs_change-key_format.ksh \
- zfs_change-key_load.ksh \
- zfs_change-key_location.ksh \
- zfs_change-key_pbkdf2iters.ksh
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_clone/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_clone/Makefile.am
deleted file mode 100644
index 06099c0c2b79..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_clone/Makefile.am
+++ /dev/null
@@ -1,17 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zfs_clone
-dist_pkgdata_SCRIPTS = \
- setup.ksh \
- cleanup.ksh \
- zfs_clone_001_neg.ksh \
- zfs_clone_002_pos.ksh \
- zfs_clone_003_pos.ksh \
- zfs_clone_004_pos.ksh \
- zfs_clone_005_pos.ksh \
- zfs_clone_006_pos.ksh \
- zfs_clone_007_pos.ksh \
- zfs_clone_008_neg.ksh \
- zfs_clone_009_neg.ksh \
- zfs_clone_010_pos.ksh \
- zfs_clone_encrypted.ksh \
- zfs_clone_deeply_nested.ksh \
- zfs_clone_rm_nested.ksh
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_clone/zfs_clone_003_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_clone/zfs_clone_003_pos.ksh
index 6484de9c91a8..ac3bc891c86f 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_clone/zfs_clone_003_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_clone/zfs_clone_003_pos.ksh
@@ -49,6 +49,7 @@ verify_runnable "both"
function cleanup
{
snapexists $SNAPFS && destroy_dataset $SNAPFS -Rf
+ log_must rm -df "/tmp/mnt$$"
}
log_onexit cleanup
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_clone/zfs_clone_007_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_clone/zfs_clone_007_pos.ksh
index 4bfb3d5f78ab..5f42006de289 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_clone/zfs_clone_007_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_clone/zfs_clone_007_pos.ksh
@@ -40,8 +40,7 @@
# 2. Verify it succeed while upgrade, but fails while the version downgraded.
#
-ZFS_VERSION=$(zfs upgrade | head -1 | awk '{print $NF}' \
- | sed -e 's/\.//g')
+ZFS_VERSION=$(zfs upgrade | grep -wom1 '[[:digit:]]*')
verify_runnable "both"
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_clone/zfs_clone_010_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_clone/zfs_clone_010_pos.ksh
index 13f5418d4bf5..643bf1cf28e7 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_clone/zfs_clone_010_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_clone/zfs_clone_010_pos.ksh
@@ -221,7 +221,7 @@ for (( i = 1; i <= (ZFS_MAXPROPLEN / 200 + 1); i++ )); do
log_must zfs clone ${fs}@snap ${fs}/${TESTCLONE}${xs}.${i}
done
clone_list=$(zfs list -o clones $fs@snap)
-char_count=$(echo "$clone_list" | tail -1 | wc | awk '{print $3}')
+char_count=$(echo "$clone_list" | tail -1 | wc -c)
[[ $char_count -eq $ZFS_MAXPROPLEN ]] || \
log_fail "Clone list not truncated correctly. Unexpected character count" \
"$char_count"
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_copies/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_copies/Makefile.am
deleted file mode 100644
index 4ac103a8ec6a..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_copies/Makefile.am
+++ /dev/null
@@ -1,14 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zfs_copies
-dist_pkgdata_SCRIPTS = \
- setup.ksh \
- cleanup.ksh \
- zfs_copies_001_pos.ksh \
- zfs_copies_002_pos.ksh \
- zfs_copies_003_pos.ksh \
- zfs_copies_004_neg.ksh \
- zfs_copies_005_neg.ksh \
- zfs_copies_006_pos.ksh
-
-dist_pkgdata_DATA = \
- zfs_copies.cfg \
- zfs_copies.kshlib
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_copies/zfs_copies_002_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_copies/zfs_copies_002_pos.ksh
index 61d7aa28d27c..aa895956c936 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_copies/zfs_copies_002_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_copies/zfs_copies_002_pos.ksh
@@ -94,11 +94,9 @@ done
log_note "Verify df(1) can correctly display the space charged."
for val in 1 2 3; do
if is_freebsd; then
- used=`df -m /$TESTPOOL/fs_$val | grep $TESTPOOL/fs_$val \
- | awk -v fs=fs_$val '$4 ~ fs {print $3}'`
+ used=`df -m /$TESTPOOL/fs_$val | awk -v pa=$TESTPOOL/fs_$val -v fs=fs_$val '$0 ~ pa && $4 ~ fs {print $3}'`
else
- used=`df -F zfs -k /$TESTPOOL/fs_$val/$FILE | grep $TESTPOOL/fs_$val \
- | awk '{print $3}'`
+ used=`df -F zfs -k /$TESTPOOL/fs_$val/$FILE | awk -v pa=$TESTPOOL/fs_$val '$0 ~ pa {print $3}'`
(( used = used * 1024 )) # kb -> bytes
fi
check_used $used $val
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_create/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_create/Makefile.am
deleted file mode 100644
index 7515753c1bc2..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_create/Makefile.am
+++ /dev/null
@@ -1,28 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zfs_create
-dist_pkgdata_SCRIPTS = \
- setup.ksh \
- cleanup.ksh \
- zfs_create_001_pos.ksh \
- zfs_create_002_pos.ksh \
- zfs_create_003_pos.ksh \
- zfs_create_004_pos.ksh \
- zfs_create_005_pos.ksh \
- zfs_create_006_pos.ksh \
- zfs_create_007_pos.ksh \
- zfs_create_008_neg.ksh \
- zfs_create_009_neg.ksh \
- zfs_create_010_neg.ksh \
- zfs_create_011_pos.ksh \
- zfs_create_012_pos.ksh \
- zfs_create_013_pos.ksh \
- zfs_create_014_pos.ksh \
- zfs_create_encrypted.ksh \
- zfs_create_crypt_combos.ksh \
- zfs_create_dryrun.ksh \
- zfs_create_nomount.ksh \
- zfs_create_verbose.ksh
-
-dist_pkgdata_DATA = \
- properties.kshlib \
- zfs_create_common.kshlib \
- zfs_create.cfg
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_create/zfs_create_002_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_create/zfs_create_002_pos.ksh
index 0218e2e16b68..84f758904bd9 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_create/zfs_create_002_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_create/zfs_create_002_pos.ksh
@@ -65,8 +65,7 @@ while (( $j < ${#size[*]} )); do
typeset cmdline="zfs create -s -V ${size[j]} \
$TESTPOOL/${TESTVOL}${size[j]}"
- str=$(eval $cmdline 2>&1)
- if (( $? == 0 )); then
+ if str=$(eval $cmdline 2>&1); then
log_note "SUCCESS: $cmdline"
log_must datasetexists $TESTPOOL/${TESTVOL}${size[j]}
elif [[ $str == *${VOL_LIMIT_KEYWORD1}* || \
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_create/zfs_create_004_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_create/zfs_create_004_pos.ksh
index 9e69366c8793..bd01623b3627 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_create/zfs_create_004_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_create/zfs_create_004_pos.ksh
@@ -49,24 +49,23 @@ verify_runnable "both"
function cleanup
{
datasetexists $TESTPOOL/$TESTFS1 && destroy_dataset $TESTPOOL/$TESTFS1 -f
+ log_must rm -df "/tmp/mnt$$"
}
log_onexit cleanup
-log_assert "'zfs create -o property=value filesystem' can successfully create \
- a ZFS filesystem with correct property set."
+log_assert "'zfs create -o property=value filesystem' can successfully create" \
+ "a ZFS filesystem with correct property set."
typeset -i i=0
while (( $i < ${#RW_FS_PROP[*]} )); do
log_must zfs create -o ${RW_FS_PROP[$i]} $TESTPOOL/$TESTFS1
- datasetexists $TESTPOOL/$TESTFS1 || \
- log_fail "zfs create $TESTPOOL/$TESTFS1 fail."
- propertycheck $TESTPOOL/$TESTFS1 ${RW_FS_PROP[i]} || \
- log_fail "${RW_FS_PROP[i]} is failed to set."
+ log_must datasetexists $TESTPOOL/$TESTFS1
+ log_must propertycheck $TESTPOOL/$TESTFS1 ${RW_FS_PROP[i]}
log_must_busy zfs destroy -f $TESTPOOL/$TESTFS1
(( i = i + 1 ))
done
-log_pass "'zfs create -o property=value filesystem' can successfully create \
- a ZFS filesystem with correct property set."
+log_pass "'zfs create -o property=value filesystem' can successfully create" \
+ "a ZFS filesystem with correct property set."
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_create/zfs_create_005_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_create/zfs_create_005_pos.ksh
index 98cf70938e87..1321854d21cd 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_create/zfs_create_005_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_create/zfs_create_005_pos.ksh
@@ -48,15 +48,16 @@ verify_runnable "both"
function cleanup
{
- datasetexists $TESTPOOL/$TESTFS1 && \
+ datasetexists $TESTPOOL/$TESTFS1 &&
destroy_dataset $TESTPOOL/$TESTFS1 -f
+ log_must rm -df "/tmp/mnt$$"
}
log_onexit cleanup
-log_assert "'zfs create -o property=value filesystem' can successfully create \
- a ZFS filesystem with multiple properties set."
+log_assert "'zfs create -o property=value filesystem' can successfully create" \
+ "a ZFS filesystem with multiple properties set."
typeset -i i=0
typeset opts=""
@@ -69,17 +70,15 @@ while (( $i < ${#RW_FS_PROP[*]} )); do
done
log_must zfs create $opts $TESTPOOL/$TESTFS1
-datasetexists $TESTPOOL/$TESTFS1 || \
- log_fail "zfs create $TESTPOOL/$TESTFS1 fail."
+log_must datasetexists $TESTPOOL/$TESTFS1
i=0
while (( $i < ${#RW_FS_PROP[*]} )); do
if [[ ${RW_FS_PROP[$i]} != *"checksum"* ]]; then
- propertycheck $TESTPOOL/$TESTFS1 ${RW_FS_PROP[i]} || \
- log_fail "${RW_FS_PROP[i]} is failed to set."
+ log_must propertycheck $TESTPOOL/$TESTFS1 ${RW_FS_PROP[i]}
fi
(( i = i + 1 ))
done
-log_pass "'zfs create -o property=value filesystem' can successfully create \
- a ZFS filesystem with multiple properties set."
+log_pass "'zfs create -o property=value filesystem' can successfully create" \
+ "a ZFS filesystem with multiple properties set."
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_create/zfs_create_008_neg.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_create/zfs_create_008_neg.ksh
index a905e50dfaa2..d82f10f71f71 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_create/zfs_create_008_neg.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_create/zfs_create_008_neg.ksh
@@ -56,7 +56,7 @@ set -A args "ab" "-?" "-cV" "-Vc" "-c -V" "c" "V" "--c" "-e" "-s" \
"-blah" "-cV 12k" "-s -cV 1P" "-sc" "-Vs 5g" "-o" "--o" "-O" "--O" \
"-o QuOta=none" "-o quota=non" "-o quota=abcd" "-o quota=0" "-o quota=" \
"-o ResErVaTi0n=none" "-o reserV=none" "-o reservation=abcd" "-o reserv=" \
- "-o recorDSize=64k" "-o recordsize=2048K" "-o recordsize=2M" \
+ "-o recorDSize=64k" "-o recordsize=32768K" "-o recordsize=32M" \
"-o recordsize=256" "-o recsize=" "-o recsize=zero" "-o recordsize=0" \
"-o mountPoint=/tmp/tmpfile$$" "-o mountpoint=non0" "-o mountpoint=" \
"-o mountpoint=LEGACY" "-o mounpoint=none" \
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_create/zfs_create_009_neg.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_create/zfs_create_009_neg.ksh
index 63f5e595ea38..6722a659eb65 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_create/zfs_create_009_neg.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_create/zfs_create_009_neg.ksh
@@ -62,8 +62,7 @@ function cleanup
# check to see if there is any new fs created during the test
# if so destroy it.
#
- for dset in $(zfs list -H | \
- awk '{print $1}' | grep / ); do
+ for dset in $(zfs list -H | awk '$1 ~ /\/ {print $1}'); do
found=false
i=0
while (( $i < ${#existed_fs[*]} )); do
@@ -99,7 +98,7 @@ log_assert "Verify 'zfs create <filesystem>' fails with bad <filesystem> argumen
datasetexists $TESTPOOL/$TESTFS || \
log_must zfs create $TESTPOOL/$TESTFS
-set -A existed_fs $(zfs list -H | awk '{print $1}' | grep / )
+set -A existed_fs $(zfs list -H | awk '$1 ~ /\// {print $1}')
log_mustnot zfs create $TESTPOOL
log_mustnot zfs create $TESTPOOL/$TESTFS
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_create/zfs_create_010_neg.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_create/zfs_create_010_neg.ksh
index 4b1401d8649b..d4784d6530e5 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_create/zfs_create_010_neg.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_create/zfs_create_010_neg.ksh
@@ -62,8 +62,7 @@ function cleanup
# check to see if there is any new fs created during the test
# if so destroy it.
#
- for dset in $(zfs list -H | \
- awk '{print $1}' | grep / ); do
+ for dset in $(zfs list -H | awk '$1 ~ /\// {print $1}'); do
found=false
i=0
while (( $i < ${#existed_fs[*]} )); do
@@ -108,7 +107,7 @@ set -A options "" "-s"
datasetexists $TESTPOOL/$TESTVOL || \
log_must zfs create -V $VOLSIZE $TESTPOOL/$TESTVOL
-set -A existed_fs $(zfs list -H | awk '{print $1}' | grep / )
+set -A existed_fs $(zfs list -H | awk '$1 ~ /\// {print $1}')
log_mustnot zfs create -V $VOLSIZE $TESTPOOL/$TESTVOL
log_mustnot zfs create -s -V $VOLSIZE $TESTPOOL/$TESTVOL
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_create/zfs_create_012_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_create/zfs_create_012_pos.ksh
index a0b8d52f0c43..2a140d954876 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_create/zfs_create_012_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_create/zfs_create_012_pos.ksh
@@ -41,8 +41,7 @@
# 2. Verify only the leaf filesystem to be version=1, others use the current version
#
-ZFS_VERSION=$(zfs upgrade | head -1 | awk '{print $NF}' \
- | sed -e 's/\.//g')
+ZFS_VERSION=$(zfs upgrade | grep -wom1 '[[:digit:]]*')
verify_runnable "both"
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_create/zfs_create_013_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_create/zfs_create_013_pos.ksh
index 993c6436a7b1..d3855cb315c1 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_create/zfs_create_013_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_create/zfs_create_013_pos.ksh
@@ -63,8 +63,7 @@ while (( $j < ${#size[*]} )); do
typeset cmdline="zfs create -s -V ${size[j]} \
$TESTPOOL/${LONGFSNAME}${size[j]}"
- str=$(eval $cmdline 2>&1)
- if (( $? == 0 )); then
+ if str=$(eval $cmdline 2>&1); then
log_note "SUCCESS: $cmdline"
log_must datasetexists $TESTPOOL/${LONGFSNAME}${size[j]}
elif [[ $str == *${VOL_LIMIT_KEYWORD1}* || \
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_create/zfs_create_common.kshlib b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_create/zfs_create_common.kshlib
index 4c3f8b908c10..bf8e145e5112 100644
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_create/zfs_create_common.kshlib
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_create/zfs_create_common.kshlib
@@ -40,15 +40,12 @@ function propertycheck
{
typeset dtst=$1
typeset propstr=$2
+ typeset prop expect_value
- typeset prop=$(echo $propstr | awk -F= '{print $1}')
- typeset expect_value=$(echo $propstr | awk -F= '{print $2}')
- typeset value=$(zfs get -H -p -o value $prop $dtst)
+ IFS='=' read -r prop expect_value <<<"$propstr"
+ typeset value=$(get_prop $prop $dtst)
- if [[ "$expect_value" == "$value" ]]; then
- return 0
- else
- return 1
- fi
+
+ [ "$expect_value" = "$value" ]
}
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_create/zfs_create_dryrun.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_create/zfs_create_dryrun.ksh
index 703ae8043d48..1e22da0045c7 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_create/zfs_create_dryrun.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_create/zfs_create_dryrun.ksh
@@ -87,12 +87,11 @@ function dry_create_parseable
typeset found_create=false
log_note "$0: ${cmd[@]}"
- out=$("${cmd[@]}")
- (( $? == 0 )) ||
+ out=$("${cmd[@]}") ||
log_fail "unexpected failure getting stdout from '${cmd[@]}'"
datasetexists "$TESTPOOL/$TESTFS1" &&
log_fail "$TESTPOOL/$TESTFS1 unexpectedly created by '${cmd[@]}'"
- echo "$out" | while IFS=$'\t' read -A toks; do
+ while IFS=$'\t' read -A toks; do
log_note "verifying ${toks[@]}"
case ${toks[0]} in
create)
@@ -118,7 +117,7 @@ function dry_create_parseable
log_fail "Unexpected line ${toks[@]}"
;;
esac
- done
+ done <<<"$out"
log_must test "$found_create" == "yes, I found create"
log_must test "extra props: ${!exp[@]}" == "extra props: "
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_create/zfs_create_nomount.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_create/zfs_create_nomount.ksh
index e1fbbe63ad31..5b0478e855cf 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_create/zfs_create_nomount.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_create/zfs_create_nomount.ksh
@@ -30,7 +30,7 @@ verify_runnable "both"
function cleanup
{
- local ds
+ typeset ds
for ds in "$fs" "$vol"; do
datasetexists "$ds" && destroy_dataset "$ds"
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_create/zfs_create_verbose.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_create/zfs_create_verbose.ksh
index acab500062ca..b18ffa404c42 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_create/zfs_create_verbose.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_create/zfs_create_verbose.ksh
@@ -58,12 +58,11 @@ function dry_create_parseable
done
log_note "$0: ${cmd[@]}"
- out=$("${cmd[@]}")
- (( $? == 0 )) ||
+ out=$("${cmd[@]}") ||
log_fail "unexpected failure getting stdout from '${cmd[@]}'"
datasetexists "$TESTPOOL/$TESTFS1" ||
log_fail "$TESTPOOL/$TESTFS1 unexpectedly created by '${cmd[@]}'"
- echo "$out" | while IFS=$'\t' read -A toks; do
+ while IFS=$'\t' read -A toks; do
log_note "verifying ${toks[@]}"
case ${toks[0]} in
create_ancestors)
@@ -107,7 +106,7 @@ function dry_create_parseable
log_fail "Unexpected line ${toks[@]}"
;;
esac
- done
+ done <<<"$out"
log_must test "$found_create" == "yes, I found create"
log_must test "extra props: ${!exp[@]}" == "extra props: "
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_destroy/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_destroy/Makefile.am
deleted file mode 100644
index 664f3d81aea6..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_destroy/Makefile.am
+++ /dev/null
@@ -1,30 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zfs_destroy
-dist_pkgdata_SCRIPTS = \
- setup.ksh \
- cleanup.ksh \
- zfs_clone_livelist_condense_and_disable.ksh \
- zfs_clone_livelist_condense_races.ksh \
- zfs_clone_livelist_dedup.ksh \
- zfs_destroy_001_pos.ksh \
- zfs_destroy_002_pos.ksh \
- zfs_destroy_003_pos.ksh \
- zfs_destroy_004_pos.ksh \
- zfs_destroy_005_neg.ksh \
- zfs_destroy_006_neg.ksh \
- zfs_destroy_007_neg.ksh \
- zfs_destroy_008_pos.ksh \
- zfs_destroy_009_pos.ksh \
- zfs_destroy_010_pos.ksh \
- zfs_destroy_011_pos.ksh \
- zfs_destroy_012_pos.ksh \
- zfs_destroy_013_neg.ksh \
- zfs_destroy_014_pos.ksh \
- zfs_destroy_015_pos.ksh \
- zfs_destroy_016_pos.ksh \
- zfs_destroy_clone_livelist.ksh \
- zfs_destroy_dev_removal.ksh \
- zfs_destroy_dev_removal_condense.ksh
-
-dist_pkgdata_DATA = \
- zfs_destroy_common.kshlib \
- zfs_destroy.cfg
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_destroy/zfs_destroy_004_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_destroy/zfs_destroy_004_pos.ksh
index 9a2ff6bea36d..d618f21e9eb5 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_destroy/zfs_destroy_004_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_destroy/zfs_destroy_004_pos.ksh
@@ -98,8 +98,7 @@ log_must zfs set mountpoint=$mntp1 $fs1
log_must zfs set mountpoint=$mntp2 $clone
for arg in "$fs1 $mntp1" "$clone $mntp2"; do
- fs=`echo $arg | awk '{print $1}'`
- mntp=`echo $arg | awk '{print $2}'`
+ read -r fs mntp <<<"$arg"
log_note "Verify that 'zfs destroy' fails to" \
"destroy filesystem when it is busy."
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_diff/.gitignore b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_diff/.gitignore
deleted file mode 100644
index 7fa74c3575bd..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_diff/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/socket
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_diff/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_diff/Makefile.am
deleted file mode 100644
index bfb01dcb8f86..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_diff/Makefile.am
+++ /dev/null
@@ -1,18 +0,0 @@
-include $(top_srcdir)/config/Rules.am
-
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zfs_diff
-
-dist_pkgdata_SCRIPTS = \
- cleanup.ksh \
- setup.ksh \
- zfs_diff_changes.ksh \
- zfs_diff_cliargs.ksh \
- zfs_diff_encrypted.ksh \
- zfs_diff_mangle.ksh \
- zfs_diff_timestamp.ksh \
- zfs_diff_types.ksh
-
-pkgexecdir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zfs_diff
-
-pkgexec_PROGRAMS = socket
-socket_SOURCES = socket.c
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_diff/socket.c b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_diff/socket.c
deleted file mode 100644
index be4bf31dde9f..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_diff/socket.c
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * This file and its contents are supplied under the terms of the
- * Common Development and Distribution License ("CDDL"), version 1.0.
- * You may only use this file in accordance with the terms of version
- * 1.0 of the CDDL.
- *
- * A full copy of the text of the CDDL should have accompanied this
- * source. A copy of the CDDL is also available via the Internet at
- * http://www.illumos.org/license/CDDL.
- */
-
-/*
- * Copyright 2017, loli10K <ezomori.nozomu@gmail.com>. All rights reserved.
- */
-
-#include <fcntl.h>
-#include <sys/un.h>
-#include <sys/socket.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <unistd.h>
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-int
-main(int argc, char *argv[])
-{
- struct sockaddr_un sock;
- int fd;
- char *path;
- size_t size;
- if (argc != 2) {
- fprintf(stderr, "usage: %s /path/to/socket\n", argv[0]);
- exit(1);
- }
- path = argv[1];
- size = sizeof (sock.sun_path);
- strncpy(sock.sun_path, (char *)path, size - 1);
- sock.sun_path[size - 1] = '\0';
-
- sock.sun_family = AF_UNIX;
- if ((fd = socket(AF_UNIX, SOCK_DGRAM, 0)) == -1) {
- perror("socket");
- return (1);
- }
- if (bind(fd, (struct sockaddr *)&sock, sizeof (struct sockaddr_un))) {
- perror("bind");
- return (1);
- }
- if (close(fd)) {
- perror("close");
- return (1);
- }
- return (0);
-}
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_diff/zfs_diff_changes.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_diff/zfs_diff_changes.ksh
index 51a1b4aa1199..ca8df6dab910 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_diff/zfs_diff_changes.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_diff/zfs_diff_changes.ksh
@@ -47,7 +47,7 @@ function verify_object_change # <path> <change>
change="$2"
log_must eval "zfs diff -F $TESTSNAP1 $TESTSNAP2 > $FILEDIFF"
- diffchg="$(awk -v path="$path" '$NF == path { print $1 }' < $FILEDIFF)"
+ diffchg="$(awk -v path="$path" '$NF == path { print $1 }' $FILEDIFF)"
if [[ "$diffchg" != "$change" ]]; then
log_fail "Unexpected change for $path ('$diffchg' != '$change')"
else
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_diff/zfs_diff_timestamp.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_diff/zfs_diff_timestamp.ksh
index 0d08cf629572..81ee87f8aee9 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_diff/zfs_diff_timestamp.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_diff/zfs_diff_timestamp.ksh
@@ -73,10 +73,8 @@ log_must zfs snapshot "$TESTSNAP2"
# 3. Verify 'zfs diff -t' correctly display timestamps
typeset -i count=0
log_must eval "zfs diff -t $TESTSNAP1 $TESTSNAP2 > $FILEDIFF"
-awk '{print substr($1,1,index($1,".")-1)" "$NF}' < "$FILEDIFF" | while read line
+awk '{print substr($1,1,index($1,".")-1) " " $NF}' "$FILEDIFF" | while read -r ctime file
do
- read ctime file <<< "$line"
-
# If path from 'zfs diff' is not a file (could be xattr object) skip it
if [[ ! -f "$file" ]]; then
continue;
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_diff/zfs_diff_types.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_diff/zfs_diff_types.ksh
index 8e521b9f5a1e..414fde336c78 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_diff/zfs_diff_types.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_diff/zfs_diff_types.ksh
@@ -52,7 +52,7 @@ function verify_object_class # <path> <symbol>
symbol="$2"
log_must eval "zfs diff -F $TESTSNAP1 $TESTSNAP2 > $FILEDIFF"
- diffsym="$(awk -v path="$path" '$NF == path { print $2 }' < $FILEDIFF)"
+ diffsym="$(awk -v path="$path" '$NF == path { print $2 }' $FILEDIFF)"
if [[ "$diffsym" != "$symbol" ]]; then
log_fail "Unexpected type for $path ('$diffsym' != '$symbol')"
else
@@ -111,11 +111,7 @@ verify_object_class "$MNTPOINT/cdev" "C"
# 2. | (Named pipe)
log_must zfs snapshot "$TESTSNAP1"
-if is_freebsd; then
- log_must mkfifo "$MNTPOINT/fifo"
-else
- log_must mknod "$MNTPOINT/fifo" p
-fi
+log_must mkfifo "$MNTPOINT/fifo"
log_must zfs snapshot "$TESTSNAP2"
verify_object_class "$MNTPOINT/fifo" "|"
@@ -127,7 +123,7 @@ verify_object_class "$MNTPOINT/dir" "/"
# 2. = (Socket)
log_must zfs snapshot "$TESTSNAP1"
-log_must $STF_SUITE/tests/functional/cli_root/zfs_diff/socket "$MNTPOINT/sock"
+log_must zfs_diff-socket "$MNTPOINT/sock"
log_must zfs snapshot "$TESTSNAP2"
verify_object_class "$MNTPOINT/sock" "="
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_get/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_get/Makefile.am
deleted file mode 100644
index 22e95907675d..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_get/Makefile.am
+++ /dev/null
@@ -1,18 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zfs_get
-dist_pkgdata_SCRIPTS = \
- setup.ksh \
- cleanup.ksh \
- zfs_get_001_pos.ksh \
- zfs_get_002_pos.ksh \
- zfs_get_003_pos.ksh \
- zfs_get_004_pos.ksh \
- zfs_get_005_neg.ksh \
- zfs_get_006_neg.ksh \
- zfs_get_007_neg.ksh \
- zfs_get_008_pos.ksh \
- zfs_get_009_pos.ksh \
- zfs_get_010_neg.ksh
-
-dist_pkgdata_DATA = \
- zfs_get_common.kshlib \
- zfs_get_list_d.kshlib
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_get/zfs_get_001_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_get/zfs_get_001_pos.ksh
index 807954a60692..b3286c31e6fa 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_get/zfs_get_001_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_get/zfs_get_001_pos.ksh
@@ -102,16 +102,15 @@ function check_return_value
found=0
while read line; do
- typeset item
- typeset value
+ typeset item value _
- item=$(echo $line | awk '{print $2}' 2>&1)
+ read -r _ item _ <<<"$line"
if [[ $item == $p ]]; then
((found += 1))
cols=$(echo $line | awk '{print NF}')
fi
- value=$(echo $line | awk '{print $3}' 2>&1)
+ read -r _ _ value _ <<<"$line"
if [[ $value == $uint64_max ]]; then
log_fail "'zfs get $opt $props $dst' return " \
"UINT64_MAX constant."
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_get/zfs_get_002_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_get/zfs_get_002_pos.ksh
index 88822adfc761..6717787d06e6 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_get/zfs_get_002_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_get/zfs_get_002_pos.ksh
@@ -85,7 +85,7 @@ for dst in ${dataset[@]}; do
for opt in "" $(gen_option_str "${options[*]}" "-" "" $opt_numb); do
for prop in $(gen_option_str "${props[*]}" "" "," $prop_numb)
do
- log_must eval "zfs get $opt $prop $dst > /dev/null"
+ log_must eval "zfs get $opt $prop $dst > /dev/null 2>&1"
done
done
done
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_get/zfs_get_003_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_get/zfs_get_003_pos.ksh
index 2ea5aa0cb4cf..e96899118a89 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_get/zfs_get_003_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_get/zfs_get_003_pos.ksh
@@ -55,9 +55,8 @@ log_onexit cleanup
log_must zfs set atime=on $TESTPOOL/$TESTFS
log_must zfs mount -o remount,noatime $TESTPOOL/$TESTFS
-value1=$(zfs get -H atime $TESTPOOL/$TESTFS | awk '{print $3}')
-value2=$(zfs get -H all $TESTPOOL/$TESTFS | awk '{print $2 " " $3}' | \
- grep ^atime | awk '{print $2}')
+read -r _ _ value1 _ < <(zfs get -H atime $TESTPOOL/$TESTFS)
+read -r _ value2 < <(zfs get -H all $TESTPOOL/$TESTFS | cut -f2,3 | grep ^atime)
if [[ $value1 != $value2 ]]; then
log_fail "value1($value1) != value2($value2)"
fi
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_get/zfs_get_004_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_get/zfs_get_004_pos.ksh
index 3bc4c6240ed3..20597c9a5feb 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_get/zfs_get_004_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_get/zfs_get_004_pos.ksh
@@ -163,15 +163,12 @@ while (( i < ${#opts[*]} )); do
log_must eval "zfs get ${opts[i]} all >$propfile"
for ds in $allds; do
- grep $ds $propfile >/dev/null 2>&1
- (( $? != 0 )) && \
+ grep -q $ds $propfile || \
log_fail "There is no property for" \
"dataset $ds in 'get all' output."
- propnum=`cat $propfile | awk '{print $1}' | \
- grep "${ds}$" | wc -l`
- ds_type=`zfs get -H -o value type $ds`
- case $ds_type in
+ propnum=$(awk -v ds="${ds}$" '$1 ~ ds {++cnt} END {print cnt}' $propfile)
+ case $(zfs get -H -o value type $ds) in
filesystem )
(( propnum < fspropnum )) && \
(( failflag += 1 ))
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_get/zfs_get_005_neg.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_get/zfs_get_005_neg.ksh
index c527cef087af..13685ef6f4bc 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_get/zfs_get_005_neg.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_get/zfs_get_005_neg.ksh
@@ -93,7 +93,7 @@ function test_options
for dst in ${dataset[@]}; do
for opt in $opts; do
for prop in $props; do
- log_mustnot eval "zfs get $opt -- $prop $dst > /dev/null"
+ log_mustnot eval "zfs get $opt -- $prop $dst > /dev/null 2>&1"
done
done
done
@@ -113,7 +113,7 @@ function test_options_bookmarks
for dst in ${bookmark[@]}; do
for opt in $opts; do
for prop in $props; do
- log_mustnot eval "zfs get $opt -- $prop $dst > /dev/null"
+ log_mustnot eval "zfs get $opt -- $prop $dst > /dev/null 2>&1"
done
done
done
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_get/zfs_get_008_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_get/zfs_get_008_pos.ksh
index 296fe99968c8..9f3dd47cde7d 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_get/zfs_get_008_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_get/zfs_get_008_pos.ksh
@@ -53,7 +53,7 @@ set -A options " " "-r" "-H" "-p" "-rHp" "-o name" \
set -A props type used available creation volsize referenced compressratio \
mounted origin recordsize quota reservation mountpoint sharenfs \
checksum compression atime devices exec readonly setuid snapdir \
- aclinherit canmount primarycache secondarycache \
+ aclinherit canmount primarycache secondarycache version \
usedbychildren usedbydataset usedbyrefreservation usedbysnapshots \
userquota@root groupquota@root userused@root groupused@root
if is_freebsd; then
@@ -62,11 +62,6 @@ else
set -A props ${props[*]} zoned acltype
fi
-zfs upgrade -v > /dev/null 2>&1
-if [[ $? -eq 0 ]]; then
- set -A props ${props[*]} version
-fi
-
set -A dataset $TESTPOOL/$TESTCTR $TESTPOOL/$TESTFS $TESTPOOL/$TESTVOL \
$TESTPOOL/$TESTFS@$TESTSNAP $TESTPOOL/$TESTVOL@$TESTSNAP
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_get/zfs_get_009_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_get/zfs_get_009_pos.ksh
index 7fd6918b43db..1e80d4d2b7ef 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_get/zfs_get_009_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_get/zfs_get_009_pos.ksh
@@ -39,7 +39,7 @@
# STRATEGY:
# 1. Create a multiple depth filesystem.
# 2. 'zfs get -d <n>' to get the output.
-# 3. 'zfs get -r|egrep' to get the expected output.
+# 3. 'zfs get -r|grep' to get the expected output.
# 4. Compare the two outputs, they should be same.
#
@@ -55,7 +55,7 @@ log_onexit depth_fs_cleanup
set -A all_props type used available creation volsize referenced \
compressratio mounted origin recordsize quota reservation mountpoint \
sharenfs checksum compression atime devices exec readonly setuid \
- snapdir aclinherit canmount primarycache secondarycache \
+ snapdir aclinherit canmount primarycache secondarycache version \
usedbychildren usedbydataset usedbyrefreservation usedbysnapshots \
userquota@root groupquota@root userused@root groupused@root
if is_freebsd; then
@@ -64,11 +64,6 @@ else
set -A all_props ${all_props[*]} zoned acltype
fi
-zfs upgrade -v > /dev/null 2>&1
-if [[ $? -eq 0 ]]; then
- set -A all_props ${all_props[*]} version
-fi
-
depth_fs_setup
mntpnt=$(get_prop mountpoint $DEPTH_FS)
@@ -86,7 +81,7 @@ for dp in ${depth_array[@]}; do
done
for prop in $(gen_option_str "${all_props[*]}" "" "," $prop_numb); do
log_must eval "zfs get -H -d $dp -o name $prop $DEPTH_FS > $DEPTH_OUTPUT"
- log_must eval "zfs get -rH -o name $prop $DEPTH_FS | egrep -e '$eg_opt' > $EXPECT_OUTPUT"
+ log_must eval "zfs get -rH -o name $prop $DEPTH_FS | grep -E '$eg_opt' > $EXPECT_OUTPUT"
log_must diff $DEPTH_OUTPUT $EXPECT_OUTPUT
done
(( old_val=dp ))
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_ids_to_path/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_ids_to_path/Makefile.am
deleted file mode 100644
index 5f5e3858787e..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_ids_to_path/Makefile.am
+++ /dev/null
@@ -1,5 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zfs_ids_to_path
-dist_pkgdata_SCRIPTS = \
- setup.ksh \
- cleanup.ksh \
- zfs_ids_to_path_001_pos.ksh
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_inherit/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_inherit/Makefile.am
deleted file mode 100644
index 95a51ec757ea..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_inherit/Makefile.am
+++ /dev/null
@@ -1,8 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zfs_inherit
-dist_pkgdata_SCRIPTS = \
- cleanup.ksh \
- setup.ksh \
- zfs_inherit_001_neg.ksh \
- zfs_inherit_002_neg.ksh \
- zfs_inherit_003_pos.ksh \
- zfs_inherit_mountpoint.ksh
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_inherit/zfs_inherit_001_neg.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_inherit/zfs_inherit_001_neg.ksh
index 62f255ca38b7..aba317f54237 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_inherit/zfs_inherit_001_neg.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_inherit/zfs_inherit_001_neg.ksh
@@ -47,14 +47,7 @@ verify_runnable "both"
# Define uninherited properties and their short name.
typeset props_str="type used available avail creation referenced refer \
compressratio ratio mounted origin quota reservation \
- reserv volsize volblocksize volblock"
-
-zfs upgrade -v > /dev/null 2>&1
-if [[ $? -eq 0 ]]; then
- props_str="$props_str version"
-fi
-
-set -A prop $props_str canmount
+ reserv volsize volblocksize volblock version canmount"
log_assert "'zfs inherit' should return an error when attempting to inherit" \
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_jail/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_jail/Makefile.am
deleted file mode 100644
index b6dd7721e63e..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_jail/Makefile.am
+++ /dev/null
@@ -1,6 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zfs_jail
-dist_pkgdata_SCRIPTS = \
- setup.ksh \
- cleanup.ksh \
- jail.conf \
- zfs_jail_001_pos.ksh
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_load-key/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_load-key/Makefile.am
deleted file mode 100644
index 7dfec435ce7f..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_load-key/Makefile.am
+++ /dev/null
@@ -1,18 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zfs_load-key
-dist_pkgdata_SCRIPTS = \
- setup.ksh \
- cleanup.ksh \
- zfs_load-key.ksh \
- zfs_load-key_all.ksh \
- zfs_load-key_file.ksh \
- zfs_load-key_https.ksh \
- zfs_load-key_location.ksh \
- zfs_load-key_noop.ksh \
- zfs_load-key_recursive.ksh
-
-dist_pkgdata_DATA = \
- zfs_load-key.cfg \
- zfs_load-key_common.kshlib \
- PASSPHRASE \
- HEXKEY \
- RAWKEY
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_load-key/zfs_load-key.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_load-key/zfs_load-key.ksh
index 8af9f80cfbd7..11a97a83e25e 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_load-key/zfs_load-key.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_load-key/zfs_load-key.ksh
@@ -70,7 +70,8 @@ log_must key_available $TESTPOOL/$TESTFS1
log_mustnot eval "echo $PASSPHRASE | zfs load-key $TESTPOOL/$TESTFS1"
-typeset DISK2="$(echo $DISKS | awk '{ print $2 }')"
+typeset DISK2 _
+read -r _ DISK2 _ <<<"$DISKS"
log_must eval "echo $PASSPHRASE | zpool create -O encryption=on" \
"-O keyformat=passphrase -O keylocation=prompt $TESTPOOL1 $DISK2"
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_load-key/zfs_load-key_all.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_load-key/zfs_load-key_all.ksh
index 3c18e4538d34..515753722d20 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_load-key/zfs_load-key_all.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_load-key/zfs_load-key_all.ksh
@@ -56,7 +56,8 @@ log_must zfs create -o encryption=on -o keyformat=passphrase \
log_must zfs create -V 64M -o encryption=on -o keyformat=passphrase \
-o keylocation=file:///$TESTPOOL/pkey $TESTPOOL/zvol
-typeset DISK2="$(echo $DISKS | awk '{ print $2}')"
+typeset DISK2 _
+read -r _ DISK2 _ <<<"$DISKS"
log_must zpool create -O encryption=on -O keyformat=passphrase \
-O keylocation=file:///$TESTPOOL/pkey $TESTPOOL1 $DISK2
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_load-key/zfs_load-key_common.kshlib b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_load-key/zfs_load-key_common.kshlib
index f7461437c615..4a85999b4ab8 100644
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_load-key/zfs_load-key_common.kshlib
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_load-key/zfs_load-key_common.kshlib
@@ -42,8 +42,7 @@ function key_available
function key_unavailable
{
- key_available $1 && return 1
- return 0
+ ! key_available $1
}
function verify_keyformat
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_mount/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_mount/Makefile.am
deleted file mode 100644
index 8c90b2e75e5a..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_mount/Makefile.am
+++ /dev/null
@@ -1,29 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zfs_mount
-dist_pkgdata_SCRIPTS = \
- setup.ksh \
- cleanup.ksh \
- zfs_mount_001_pos.ksh \
- zfs_mount_002_pos.ksh \
- zfs_mount_003_pos.ksh \
- zfs_mount_004_pos.ksh \
- zfs_mount_005_pos.ksh \
- zfs_mount_006_pos.ksh \
- zfs_mount_007_pos.ksh \
- zfs_mount_008_pos.ksh \
- zfs_mount_009_neg.ksh \
- zfs_mount_010_neg.ksh \
- zfs_mount_011_neg.ksh \
- zfs_mount_012_pos.ksh \
- zfs_mount_013_pos.ksh \
- zfs_mount_014_neg.ksh \
- zfs_mount_all_001_pos.ksh \
- zfs_mount_all_fail.ksh \
- zfs_mount_all_mountpoints.ksh \
- zfs_mount_encrypted.ksh \
- zfs_mount_remount.ksh \
- zfs_mount_test_race.ksh \
- zfs_multi_mount.ksh
-
-dist_pkgdata_DATA = \
- zfs_mount.cfg \
- zfs_mount.kshlib
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_mount/zfs_mount.kshlib b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_mount/zfs_mount.kshlib
index 85566e565319..23cab2511a41 100644
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_mount/zfs_mount.kshlib
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_mount/zfs_mount.kshlib
@@ -35,10 +35,7 @@ function force_unmount #dev
{
typeset dev=$1
- ismounted $dev
- if (( $? == 0 )); then
- log_must zfs $unmountforce $dev
- fi
+ ismounted $dev && log_must zfs $unmountforce $dev
return 0
}
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_mount/zfs_mount_005_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_mount/zfs_mount_005_pos.ksh
index c0cb693f6ce6..b42b2496e4b9 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_mount/zfs_mount_005_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_mount/zfs_mount_005_pos.ksh
@@ -77,14 +77,13 @@ cd $TESTDIR || \
zfs $mountcmd $TESTPOOL/$TESTFS
ret=$?
if is_linux || is_freebsd; then
- (( ret == 0 )) || \
- log_fail "'zfs $mountcmd $TESTPOOL/$TESTFS' " \
- "unexpected return code of $ret."
+ expected=0
else
- (( ret == 1 )) || \
- log_fail "'zfs $mountcmd $TESTPOOL/$TESTFS' " \
- "unexpected return code of $ret."
+ expected=1
fi
+(( ret == expected )) || \
+ log_fail "'zfs $mountcmd $TESTPOOL/$TESTFS' " \
+ "unexpected return code of $ret."
log_note "Make sure the filesystem $TESTPOOL/$TESTFS is unmounted"
if is_linux || is_freebsd; then
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_mount/zfs_mount_007_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_mount/zfs_mount_007_pos.ksh
index 409dd06d7f88..a11f53d79ba0 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_mount/zfs_mount_007_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_mount/zfs_mount_007_pos.ksh
@@ -112,7 +112,7 @@ function get_reverse_option
typeset val
typeset -i ind=0
- val=$(get_prop $prop $fs) || log_fail "get_prop $prop $fs"
+ val=$(get_prop $prop $fs)
if [[ $val == "on" ]]; then
(( ind = i * 2 ))
else
@@ -127,7 +127,6 @@ cleanup
for property in ${properties[@]}; do
orig_val=$(get_prop $property $fs)
- (($? != 0)) && log_fail "get_prop $property $fs"
# Set filesystem property temporarily
reverse_opt=$(get_reverse_option $fs $property)
@@ -135,7 +134,6 @@ for property in ${properties[@]}; do
log_must zfs mount -o $reverse_opt $fs
cur_val=$(get_prop $property $fs)
- (($? != 0)) && log_fail "get_prop $property $fs"
# In LZ, a user with all zone privileges can never with "devices"
if ! is_global_zone && [[ $property == devices ]] ; then
@@ -153,7 +151,6 @@ for property in ${properties[@]}; do
log_must zfs mount $fs
cur_val=$(get_prop $property $fs)
- (($? != 0)) && log_fail "get_prop $property $fs"
if [[ $orig_val != $cur_val ]]; then
log_fail "zfs mount -o $reverse_opt " \
"change the property that is stored on disks"
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_mount/zfs_multi_mount.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_mount/zfs_multi_mount.ksh
index bd86eaa16bb4..c4b4f0773137 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_mount/zfs_multi_mount.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_mount/zfs_multi_mount.ksh
@@ -56,7 +56,7 @@ log_must zfs create $TESTDS
MNTPFS="$(get_prop mountpoint $TESTDS)"
FILENAME="$MNTPFS/file"
log_must mkfile 128k $FILENAME
-log_must exec 9<> $FILENAME # open file
+log_must eval "exec 9<> $FILENAME" # open file
# 3. Lazy umount
if is_freebsd; then
@@ -74,7 +74,7 @@ log_must zfs mount $TESTDS
if [ ! -f $FILENAME ]; then
log_fail "Lazy remount failed"
fi
-log_must exec 9>&- # close fd
+log_must eval "exec 9>&-" # close fd
# 5. Verify multiple mounts of the same dataset are possible
MNTPFS2="$MNTPFS-second"
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_program/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_program/Makefile.am
deleted file mode 100644
index d797a636b347..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_program/Makefile.am
+++ /dev/null
@@ -1,5 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zfs_program
-dist_pkgdata_SCRIPTS = \
- setup.ksh \
- cleanup.ksh \
- zfs_program_json.ksh
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_promote/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_promote/Makefile.am
deleted file mode 100644
index 8a8c56a093d2..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_promote/Makefile.am
+++ /dev/null
@@ -1,16 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zfs_promote
-dist_pkgdata_SCRIPTS = \
- setup.ksh \
- cleanup.ksh \
- zfs_promote_001_pos.ksh \
- zfs_promote_002_pos.ksh \
- zfs_promote_003_pos.ksh \
- zfs_promote_004_pos.ksh \
- zfs_promote_005_pos.ksh \
- zfs_promote_006_neg.ksh \
- zfs_promote_007_neg.ksh \
- zfs_promote_008_pos.ksh \
- zfs_promote_encryptionroot.ksh
-
-dist_pkgdata_DATA = \
- zfs_promote.cfg
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_property/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_property/Makefile.am
deleted file mode 100644
index d8a5687b1ea2..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_property/Makefile.am
+++ /dev/null
@@ -1,5 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zfs_property
-dist_pkgdata_SCRIPTS = \
- setup.ksh \
- cleanup.ksh \
- zfs_written_property_001_pos.ksh
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_property/zfs_written_property_001_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_property/zfs_written_property_001_pos.ksh
index f31ff48099e9..f53a4ac71b68 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_property/zfs_written_property_001_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_property/zfs_written_property_001_pos.ksh
@@ -217,12 +217,11 @@ for ds in $datasets; do
sync_pool
done
recursive_output=$(zfs get -p -r written@current $TESTPOOL | \
- grep -v $TESTFS1@ | grep -v $TESTFS2@ | grep -v $TESTFS3@ | \
- grep -v "VALUE" | grep -v "-")
+ grep -ve $TESTFS1@ -e $TESTFS2@ -e $TESTFS3@ -e "VALUE" | grep -v "-")
expected="$((20 * mb_block))"
for ds in $datasets; do
writtenat=$(echo "$recursive_output" | grep -v $ds/)
- writtenat=$(echo "$writtenat" | grep $ds | awk '{print $3}')
+ writtenat=$(echo "$writtenat" | awk -v ds="$ds" '$0 ~ ds {print $3}')
within_percent $writtenat $expected 99.5 || \
log_fail "Unexpected written@ value on $ds"
done
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_receive/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_receive/Makefile.am
deleted file mode 100644
index cf9490de4e81..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_receive/Makefile.am
+++ /dev/null
@@ -1,34 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zfs_receive
-dist_pkgdata_SCRIPTS = \
- setup.ksh \
- cleanup.ksh \
- zfs_receive_001_pos.ksh \
- zfs_receive_002_pos.ksh \
- zfs_receive_003_pos.ksh \
- zfs_receive_004_neg.ksh \
- zfs_receive_005_neg.ksh \
- zfs_receive_006_pos.ksh \
- zfs_receive_007_neg.ksh \
- zfs_receive_008_pos.ksh \
- zfs_receive_009_neg.ksh \
- zfs_receive_010_pos.ksh \
- zfs_receive_011_pos.ksh \
- zfs_receive_012_pos.ksh \
- zfs_receive_013_pos.ksh \
- zfs_receive_014_pos.ksh \
- zfs_receive_015_pos.ksh \
- zfs_receive_016_pos.ksh \
- receive-o-x_props_override.ksh \
- receive-o-x_props_aliases.ksh \
- zfs_receive_from_encrypted.ksh \
- zfs_receive_from_zstd.ksh \
- zfs_receive_new_props.ksh \
- zfs_receive_to_encrypted.ksh \
- zfs_receive_raw.ksh \
- zfs_receive_raw_incremental.ksh \
- zfs_receive_raw_-d.ksh \
- zfs_receive_-e.ksh \
- zfs_receive_-wR-encrypted-mix.ksh
-
-dist_pkgdata_DATA = \
- zstd_test_data.txt
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_receive/zfs_receive_001_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_receive/zfs_receive_001_pos.ksh
index 8a6cd8c409be..2b4a086965e8 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_receive/zfs_receive_001_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_receive/zfs_receive_001_pos.ksh
@@ -105,10 +105,7 @@ for orig_fs in $datasets ; do
typeset -i i=0
while (( i < ${#orig_snap[*]} )); do
- file_write -o create -f ${orig_data[$i]} -b 512 \
- -c 8 >/dev/null 2>&1
- (( $? != 0 )) && \
- log_fail "Writing data into zfs filesystem fails."
+ log_must eval "file_write -o create -f ${orig_data[$i]} -b 512 -c 8 >/dev/null 2>&1"
log_must zfs snapshot ${orig_snap[$i]}
if (( i < 1 )); then
log_must eval "zfs send ${orig_snap[$i]} > ${bkup[$i]}"
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_receive/zfs_receive_003_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_receive/zfs_receive_003_pos.ksh
index cce387615315..48cebc87f039 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_receive/zfs_receive_003_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_receive/zfs_receive_003_pos.ksh
@@ -62,7 +62,7 @@ log_onexit cleanup
ibackup=$TEST_BASE_DIR/ibackup.$$
fs=$TESTPOOL/$TESTFS; snap1=$fs@snap1; snap2=$fs@snap2
-mntpnt=$(get_prop mountpoint $fs) || log_fail "get_prop mountpoint $fs"
+mntpnt=$(get_prop mountpoint $fs)
log_must mkfile 10m $mntpnt/file1
log_must zfs snapshot $snap1
log_must mkfile 10m $mntpnt/file2
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_receive/zfs_receive_005_neg.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_receive/zfs_receive_005_neg.ksh
index d8c71f2c2877..6a708a45e177 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_receive/zfs_receive_005_neg.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_receive/zfs_receive_005_neg.ksh
@@ -80,8 +80,8 @@ log_must zfs snapshot $init_snap
log_must eval "zfs send $init_snap > $full_bkup"
log_note "'zfs receive' fails with invalid send streams."
-log_mustnot eval "cat </dev/zero | zfs receive $rst_init_snap"
-log_mustnot eval "cat </dev/zero | zfs receive -d $rst_root"
+log_mustnot eval "cat /dev/zero | zfs receive $rst_init_snap"
+log_mustnot eval "cat /dev/zero | zfs receive -d $rst_root"
log_must eval "zfs receive $rst_init_snap < $full_bkup"
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_receive/zfs_receive_006_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_receive/zfs_receive_006_pos.ksh
index 79f34bd3ff8c..06a0804515a7 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_receive/zfs_receive_006_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_receive/zfs_receive_006_pos.ksh
@@ -82,7 +82,7 @@ datasetexists $ancestor_fs || \
log_must zfs create $ancestor_fs
log_must zfs create $fs
-mntpnt=$(get_prop mountpoint $fs) || log_fail "get_prop mountpoint $fs"
+mntpnt=$(get_prop mountpoint $fs)
log_must mkfile 10m $mntpnt/file1
log_must zfs snapshot $snap1
log_must mkfile 10m $mntpnt/file2
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_receive/zfs_receive_007_neg.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_receive/zfs_receive_007_neg.ksh
index fbf0654e4f23..ec2437db929f 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_receive/zfs_receive_007_neg.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_receive/zfs_receive_007_neg.ksh
@@ -64,7 +64,7 @@ ibackup=$TEST_BASE_DIR/ibackup.$$
datasetexists $fs || log_must zfs create $fs
-mntpnt=$(get_prop mountpoint $fs) || log_fail "get_prop mountpoint $fs"
+mntpnt=$(get_prop mountpoint $fs)
log_must mkfile 10m $mntpnt/file1
log_must zfs snapshot $snap1
log_must mkfile 10m $mntpnt/file2
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_receive/zfs_receive_008_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_receive/zfs_receive_008_pos.ksh
index dc4892b5d50e..f948dfd6690b 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_receive/zfs_receive_008_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_receive/zfs_receive_008_pos.ksh
@@ -86,9 +86,6 @@ for orig_fs in $datasets ; do
typeset mntpnt
mntpnt=$(get_prop mountpoint $orig_fs)
- if [[ $? -ne 0 ]] ; then
- log_fail "get_prop mountpoint $orig_fs failed"
- fi
typeset mnt_file=$mntpnt/file1
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_receive/zfs_receive_009_neg.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_receive/zfs_receive_009_neg.ksh
index 37fe515e23f7..6cda13690cbd 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_receive/zfs_receive_009_neg.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_receive/zfs_receive_009_neg.ksh
@@ -92,11 +92,10 @@ typeset -i i=0
while (( i < ${#validopts[*]} )); do
log_mustnot eval "zfs recv < $bkup"
- echo ${validopts[i]} | grep "d" >/dev/null 2>&1
- if (( $? != 0 )); then
- log_mustnot eval "zfs recv ${validopts[i]} $fs2 $fs3 < $bkup"
- else
+ if echo ${validopts[i]} | grep -q "d"; then
log_mustnot eval "zfs recv ${validopts[i]} $ctr1 $ctr2 < $bkup"
+ else
+ log_mustnot eval "zfs recv ${validopts[i]} $fs2 $fs3 < $bkup"
fi
(( i += 1 ))
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_receive/zfs_receive_010_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_receive/zfs_receive_010_pos.ksh
index 47e23e6ebca7..c91172ee048e 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_receive/zfs_receive_010_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_receive/zfs_receive_010_pos.ksh
@@ -134,8 +134,7 @@ dd if=/dev/urandom of=$mntpnt/f18 bs=128k count=64
touch $mntpnt2/f18
# Remove objects that are intended to be missing.
-rm $mntpnt/h17
-rm $mntpnt2/h*
+rm $mntpnt/h17 $mntpnt2/h*
# Add empty objects to $fs to exercise dmu_traverse code
for i in {1..100}; do
@@ -145,15 +144,15 @@ done
log_must zfs snapshot $fs@s1
log_must zfs snapshot $fs2@s1
-log_must zfs send $fs@s1 > $TESTDIR/zr010p
-log_must zfs send $fs2@s1 > $TESTDIR/zr010p2
+log_must eval "zfs send $fs@s1 > $TESTDIR/zr010p"
+log_must eval "zfs send $fs2@s1 > $TESTDIR/zr010p2"
#
# Test that, when we receive a full send as a clone of itself,
# nop-write saves us all the space used by data blocks.
#
-cat $TESTDIR/zr010p | log_must zfs receive -o origin=$fs@s1 $rfs
+log_must eval "zfs receive -o origin=$fs@s1 $rfs < $TESTDIR/zr010p"
size=$(get_prop used $rfs)
size2=$(get_prop used $fs)
if [[ $size -ge $(($size2 / 10)) ]] then
@@ -163,13 +162,13 @@ fi
log_must zfs destroy -fr $rfs
# Correctness testing: receive each full send as a clone of the other fiesystem.
-cat $TESTDIR/zr010p | log_must zfs receive -o origin=$fs2@s1 $rfs
+log_must eval "zfs receive -o origin=$fs2@s1 $rfs < $TESTDIR/zr010p"
mntpnt_old=$(get_prop mountpoint $fs)
mntpnt_new=$(get_prop mountpoint $rfs)
log_must directory_diff $mntpnt_old $mntpnt_new
log_must zfs destroy -r $rfs
-cat $TESTDIR/zr010p2 | log_must zfs receive -o origin=$fs@s1 $rfs
+log_must eval "zfs receive -o origin=$fs@s1 $rfs < $TESTDIR/zr010p2"
mntpnt_old=$(get_prop mountpoint $fs2)
mntpnt_new=$(get_prop mountpoint $rfs)
log_must directory_diff $mntpnt_old $mntpnt_new
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_receive/zfs_receive_013_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_receive/zfs_receive_013_pos.ksh
index e1e93e9d2a3b..87bb63b36e52 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_receive/zfs_receive_013_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_receive/zfs_receive_013_pos.ksh
@@ -52,7 +52,7 @@ log_onexit cleanup
truncate -s 100M $tpoolfile
log_must zpool create $temppool $tpoolfile
log_must zfs create $src_fs
-src_mnt=$(get_prop mountpoint $src_fs) || log_fail "get_prop mountpoint $src_fs"
+src_mnt=$(get_prop mountpoint $src_fs)
echo blah > $src_mnt/blah
zfs snapshot $src_fs@base
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_receive/zfs_receive_from_zstd.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_receive/zfs_receive_from_zstd.ksh
index 72eebb4f9321..05c2ece4654f 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_receive/zfs_receive_from_zstd.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_receive/zfs_receive_from_zstd.ksh
@@ -58,27 +58,22 @@ log_note "Randomly selected ZSTD level: $random_level"
log_must zfs create -o compress=zstd-$random_level $TESTPOOL/$TESTFS1
# Make a 5kb compressible file
-log_must cat $src_data $src_data $src_data $src_data $src_data \
- > /$TESTPOOL/$TESTFS1/$TESTFILE0
+log_must eval cat $src_data $src_data $src_data $src_data $src_data \
+ "> /$TESTPOOL/$TESTFS1/$TESTFILE0"
typeset checksum=$(md5digest /$TESTPOOL/$TESTFS1/$TESTFILE0)
log_must zfs snapshot $snap
# get object number of file
-listing=$(ls -i /$TESTPOOL/$TESTFS1/$TESTFILE0)
-set -A array $listing
-obj=${array[0]}
+read -r obj _ < <(ls -i /$TESTPOOL/$TESTFS1/$TESTFILE0)
log_note "file /$TESTPOOL/$TESTFS1/$TESTFILE0 has object number $obj"
output=$(zdb -Zddddddbbbbbb $TESTPOOL/$TESTFS1 $obj 2> /dev/null \
- |grep -m 1 "L0 DVA" |head -n1)
+ | grep -m 1 "L0 DVA")
dva=$(sed -Ene 's/^.+DVA\[0\]=<([^>]+)>.*$/\1/p' <<< "$output")
log_note "block 0 of /$TESTPOOL/$TESTFS1/$TESTFILE0 has a DVA of $dva"
-zstd_str=$(sed -Ene 's/^.+ ZSTD:size=([^:]+):version=([^:]+):level=([^:]+):.*$/\1:\2:\3/p' <<< "$output")
-zstd_size1=$(echo "$zstd_str" |awk '{split($0,array,":")} END{print array[1]}')
-zstd_version1=$(echo "$zstd_str" |awk '{split($0,array,":")} END{print array[2]}')
-zstd_level1=$(echo "$zstd_str" |awk '{split($0,array,":")} END{print array[3]}')
+read -r zstd_size1 zstd_version1 zstd_level1 < <(sed -Ene 's/^.+ ZSTD:size=([^:]+):version=([^:]+):level=([^:]+):.*$/\1 \2 \3/p' <<< "$output")
log_note "ZSTD src: size=$zstd_size1 version=$zstd_version1 level=$zstd_level1"
log_note "Verify ZFS can receive the ZSTD compressed stream"
@@ -89,23 +84,18 @@ typeset cksum1=$(md5digest /$TESTPOOL/$TESTFS2/$TESTFILE0)
log_fail "Checksums differ ($cksum1 != $checksum)"
# get object number of file
-listing=$(ls -i /$TESTPOOL/$TESTFS2/$TESTFILE0)
-set -A array $listing
-obj=${array[0]}
+read -r obj _ < <(ls -i /$TESTPOOL/$TESTFS2/$TESTFILE0)
log_note "file /$TESTPOOL/$TESTFS2/$TESTFILE0 has object number $obj"
output=$(zdb -Zddddddbbbbbb $TESTPOOL/$TESTFS2 $obj 2> /dev/null \
- |grep -m 1 "L0 DVA" |head -n1)
+ | grep -m 1 "L0 DVA")
dva=$(sed -Ene 's/^.+DVA\[0\]=<([^>]+)>.*$/\1/p' <<< "$output")
log_note "block 0 of /$TESTPOOL/$TESTFS2/$TESTFILE0 has a DVA of $dva"
-zstd_str=$(sed -Ene 's/^.+ ZSTD:size=([^:]+):version=([^:]+):level=([^:]+):.*$/\1:\2:\3/p' <<< "$output")
-zstd_size2=$(echo "$zstd_str" |awk '{split($0,array,":")} END{print array[1]}')
+read -r zstd_size2 zstd_version2 zstd_level2 < <(sed -Ene 's/^.+ ZSTD:size=([^:]+):version=([^:]+):level=([^:]+):.*$/\1 \2 \3/p' <<< "$output")
+log_note "ZSTD dest: size=$zstd_size2 version=$zstd_version2 level=$zstd_level2"
(( $zstd_size2 != $zstd_size1 )) && log_fail \
"ZFS recv failed: compressed size differs ($zstd_size2 != $zstd_size1)"
-zstd_version2=$(echo "$zstd_str" |awk '{split($0,array,":")} END{print array[2]}')
-zstd_level2=$(echo "$zstd_str" |awk '{split($0,array,":")} END{print array[3]}')
-log_note "ZSTD dest: size=$zstd_size2 version=$zstd_version2 level=$zstd_level2"
(( $zstd_level2 != $zstd_level1 )) && log_fail \
"ZFS recv failed: compression level did not match header level ($zstd_level2 != $zstd_level1)"
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_receive/zfs_receive_new_props.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_receive/zfs_receive_new_props.ksh
index 54f13355f5e8..ae63f5c6ac1d 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_receive/zfs_receive_new_props.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_receive/zfs_receive_new_props.ksh
@@ -70,8 +70,8 @@ log_must zpool set feature@filesystem_limits=enabled "$rpoolname"
log_must zfs create -o filesystem_limit=100 "$sendfs"
log_must zfs snapshot "$sendfs@a"
-log_must zfs send -R "$sendfs@a" >"$streamfile"
-log_must eval "zfs recv -svuF $recvfs <$streamfile"
+log_must eval "zfs send -R \"$sendfs@a\" >\"$streamfile\""
+log_must eval "zfs recv -svuF \"$recvfs\" <\"$streamfile\""
log_pass "ZFS can handle receiving streams with filesystem limits on \
pools where the feature was recently enabled"
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_rename/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_rename/Makefile.am
deleted file mode 100644
index f8273d72c569..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_rename/Makefile.am
+++ /dev/null
@@ -1,26 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zfs_rename
-dist_pkgdata_SCRIPTS = \
- setup.ksh \
- cleanup.ksh \
- zfs_rename_001_pos.ksh \
- zfs_rename_002_pos.ksh \
- zfs_rename_003_pos.ksh \
- zfs_rename_004_neg.ksh \
- zfs_rename_005_neg.ksh \
- zfs_rename_006_pos.ksh \
- zfs_rename_007_pos.ksh \
- zfs_rename_008_pos.ksh \
- zfs_rename_009_neg.ksh \
- zfs_rename_010_neg.ksh \
- zfs_rename_011_pos.ksh \
- zfs_rename_012_neg.ksh \
- zfs_rename_013_pos.ksh \
- zfs_rename_014_neg.ksh \
- zfs_rename_encrypted_child.ksh \
- zfs_rename_to_encrypted.ksh \
- zfs_rename_mountpoint.ksh \
- zfs_rename_nounmount.ksh
-
-dist_pkgdata_DATA = \
- zfs_rename.cfg \
- zfs_rename.kshlib
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_rename/cleanup.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_rename/cleanup.ksh
index 4638b63d72ea..0a5b6c36111b 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_rename/cleanup.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_rename/cleanup.ksh
@@ -33,11 +33,7 @@
default_cleanup_noexit
-if [[ -d $TESTDIR2 ]]; then
- rm -rf $TESTDIR2
- if (( $? != 0 )); then
- log_unresolved Could not remove $TESTDIR2
- fi
-fi
+rm -rf $TESTDIR2 ||
+ log_unresolved Could not remove $TESTDIR2
log_pass
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_rename/setup.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_rename/setup.ksh
index 788e093fb2ca..03701d4f5522 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_rename/setup.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_rename/setup.ksh
@@ -36,12 +36,9 @@ DISK=${DISKS%% *}
default_setup_noexit "$DISK" "true" "true"
-if [[ -d $TESTDIR2 ]]; then
- rm -rf $TESTDIR2
- if (( $? != 0 )); then
- log_unresolved Could not remove $TESTDIR2
- fi
-fi
+rm -rf $TESTDIR2 ||
+ log_unresolved Could not remove $TESTDIR2
+
log_must zfs set compression=off $TESTPOOL/$TESTFS
log_must zfs create -o compression=off $TESTPOOL/$DATAFS
log_must zfs set mountpoint=$TESTDIR2 $TESTPOOL/$DATAFS
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_rename/zfs_rename.kshlib b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_rename/zfs_rename.kshlib
index af1c2f7bedaf..cafffbd85266 100644
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_rename/zfs_rename.kshlib
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_rename/zfs_rename.kshlib
@@ -92,8 +92,7 @@ function cleanup
fi
if [[ ${dataset[i]}-new != *@* ]] ; then
- zfs rename ${dataset[i]}-new ${dataset[i]}
- if [[ $? -ne 0 ]]; then
+ if ! zfs rename ${dataset[i]}-new ${dataset[i]}; then
typeset newfs=${dataset[i]}-new
typeset oldfs=${dataset[i]}
typeset mntp=$(get_prop mountpoint $newfs)
@@ -120,8 +119,6 @@ function cmp_data #<$1 src data, $2 tgt data>
typeset src=$1
typeset tgt=$2
- cmp $src $tgt >/dev/null 2>&1
-
- return $?
+ cmp $src $tgt >/dev/null
}
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_rename/zfs_rename_014_neg.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_rename/zfs_rename_014_neg.ksh
index 1c962608d784..57bae24277e1 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_rename/zfs_rename_014_neg.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_rename/zfs_rename_014_neg.ksh
@@ -81,7 +81,7 @@ function nesting_cleanup
# before resetting it, it will be left at the modified
# value for the remaining tests. That's the reason
# we reset it again here just in case.
- log_must set_tunable_impl MAX_DATASET_NESTING 50 Z zcommon
+ log_must set_tunable64 MAX_DATASET_NESTING 50 Z
}
log_onexit nesting_cleanup
@@ -93,13 +93,13 @@ log_must zfs create -p $TESTPOOL/$dsC16
log_mustnot zfs rename $TESTPOOL/$dsA02 $TESTPOOL/$dsB15A
# extend limit
-log_must set_tunable_impl MAX_DATASET_NESTING 64 Z zcommon
+log_must set_tunable64 MAX_DATASET_NESTING 64 Z
log_mustnot zfs rename $TESTPOOL/$dsA02 $TESTPOOL/$dsB16A
log_must zfs rename $TESTPOOL/$dsA02 $TESTPOOL/$dsB15A
# bring back old limit
-log_must set_tunable_impl MAX_DATASET_NESTING 50 Z zcommon
+log_must set_tunable64 MAX_DATASET_NESTING 50 Z
log_mustnot zfs rename $TESTPOOL/$dsC01 $TESTPOOL/$dsB15A47C
log_must zfs rename $TESTPOOL/$dsB15A47A $TESTPOOL/$dsB15A47B
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_rename/zfs_rename_nounmount.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_rename/zfs_rename_nounmount.ksh
index 1c707762a72c..96826d814f18 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_rename/zfs_rename_nounmount.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_rename/zfs_rename_nounmount.ksh
@@ -39,7 +39,7 @@ function rename_cleanup
zfs destroy -fR $TESTPOOL/renamed
}
-back=$(pwd)
+back=$PWD
log_onexit rename_cleanup
log_must zfs create $TESTPOOL/rename_test
@@ -72,14 +72,15 @@ log_must zfs list $TESTPOOL/renamed
log_must zfs list $TESTPOOL/renamed/child
log_must zfs list $TESTPOOL/renamed/child/grandchild
-missing=$(zfs mount | awk -v pat=$TESTPOOL/renamed '$1 ~ pat' | awk \
+missing=$(zfs mount | awk \
+ -v genpat=$TESTPOOL/renamed \
-v mntp_p=$mntp_p \
-v mntp_c=$mntp_c \
-v mntp_g=$mntp_g '
BEGIN { p = c = g = 0 }
- $2 == mntp_p { p = 1 }
- $2 == mntp_c { c = 1 }
- $2 == mntp_g { g = 1 }
+ $1 ~ genpat && $2 == mntp_p { p = 1 }
+ $1 ~ genpat && $2 == mntp_c { c = 1 }
+ $1 ~ genpat && $2 == mntp_g { g = 1 }
END {
if (p != 1)
print mntp_p
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_reservation/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_reservation/Makefile.am
deleted file mode 100644
index 5b7b758a056a..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_reservation/Makefile.am
+++ /dev/null
@@ -1,6 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zfs_reservation
-dist_pkgdata_SCRIPTS = \
- setup.ksh \
- cleanup.ksh \
- zfs_reservation_001_pos.ksh \
- zfs_reservation_002_pos.ksh
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_reservation/zfs_reservation_002_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_reservation/zfs_reservation_002_pos.ksh
index c482f9c3c7df..7f90630360ff 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_reservation/zfs_reservation_002_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_reservation/zfs_reservation_002_pos.ksh
@@ -73,16 +73,8 @@ log_must zfs set reservation=none $TESTPOOL/$RESERVATION2
for FS in $TESTPOOL/$RESERVATION $TESTPOOL/$RESERVATION2
do
-
- reserve=`zfs get -pH reservation $FS | awk '{print $3}'`
- if [[ $reserve -ne 0 ]]; then
- log_fail "ZFS get -p reservation did not return 0"
- fi
-
- reserve=`zfs get -H reservation $FS | awk '{print $3}'`
- if [[ $reserve != "none" ]]; then
- log_fail "ZFS get reservation did not return 'none'"
- fi
+ log_must [ $(zfs get -pHo value reservation $FS) -eq 0 ]
+ log_must [ $(zfs get -Ho value reservation $FS) = none ]
done
log_pass "Successfully set reservation to 0 and 'none'"
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_rollback/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_rollback/Makefile.am
deleted file mode 100644
index 4d278f724527..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_rollback/Makefile.am
+++ /dev/null
@@ -1,12 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zfs_rollback
-dist_pkgdata_SCRIPTS = \
- setup.ksh \
- cleanup.ksh \
- zfs_rollback_001_pos.ksh \
- zfs_rollback_002_pos.ksh \
- zfs_rollback_003_neg.ksh \
- zfs_rollback_004_neg.ksh
-
-dist_pkgdata_DATA = \
- zfs_rollback.cfg \
- zfs_rollback_common.kshlib
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_rollback/zfs_rollback_common.kshlib b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_rollback/zfs_rollback_common.kshlib
index 2eadb68c372d..cc1b24697d21 100644
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_rollback/zfs_rollback_common.kshlib
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_rollback/zfs_rollback_common.kshlib
@@ -36,9 +36,9 @@
# $1 full file name
function getsum #fname
{
- (( ${#1} == 0 )) && \
- log_fail "Need give file name."
- return $(sum $1 | awk '{print $1}')
+ typeset sum
+ read -r sum _ < <(cksum "$1")
+ echo $sum
}
# Define global variable checksum, get the original file sum.
@@ -270,11 +270,7 @@ function check_files
typeset sum0=$(getsum $file0)
typeset sum1=$(getsum $file1)
typeset sum2=$(getsum $file2)
- if [[ $sum0 != $origsum || \
- $sum1 != $origsum || sum2 != $origsum ]]
- then
- log_fail "After rollback, file sum is changed."
- fi
+ log_must [ $sum0 = $origsum \&\& $sum1 = $origsum \&\& sum2 = $origsum ]
;;
$TESTSNAP1)
log_must files_exist $file0 $file1
@@ -282,19 +278,14 @@ function check_files
typeset sum0=$(getsum $file0)
typeset sum1=$(getsum $file1)
- if [[ $sum0 != $origsum || $sum1 != $origsum ]]
- then
- log_fail "After rollback, file sum is changed."
- fi
+ log_must [ $sum0 = $origsum \&\& $sum1 = $origsum ]
;;
$TESTSNAP)
log_must files_exist $file0
log_must files_nonexist $file1 $file2
typeset sum0=$(getsum $file0)
- if [[ $sum0 != $origsum ]]; then
- log_fail "After rollback, file sum is changed."
- fi
+ log_must [ $sum0 = $origsum ]
;;
esac
}
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_send/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_send/Makefile.am
deleted file mode 100644
index 25c7065670f2..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_send/Makefile.am
+++ /dev/null
@@ -1,20 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zfs_send
-dist_pkgdata_SCRIPTS = \
- setup.ksh \
- cleanup.ksh \
- zfs_send_001_pos.ksh \
- zfs_send_002_pos.ksh \
- zfs_send_003_pos.ksh \
- zfs_send_004_neg.ksh \
- zfs_send_005_pos.ksh \
- zfs_send_006_pos.ksh \
- zfs_send_007_pos.ksh \
- zfs_send_encrypted.ksh \
- zfs_send_encrypted_unloaded.ksh \
- zfs_send_raw.ksh \
- zfs_send_sparse.ksh \
- zfs_send-b.ksh \
- zfs_send_skip_missing.ksh
-
-dist_pkgdata_DATA = \
- zfs_send.cfg
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_send/zfs_send_001_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_send/zfs_send_001_pos.ksh
index b18433085ed5..2c7bac851608 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_send/zfs_send_001_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_send/zfs_send_001_pos.ksh
@@ -96,9 +96,7 @@ log_must zfs set mountpoint=$TESTDIR1 $rst_root
file_write -o create -f $init_data -b $BLOCK_SIZE -c $WRITE_COUNT
log_must zfs snapshot $init_snap
-zfs send $init_snap > $full_bkup
-(( $? != 0 )) && \
- log_fail "'zfs send' fails to create full send"
+log_must eval "zfs send $init_snap > $full_bkup"
log_note "Verify the send stream is valid to receive."
@@ -111,9 +109,7 @@ log_note "Verify 'zfs send -i' can create incremental send stream."
file_write -o create -f $inc_data -b $BLOCK_SIZE -c $WRITE_COUNT -d 0
log_must zfs snapshot $inc_snap
-zfs send -i $init_snap $inc_snap > $inc_bkup
-(( $? != 0 )) && \
- log_fail "'zfs send -i' fails to create incremental send"
+log_must eval "zfs send -i $init_snap $inc_snap > $inc_bkup"
log_note "Verify the incremental send stream is valid to receive."
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_send/zfs_send_002_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_send/zfs_send_002_pos.ksh
index 42bdddd2cc18..c55ce08d006e 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_send/zfs_send_002_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_send/zfs_send_002_pos.ksh
@@ -66,12 +66,8 @@ function do_testing # <prop> <prop_value>
log_must zfs set $property=$prop_val $fs
file_write -o create -f $origfile -b $BLOCK_SIZE -c $WRITE_COUNT
log_must zfs snapshot $snap
- zfs send $snap > $stream
- (( $? != 0 )) && \
- log_fail "'zfs send' fails to create send streams."
- zfs receive -d $ctr <$stream
- (( $? != 0 )) && \
- log_fail "'zfs receive' fails to receive send streams."
+ log_must eval "zfs send $snap > $stream"
+ log_must eval "zfs receive -d $ctr <$stream"
#verify receive result
! datasetexists $rstfs && \
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_send/zfs_send_006_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_send/zfs_send_006_pos.ksh
index 42628a0512e9..c5dfb89394f4 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_send/zfs_send_006_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_send/zfs_send_006_pos.ksh
@@ -76,10 +76,10 @@ function verify_size_estimates
typeset file_size=$2
typeset refer_diff=$(echo "$refer_size - $estimate_size" | bc)
refer_diff=$(echo "$refer_diff / 1" | bc)
- refer_diff=$(echo "$refer_diff" | nawk '{print ($1 < 0) ? ($1 * -1): $1'})
+ refer_diff=$(echo "$refer_diff" | awk '{print ($1 < 0) ? ($1 * -1): $1'})
typeset file_diff=$(echo "$file_size - $estimate_size" | bc)
file_diff=$(echo "$file_diff / 1" | bc)
- file_diff=$(echo "$file_diff" | nawk '{print ($1 < 0) ? ($1 * -1):$1'})
+ file_diff=$(echo "$file_diff" | awk '{print ($1 < 0) ? ($1 * -1):$1'})
typeset expected_diff=$(cal_percentage $refer_size)
[[ -z $refer_diff && -z $file_diff && -z $expected_diff ]] && \
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_send/zfs_send_007_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_send/zfs_send_007_pos.ksh
index 306fabc8cef4..15760398127c 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_send/zfs_send_007_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_send/zfs_send_007_pos.ksh
@@ -52,12 +52,12 @@ streamfile=$(mktemp $TESTDIR/file.XXXXXX)
vdev=$(mktemp $TEST_BASE_DIR/file.XXXXXX)
-test_pool ()
+function test_pool
{
POOL=$1
log_must zfs create -o recordsize=512 $POOL/fs
mntpnt=$(get_prop mountpoint "$POOL/fs")
- log_must dd if=/dev/urandom of=${mntpnt}/file bs=512 count=1 2>/dev/null
+ log_must eval "dd if=/dev/urandom of=${mntpnt}/file bs=512 count=1 2>/dev/null"
object=$(ls -i $mntpnt | awk '{print $1}')
log_must zfs snapshot $POOL/fs@a
while true; do
@@ -67,10 +67,7 @@ test_pool ()
sync_all_pools
# check if we started reusing objects
object=$(ls -i $mntpnt | sort -n | awk -v object=$object \
- '{if ($1 <= object) {exit 1}} END {print $1}')
- if [[ $? -ne 0 ]]; then
- break
- fi
+ '{if ($1 <= object) {exit 1}} END {print $1}') || break
done
dd if=/dev/urandom of=${mntpnt}/$FILE bs=512 count=1 seek=1 2>/dev/null
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_set/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_set/Makefile.am
deleted file mode 100644
index f7362ff2556f..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_set/Makefile.am
+++ /dev/null
@@ -1,35 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zfs_set
-dist_pkgdata_SCRIPTS = \
- setup.ksh \
- cleanup.ksh \
- cache_001_pos.ksh \
- cache_002_neg.ksh \
- canmount_001_pos.ksh \
- canmount_002_pos.ksh \
- canmount_003_pos.ksh \
- canmount_004_pos.ksh \
- checksum_001_pos.ksh \
- compression_001_pos.ksh \
- mountpoint_001_pos.ksh \
- mountpoint_002_pos.ksh \
- mountpoint_003_pos.ksh \
- onoffs_001_pos.ksh \
- property_alias_001_pos.ksh \
- readonly_001_pos.ksh \
- reservation_001_neg.ksh \
- ro_props_001_pos.ksh \
- share_mount_001_neg.ksh \
- snapdir_001_pos.ksh \
- user_property_001_pos.ksh \
- user_property_002_pos.ksh \
- user_property_003_neg.ksh \
- user_property_004_pos.ksh \
- version_001_neg.ksh \
- zfs_set_001_neg.ksh \
- zfs_set_002_neg.ksh \
- zfs_set_003_neg.ksh \
- zfs_set_keylocation.ksh \
- zfs_set_feature_activation.ksh
-
-dist_pkgdata_DATA = \
- zfs_set_common.kshlib
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_set/canmount_001_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_set/canmount_001_pos.ksh
index ac5fc8188f5a..fe8aa2fd1e07 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_set/canmount_001_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_set/canmount_001_pos.ksh
@@ -81,14 +81,8 @@ function cleanup
log_assert "Setting a valid property of canmount to file system, it must be successful."
log_onexit cleanup
-typeset old_fs_canmount="" old_ctr_canmount=""
-
-old_fs_canmount=$(get_prop canmount $TESTPOOL/$TESTFS)
-[[ $? != 0 ]] && \
- log_fail "Get the $TESTPOOL/$TESTFS canmount error."
-old_ctr_canmount=$(get_prop canmount $TESTPOOL/$TESTCTR)
-[[ $? != 0 ]] && \
- log_fail "Get the $TESTPOOL/$TESTCTR canmount error."
+typeset old_fs_canmount=$(get_prop canmount $TESTPOOL/$TESTFS)
+typeset old_ctr_canmount=$(get_prop canmount $TESTPOOL/$TESTCTR)
log_must zfs snapshot $TESTPOOL/$TESTFS@$TESTSNAP
log_must zfs snapshot $TESTPOOL/$TESTVOL@$TESTSNAP
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_set/canmount_002_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_set/canmount_002_pos.ksh
index 55c71f6ca33a..bb7cd4cccc39 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_set/canmount_002_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_set/canmount_002_pos.ksh
@@ -77,9 +77,7 @@ function cleanup
if datasetexists $ds; then
mntp=$(get_prop mountpoint $ds)
destroy_dataset $ds
- if [[ -d $mntp ]]; then
- rm -fr $mntp
- fi
+ [ -d $mntp ] && rm -fr $mntp
fi
snapexists $TESTPOOL/$TESTFS@$TESTSNAP && \
@@ -91,9 +89,7 @@ function cleanup
zfs unmount -a > /dev/null 2>&1
log_must zfs mount -a
- if [[ -d $tmpmnt ]]; then
- rm -fr $tmpmnt
- fi
+ [ -d $tmpmnt ] && rm -fr $tmpmnt
}
log_assert "Setting canmount=noauto to file system, it must be successful."
@@ -125,7 +121,7 @@ while (( i < ${#dataset_pos[*]} )) ; do
set_n_check_prop "noauto" "canmount" "$dataset"
log_must zfs set mountpoint=$tmpmnt $dataset
log_must zfs set sharenfs=on $dataset
- if ismounted $dataset; then
+ if ismounted $dataset; then
zfs unmount -a > /dev/null 2>&1
log_must mounted $dataset
log_must zfs unmount $dataset
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_set/canmount_003_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_set/canmount_003_pos.ksh
index e4664d03b43c..b370118a7f76 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_set/canmount_003_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_set/canmount_003_pos.ksh
@@ -97,9 +97,9 @@ while (( i < ${#dataset_pos[*]} )); do
done
i=0
-while (( i < ${#dataset_pos[*]} )) ; do
+while (( i < ${#dataset_pos[*]} )); do
dataset=${dataset_pos[i]}
- if ismounted $dataset; then
+ if ismounted $dataset; then
log_must cd ${old_mnt[i]}
set_n_check_prop "noauto" "canmount" "$dataset"
log_must mounted $dataset
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_set/mountpoint_001_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_set/mountpoint_001_pos.ksh
index 1255ae5f5666..30efef1c383f 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_set/mountpoint_001_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_set/mountpoint_001_pos.ksh
@@ -69,11 +69,7 @@ log_assert "Setting a valid mountpoint to file system, it must be successful."
log_onexit cleanup
old_fs_mpt=$(get_prop mountpoint $TESTPOOL/$TESTFS)
-[[ $? != 0 ]] && \
- log_fail "Get the $TESTPOOL/$TESTFS mountpoint error."
old_ctr_mpt=$(get_prop mountpoint $TESTPOOL/$TESTCTR)
-[[ $? != 0 ]] && \
- log_fail "Get the $TESTPOOL/$TESTCTR mountpoint error."
if [[ ! -d $TESTDIR2 ]]; then
log_must mkdir $TESTDIR2
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_set/mountpoint_002_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_set/mountpoint_002_pos.ksh
index 48580cafdb31..603e84dcd07f 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_set/mountpoint_002_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_set/mountpoint_002_pos.ksh
@@ -66,11 +66,7 @@ log_assert "Setting a valid mountpoint for an unmounted file system, \
log_onexit cleanup
old_fs_mpt=$(get_prop mountpoint $TESTPOOL/$TESTFS)
-[[ $? != 0 ]] && \
- log_fail "Unable to get the mountpoint property for $TESTPOOL/$TESTFS"
old_ctr_mpt=$(get_prop mountpoint $TESTPOOL/$TESTCTR)
-[[ $? != 0 ]] && \
- log_fail "Unable to get the mountpoint property for $TESTPOOL/$TESTCTR"
if [[ ! -d $TESTDIR2 ]]; then
log_must mkdir $TESTDIR2
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_set/mountpoint_003_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_set/mountpoint_003_pos.ksh
index 4d86100c03ef..38bbda0d1fae 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_set/mountpoint_003_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_set/mountpoint_003_pos.ksh
@@ -109,10 +109,8 @@ while ((i < ${#args[@]})); do
msg=$(mount | grep "$tmpmnt ")
- echo $msg | grep "${args[((i))]}" > /dev/null 2>&1
- if (($? != 0)) ; then
- echo $msg | grep "${args[((i-1))]}" > /dev/null 2>&1
- if (($? == 0)) ; then
+ if ! echo $msg | grep -q "${args[((i))]}"; then
+ if echo $msg | grep -q "${args[((i-1))]}"; then
log_fail "Expected option: ${args[((i))]} \n" \
"Real option: $msg"
fi
@@ -130,8 +128,7 @@ while ((i < ${#args[@]})); do
args[((i+1))]="/nodevices/"
fi
- echo $msg | grep "${args[((i+1))]}" > /dev/null 2>&1
- if (($? != 0)) ; then
+ if ! echo $msg | grep -q "${args[((i+1))]}"; then
log_fail "Expected option: ${args[((i+1))]} \n" \
"Real option: $msg"
fi
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_set/property_alias_001_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_set/property_alias_001_pos.ksh
index f1befe60c373..0ddafe178e3a 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_set/property_alias_001_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_set/property_alias_001_pos.ksh
@@ -91,9 +91,7 @@ typeset -i i=0
for ds in $pool $fs $vol; do
for propname in ${ro_prop[*]}; do
- zfs get -pH -o value $propname $ds >/dev/null 2>&1
- (( $? != 0 )) && \
- log_fail "Get the property $proname of $ds failed."
+ log_must eval "zfs get -pH -o value $propname $ds >/dev/null 2>&1"
done
i=0
while (( i < ${#rw_prop[*]} )); do
@@ -120,9 +118,7 @@ for ds in $pool $fs $vol; do
done
if [[ $ds == $vol ]]; then
for propname in "volblocksize" "volblock" ; do
- zfs get -pH -o value $propname $ds >/dev/null 2>&1
- (( $? != 0 )) && \
- log_fail "Get the property $propname of $ds failed."
+ log_must eval "zfs get -pH -o value $propname $ds >/dev/null 2>&1"
done
fi
done
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_set/reservation_001_neg.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_set/reservation_001_neg.ksh
index de6d83d2270c..b929047cf129 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_set/reservation_001_neg.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_set/reservation_001_neg.ksh
@@ -70,15 +70,7 @@ function set_n_check # data-set
j=0
while (( $j < ${#suffix[*]} )); do
- zfs set \
- reservation=${values[$i]}${suffix[$j]} $obj \
- > /dev/null 2>&1
- if [ $? -eq 0 ]
- then
- log_note "zfs set \
- reservation=${values[$i]}${suffix[$j]} $obj"
- log_fail "The above reservation set returned 0!"
- fi
+ log_mustnot zfs set reservation=${values[$i]}${suffix[$j]} $obj
new_resv_val=$(get_prop reservation $obj)
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_set/ro_props_001_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_set/ro_props_001_pos.ksh
index 7177fac202d0..e24376a2bf74 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_set/ro_props_001_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_set/ro_props_001_pos.ksh
@@ -55,18 +55,13 @@ typeset ro_props="type used creation referenced refer compressratio \
mounted origin"
typeset snap_ro_props="volsize recordsize recsize quota reservation reserv mountpoint \
sharenfs checksum compression compress atime devices exec readonly rdonly \
- setuid"
+ setuid version"
if is_freebsd; then
snap_ro_props+=" jailed"
else
snap_ro_props+=" zoned"
fi
-zfs upgrade -v > /dev/null 2>&1
-if [[ $? -eq 0 ]]; then
- snap_ro_props="$snap_ro_props version"
-fi
-
function cleanup
{
datasetexists $TESTPOOL/$TESTVOL@$TESTSNAP && \
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_set/snapdir_001_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_set/snapdir_001_pos.ksh
index 083a6b1f464f..29a709397422 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_set/snapdir_001_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_set/snapdir_001_pos.ksh
@@ -57,22 +57,12 @@ function verify_snapdir_visible # $1 dataset, $2 hidden|visible
typeset dataset=$1
typeset value=$2
typeset mtpt=$(get_prop mountpoint $dataset)
- typeset name
-
- for name in `ls -a $mtpt`; do
- if [[ $name == ".zfs" ]]; then
- if [[ $value == "visible" ]]; then
- return 0
- else
- return 1
- fi
- fi
- done
- if [[ $value == "visible" ]]; then
- return 1
+ # $mtpt/.zfs always actually exists so [ -d $mtpt/.zfs ] is always true
+ if ls -a $mtpt | grep -xFq .zfs; then
+ [ $value = "visible" ]
else
- return 0
+ [ $value != "visible" ]
fi
}
@@ -95,15 +85,14 @@ log_assert "Setting a valid snapdir property on a dataset succeeds."
for dataset in $all_datasets; do
for value in hidden visible; do
- if [[ $dataset == "$TESTPOOL/$TESTVOL" ]] ; then
+ if [ "$dataset" = "$TESTPOOL/$TESTVOL" ]; then
set_n_check_prop "$value" "snapdir" \
"$dataset" "false"
else
set_n_check_prop "$value" "snapdir" \
"$dataset"
- verify_snapdir_visible $dataset $value
- [[ $? -eq 0 ]] || \
- log_fail "$dataset/.zfs is not $value as expect."
+ verify_snapdir_visible $dataset $value ||
+ log_fail "$dataset/.zfs is not $value as expected."
fi
done
done
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_set/user_property_004_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_set/user_property_004_pos.ksh
index bd11ea088333..8ab52679eb9a 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_set/user_property_004_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_set/user_property_004_pos.ksh
@@ -68,32 +68,19 @@ function nonexist_user_prop
log_assert "User property has no effect to snapshot until 'Snapshot properties' supported."
log_onexit cleanup
-typeset snap_property=
-
-zpool upgrade -v | grep "Snapshot properties" > /dev/null 2>&1
-if (( $? == 0 )) ; then
- snap_property="true"
-fi
-
for fs in $TESTPOOL/$TESTFS $TESTPOOL/$TESTVOL $TESTPOOL ; do
typeset fssnap=$fs@snap
prop_name=$(valid_user_property 10)
value=$(user_property_value 16)
- log_must eval "zfs set $prop_name='$value' $fs"
- log_must eval "check_user_prop $fs $prop_name '$value'"
+ log_must zfs set $prop_name="$value" $fs
+ log_must check_user_prop $fs $prop_name "$value"
log_must zfs snapshot $fssnap
- if [[ -n $snap_property ]] ; then
- log_mustnot nonexist_user_prop $prop_name $fssnap
+ log_mustnot nonexist_user_prop $prop_name $fssnap
- log_must eval "zfs set $prop_name='$value' $fssnap"
- log_mustnot nonexist_user_prop $prop_name $fssnap
- else
- log_must nonexist_user_prop $prop_name $fssnap
- log_mustnot eval "zfs set $prop_name='$value' $fssnap"
- log_must nonexist_user_prop $prop_name $fssnap
- fi
+ log_must zfs set $prop_name="$value" $fssnap
+ log_mustnot nonexist_user_prop $prop_name $fssnap
done
log_pass "User properties has effect upon snapshot."
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_set/version_001_neg.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_set/version_001_neg.ksh
index cf5ef5116e90..318a9aae6b45 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_set/version_001_neg.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_set/version_001_neg.ksh
@@ -66,11 +66,7 @@ function set_n_check # data-set
orig_val=$(get_prop version $obj)
while (($i < ${#values[*]})); do
- zfs set version=${values[$i]} $obj > /dev/null 2>&1
- if [[ $? -eq 0 ]]; then
- log_note "zfs set version=${values[$i]} $obj"
- log_fail "The above version set returned 0!"
- fi
+ log_mustnot eval "zfs set version=${values[$i]} $obj > /dev/null 2>&1"
new_val=$(get_prop version $obj)
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_set/zfs_set_001_neg.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_set/zfs_set_001_neg.ksh
index c9bc7565abd6..e58fe9bfe93c 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_set/zfs_set_001_neg.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_set/zfs_set_001_neg.ksh
@@ -77,9 +77,9 @@ while (( i < ${#dataset[@]} )); do
done
(( j += 1 ))
done
- # Additional recordsize
- set_n_check_prop "recordsize" "2048K" "${dataset[i]}" false
- set_n_check_prop "recordsize" "128B" "${dataset[i]}" false
+ # Additional recordsize
+ set_n_check_prop "32768K" "recordsize" "${dataset[i]}" false
+ set_n_check_prop "128B" "recordsize" "${dataset[i]}" false
(( i += 1 ))
done
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_set/zfs_set_common.kshlib b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_set/zfs_set_common.kshlib
index 7e34341d8526..2858275cf2b9 100644
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_set/zfs_set_common.kshlib
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_set/zfs_set_common.kshlib
@@ -73,17 +73,17 @@ function set_n_check_prop
reservation|reserv|quota )
if [[ $expect_value == "none" ]]; then
[[ $cur_value != "0" ]] && \
- log_fail "The '$dataset' '$prop' value \
- '$cur_value' is not expected."
+ log_fail "The '$dataset' '$prop' value" \
+ "'$cur_value' is not expected."
elif [[ $cur_value != $expect_value ]]; then
- log_fail "The '$dataset' '$prop' value '$cur_value' \
- does not equal the expected value '$expect_value'."
+ log_fail "The '$dataset' '$prop' value '$cur_value'" \
+ "does not equal the expected value '$expect_value'."
fi
;;
* )
if [[ $cur_value != $expect_value ]]; then
- log_fail "The '$dataset' '$prop' value '$cur_value' \
- does not equal the expected value '$expect_value'."
+ log_fail "The '$dataset' '$prop' value '$cur_value'" \
+ "does not equal the expected value '$expect_value'."
fi
;;
esac
@@ -97,8 +97,8 @@ function set_n_check_prop
if [[ "$expect_value" != "" && "$cur_value" != "$old_value" ]];
then
- log_fail "The '$dataset' '$prop' value '$cur_value' \
- should equal with '$old_value'."
+ log_fail "The '$dataset' '$prop' value '$cur_value'" \
+ "should equal '$old_value'."
fi
fi
}
@@ -119,8 +119,8 @@ function cleanup_user_prop
typeset prop
for prop in $user_prop; do
- zfs inherit $prop $dt
- (($? != 0)) && log_must zfs inherit $prop $dt
+ zfs inherit $prop $dt ||
+ log_must zfs inherit $prop $dt
done
done
}
@@ -225,9 +225,7 @@ function user_property_value
{
typeset -i len=${1:-100}
- typeset value=$(random_string ALL_CHAR $len)
-
- echo "$value"
+ random_string ALL_CHAR $len
}
#
@@ -244,11 +242,7 @@ function check_user_prop
typeset expect_value="$3"
typeset value=$(zfs get -p -H -o value "$user_prop" $dtst 2>&1)
- if [[ "$expect_value" == "$value" ]]; then
- return 0
- else
- return 1
- fi
+ [ "$expect_value" = "$value" ]
}
#
@@ -258,14 +252,9 @@ function get_source
{
typeset prop=$1
typeset dataset=$2
- typeset source
- source=$(zfs get -H -o source $prop $dataset)
- if (($? != 0)); then
+ zfs get -H -o source $prop $dataset ||
log_fail "Unable to get $prop source for dataset $dataset"
- fi
-
- echo "$source"
}
#
@@ -315,15 +304,8 @@ function check_prop_inherit
typeset value=$(get_prop "$prop" "$checked_dtst")
typeset source=$(get_source "$prop" "$checked_dtst")
- if [[ "$value" != "$inherited_value" || \
- "$source" != "inherited from $inherited_dtst" ]]
- then
- log_note "expected (value '$inherited_value', source 'inherited from $inherited_dtst')," \
- "got (value '$value', source '$source')"
- return 1
- else
- return 0
- fi
+ [ "$value" = "$inherited_value" ] &&
+ [ "$source" = "inherited from $inherited_dtst" ]
}
#
@@ -341,17 +323,9 @@ function check_prop_received
typeset prop="$2"
typeset value="$3"
- received=$(zfs get -H -o received "$prop" "$dataset")
- if (($? != 0)); then
- log_fail "Unable to get $prop received value for dataset" \
- "$dataset"
- fi
- if [[ "$received" == "$value" ]]
- then
- return 0
- else
- return 1
- fi
+ received=$(zfs get -H -o received "$prop" "$dataset") ||
+ log_fail "Unable to get $prop received value for dataset $dataset"
+ [ "$received" = "$value" ]
}
#
@@ -367,14 +341,7 @@ function check_prop_missing
typeset dataset="$1"
typeset prop="$2"
- value=$(zfs get -H -o value "$prop" "$dataset")
- if (($? != 0)); then
+ value=$(zfs get -H -o value "$prop" "$dataset") ||
log_fail "Unable to get $prop value for dataset $dataset"
- fi
- if [[ "-" == "$value" ]]
- then
- return 0
- else
- return 1
- fi
+ [ "$value" = "-" ]
}
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_share/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_share/Makefile.am
deleted file mode 100644
index 35332f822e6c..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_share/Makefile.am
+++ /dev/null
@@ -1,21 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zfs_share
-dist_pkgdata_SCRIPTS = \
- setup.ksh \
- cleanup.ksh \
- zfs_share_001_pos.ksh \
- zfs_share_002_pos.ksh \
- zfs_share_003_pos.ksh \
- zfs_share_004_pos.ksh \
- zfs_share_005_pos.ksh \
- zfs_share_006_pos.ksh \
- zfs_share_007_neg.ksh \
- zfs_share_008_neg.ksh \
- zfs_share_009_neg.ksh \
- zfs_share_010_neg.ksh \
- zfs_share_011_pos.ksh \
- zfs_share_012_pos.ksh \
- zfs_share_013_pos.ksh \
- zfs_share_concurrent_shares.ksh
-
-dist_pkgdata_DATA = \
- zfs_share.cfg
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_share/zfs_share_005_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_share/zfs_share_005_pos.ksh
index 013e04ba311f..719dd645028a 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_share/zfs_share_005_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_share/zfs_share_005_pos.ksh
@@ -72,20 +72,17 @@ while (( i < ${#shareopts[*]} ))
do
log_must zfs set sharenfs="${shareopts[i]}" $TESTPOOL/$TESTFS
- option=`get_prop sharenfs $TESTPOOL/$TESTFS`
+ option=$(get_prop sharenfs $TESTPOOL/$TESTFS)
if [[ $option != ${shareopts[i]} ]]; then
log_fail "get sharenfs failed. ($option != ${shareopts[i]})"
fi
# Verify the single option after the leading 'ro' or 'rw'.
if is_linux; then
- option=`echo "$option" | cut -f2 -d','`
+ IFS=',' read -r _ option _ <<<"$option"
fi
- showshares_nfs | grep $option > /dev/null 2>&1
- if (( $? != 0 )); then
- log_fail "The '$option' option was not found in share output."
- fi
+ log_must eval "showshares_nfs | grep -q \"$option\""
((i = i + 1))
done
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_share/zfs_share_007_neg.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_share/zfs_share_007_neg.ksh
index c64157cee601..553605000d1b 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_share/zfs_share_007_neg.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_share/zfs_share_007_neg.ksh
@@ -63,10 +63,7 @@ do
log_note "Setting sharenfs=${badopts[i]} $i "
log_mustnot zfs set sharenfs="${badopts[i]}" $TESTPOOL/$TESTFS
- showshares_nfs | grep $option > /dev/null 2>&1
- if (( $? == 0 )); then
- log_fail "An invalid setting '$option' was propagated."
- fi
+ log_mustnot eval "showshares_nfs | grep -q ${badopts[i]}"
#
# To global zone, sharenfs must be set 'off' before malformed testing.
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_share/zfs_share_009_neg.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_share/zfs_share_009_neg.ksh
index cf8c84cfe301..ddd65e88859b 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_share/zfs_share_009_neg.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_share/zfs_share_009_neg.ksh
@@ -63,8 +63,7 @@ if [[ $sharenfs_val == off ]]; then
log_must zfs set sharenfs=on $fs
fi
-showshares_nfs | grep $mpt >/dev/null 2>&1
-if (( $? != 0 )); then
+if ! showshares_nfs | grep -q $mpt; then
log_must zfs share $fs
fi
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_share/zfs_share_011_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_share/zfs_share_011_pos.ksh
index 131b039e1cd2..efd7a2d0c7bd 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_share/zfs_share_011_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_share/zfs_share_011_pos.ksh
@@ -67,20 +67,14 @@ typeset origdir=$PWD
# unmount fails will not unshare the shared filesystem
log_must zfs set sharenfs=on $TESTPOOL/$TESTFS
log_must is_shared $TESTDIR
-if cd $TESTDIR ; then
- log_mustnot zfs umount $TESTPOOL/$TESTFS
-else
- log_fail "cd $TESTDIR fails"
-fi
+log_must cd $TESTDIR
+log_mustnot zfs umount $TESTPOOL/$TESTFS
log_must is_shared $TESTDIR
# destroy fails will not unshare the shared filesystem
log_must zfs create $TESTPOOL/$TESTFS/fs2
-if cd $TESTDIR/fs2 ; then
- log_mustnot zfs destroy $TESTPOOL/$TESTFS/fs2
-else
- log_fail "cd $TESTDIR/fs2 fails"
-fi
+log_must cd $TESTDIR/fs2
+log_mustnot zfs destroy $TESTPOOL/$TESTFS/fs2
log_must is_shared $TESTDIR/fs2
log_pass "Verify that umount and destroy fail, and do not unshare the shared" \
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_share/zfs_share_013_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_share/zfs_share_013_pos.ksh
index 150eddac0ebb..e9766de49285 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_share/zfs_share_013_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_share/zfs_share_013_pos.ksh
@@ -46,35 +46,35 @@ cleanup
log_must zfs set sharenfs="rw=[::1]" $TESTPOOL/$TESTFS
output=$(showshares_nfs 2>&1)
-log_must grep "::1(" <<< "$output" > /dev/null
+log_must grep -q "::1(" <<< "$output"
log_must zfs set sharenfs="rw=[2::3]" $TESTPOOL/$TESTFS
output=$(showshares_nfs 2>&1)
-log_must grep "2::3(" <<< "$output" > /dev/null
+log_must grep -q "2::3(" <<< "$output"
log_must zfs set sharenfs="rw=[::1]:[2::3]" $TESTPOOL/$TESTFS
output=$(showshares_nfs 2>&1)
-log_must grep "::1(" <<< "$output" > /dev/null
-log_must grep "2::3(" <<< "$output" > /dev/null
+log_must grep -q "::1(" <<< "$output"
+log_must grep -q "2::3(" <<< "$output"
log_must zfs set sharenfs="rw=[::1]/64" $TESTPOOL/$TESTFS
output=$(showshares_nfs 2>&1)
-log_must grep "::1/64(" <<< "$output" > /dev/null
+log_must grep -q "::1/64(" <<< "$output"
log_must zfs set sharenfs="rw=[2::3]/128" $TESTPOOL/$TESTFS
output=$(showshares_nfs 2>&1)
-log_must grep "2::3/128(" <<< "$output" > /dev/null
+log_must grep -q "2::3/128(" <<< "$output"
log_must zfs set sharenfs="rw=[::1]/32:[2::3]/128" $TESTPOOL/$TESTFS
output=$(showshares_nfs 2>&1)
-log_must grep "::1/32(" <<< "$output" > /dev/null
-log_must grep "2::3/128(" <<< "$output" > /dev/null
+log_must grep -q "::1/32(" <<< "$output"
+log_must grep -q "2::3/128(" <<< "$output"
log_must zfs set sharenfs="rw=[::1]:[2::3]/64:[2a01:1234:1234:1234:aa34:234:1234:1234]:1.2.3.4/24" $TESTPOOL/$TESTFS
output=$(showshares_nfs 2>&1)
-log_must grep "::1(" <<< "$output" > /dev/null
-log_must grep "2::3/64(" <<< "$output" > /dev/null
-log_must grep "2a01:1234:1234:1234:aa34:234:1234:1234(" <<< "$output" > /dev/null
-log_must grep "1\\.2\\.3\\.4/24(" <<< "$output" > /dev/null
+log_must grep -q "::1(" <<< "$output"
+log_must grep -q "2::3/64(" <<< "$output"
+log_must grep -q "2a01:1234:1234:1234:aa34:234:1234:1234(" <<< "$output"
+log_must grep -q "1\\.2\\.3\\.4/24(" <<< "$output"
log_pass "NFS share ip address propagated correctly."
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_share/zfs_share_concurrent_shares.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_share/zfs_share_concurrent_shares.ksh
index dbaaf39b65d4..22b8af4e89d8 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_share/zfs_share_concurrent_shares.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_share/zfs_share_concurrent_shares.ksh
@@ -47,31 +47,20 @@ verify_runnable "global"
function cleanup
{
wait
- for fs in $(seq 0 50)
+ for fs in {0..50}
do
- log_must zfs set sharenfs=off $TESTPOOL/$TESTFS1/$fs
- log_must zfs set sharenfs=off $TESTPOOL/$TESTFS2/$fs
- log_must zfs set sharenfs=off $TESTPOOL/$TESTFS3/$fs
- unshare_fs $TESTPOOL/$TESTFS1/$fs
- unshare_fs $TESTPOOL/$TESTFS2/$fs
- unshare_fs $TESTPOOL/$TESTFS3/$fs
-
- if mounted $TESTPOOL/$TESTFS1/$fs; then
- log_must zfs unmount $TESTPOOL/$TESTFS1/$fs
- fi
- if mounted $TESTPOOL/$TESTFS2/$fs; then
- log_must zfs unmount $TESTPOOL/$TESTFS2/$fs
- fi
- if mounted $TESTPOOL/$TESTFS3/$fs; then
- log_must zfs unmount $TESTPOOL/$TESTFS3/$fs
- fi
-
- datasetexists $TESTPOOL/$TESTFS1/$fs && \
- destroy_dataset $TESTPOOL/$TESTFS1/$fs -f
- datasetexists $TESTPOOL/$TESTFS2/$fs && \
- destroy_dataset $TESTPOOL/$TESTFS2/$fs -f
- datasetexists $TESTPOOL/$TESTFS3/$fs && \
- destroy_dataset $TESTPOOL/$TESTFS3/$fs -f
+ for pfs in $TESTFS1 $TESTFS2 $TESTFS3
+ do
+ log_must zfs set sharenfs=off $TESTPOOL/$pfs/$fs
+ unshare_fs $TESTPOOL/$pfs/$fs
+
+ if mounted $TESTPOOL/$pfs/$fs; then
+ log_must zfs unmount $TESTPOOL/$pfs/$fs
+ fi
+
+ datasetexists $TESTPOOL/$pfs/$fs && \
+ destroy_dataset $TESTPOOL/$pfs/$fs -f
+ done
done
log_must zfs share -a
@@ -79,7 +68,7 @@ function cleanup
function create_filesystems
{
- for fs in $(seq 0 50)
+ for fs in {0..50}
do
log_must zfs create -p $TESTPOOL/$TESTFS1/$fs
log_must zfs create -p $TESTPOOL/$TESTFS2/$fs
@@ -87,6 +76,12 @@ function create_filesystems
done
}
+function sub_fail
+{
+ log_note $$: "$@"
+ exit 1
+}
+
#
# Main test routine.
#
@@ -99,32 +94,45 @@ function test_share # filesystem
typeset mntp=$(get_prop mountpoint $filesystem)
not_shared $mntp || \
- log_fail "File system $filesystem is already shared."
+ sub_fail "File system $filesystem is already shared."
zfs set sharenfs=on $filesystem || \
- log_fail "zfs set sharenfs=on $filesystem failed."
+ sub_fail "zfs set sharenfs=on $filesystem failed."
is_shared $mntp || \
- log_fail "File system $filesystem is not shared (set sharenfs)."
+ sub_fail "File system $filesystem is not shared (set sharenfs)."
#
# Verify 'zfs share' works as well.
#
zfs unshare $filesystem || \
- log_fail "zfs unshare $filesystem failed."
+ sub_fail "zfs unshare $filesystem failed."
is_shared $mntp && \
- log_fail "File system $filesystem is still shared."
+ sub_fail "File system $filesystem is still shared."
+
zfs share $filesystem || \
- log_fail "zfs share $filesystem failed."
+ sub_fail "zfs share $filesystem failed."
is_shared $mntp || \
- log_fail "file system $filesystem is not shared (zfs share)."
+ sub_fail "file system $filesystem is not shared (zfs share)."
+
#log_note "Sharing a shared file system fails."
zfs share $filesystem && \
- log_fail "zfs share $filesystem did not fail"
+ sub_fail "zfs share $filesystem did not fail"
+
return 0
}
+function unshare_fs_nolog
+{
+ typeset fs=$1
+
+ if is_shared $fs || is_shared_smb $fs; then
+ zfs unshare $fs ||
+ sub_fail "zfs unshare $fs: $?"
+ fi
+}
+
#
# Set the main process id so that we know to capture
# failures from child processes and allow the parent process
@@ -137,20 +145,16 @@ log_onexit cleanup
create_filesystems
child_pids=()
-for fs in $(seq 0 50)
+for fs in {0..50}
do
- test_share $TESTPOOL/$TESTFS1/$fs &
- child_pids+=($!)
- log_note "$TESTPOOL/$TESTFS1/$fs ==> $!"
- test_share $TESTPOOL/$TESTFS2/$fs &
- child_pids+=($!)
- log_note "$TESTPOOL/$TESTFS2/$fs ==> $!"
- test_share $TESTPOOL/$TESTFS3/$fs &
- child_pids+=($!)
- log_note "$TESTPOOL/$TESTFS3/$fs ==> $!"
+ for pfs in $TESTFS1 $TESTFS2 $TESTFS3
+ do
+ test_share $TESTPOOL/$pfs/$fs &
+ child_pids+=($!)
+ log_note "$TESTPOOL/$pfs/$fs ==> $!"
+ done
done
-wait_for_children "${child_pids[@]}" ||
- log_fail "multithreaded share test failed"
+log_must wait_for_children "${child_pids[@]}"
log_note "Verify 'zfs share -a' succeeds."
@@ -158,17 +162,16 @@ log_note "Verify 'zfs share -a' succeeds."
# Unshare each of the file systems.
#
child_pids=()
-for fs in $(seq 0 50)
+for fs in {0..50}
do
- unshare_fs $TESTPOOL/$TESTFS1/$fs &
- child_pids+=($!)
- unshare_fs $TESTPOOL/$TESTFS2/$fs &
- child_pids+=($!)
- unshare_fs $TESTPOOL/$TESTFS3/$fs &
- child_pids+=($!)
+ for pfs in $TESTFS1 $TESTFS2 $TESTFS3
+ do
+ unshare_fs_nolog $TESTPOOL/$pfs/$fs &
+ child_pids+=($!)
+ log_note "$TESTPOOL/$pfs/$fs (unshare) ==> $!"
+ done
done
-wait_for_children "${child_pids[@]}" ||
- log_fail "multithreaded unshare failed"
+log_must wait_for_children "${child_pids[@]}"
#
# Try a zfs share -a and verify all file systems are shared.
@@ -181,21 +184,13 @@ log_must zfs share -a
#
unset __ZFS_POOL_EXCLUDE
-for fs in $(seq 0 50)
+for fs in {0..50}
do
- is_shared $TESTPOOL/$TESTFS1/$fs || \
- log_fail "File system $TESTPOOL/$TESTFS1/$fs is not shared"
- is_shared $TESTPOOL/$TESTFS2/$fs || \
- log_fail "File system $TESTPOOL/$TESTFS2/$fs is not shared"
- is_shared $TESTPOOL/$TESTFS3/$fs || \
- log_fail "File system $TESTPOOL/$TESTFS3/$fs is not shared"
-
- is_exported $TESTPOOL/$TESTFS1/$fs || \
- log_fail "File system $TESTPOOL/$TESTFS1/$fs is not exported"
- is_exported $TESTPOOL/$TESTFS2/$fs || \
- log_fail "File system $TESTPOOL/$TESTFS2/$fs is not exported"
- is_exported $TESTPOOL/$TESTFS3/$fs || \
- log_fail "File system $TESTPOOL/$TESTFS3/$fs is not exported"
+ for pfs in $TESTFS1 $TESTFS2 $TESTFS3
+ do
+ log_must is_shared $TESTPOOL/$pfs/$fs
+ log_must is_exported $TESTPOOL/$pfs/$fs
+ done
done
-log_pass "'zfs share [ -a ] <filesystem>' succeeds as root."
+log_pass "'zfs share [-a] <filesystem>' succeeds as root."
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_snapshot/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_snapshot/Makefile.am
deleted file mode 100644
index bc5b801259c8..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_snapshot/Makefile.am
+++ /dev/null
@@ -1,16 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zfs_snapshot
-dist_pkgdata_SCRIPTS = \
- setup.ksh \
- cleanup.ksh \
- zfs_snapshot_001_neg.ksh \
- zfs_snapshot_002_neg.ksh \
- zfs_snapshot_003_neg.ksh \
- zfs_snapshot_004_neg.ksh \
- zfs_snapshot_005_neg.ksh \
- zfs_snapshot_006_pos.ksh \
- zfs_snapshot_007_neg.ksh \
- zfs_snapshot_008_neg.ksh \
- zfs_snapshot_009_pos.ksh
-
-dist_pkgdata_DATA = \
- zfs_snapshot.cfg
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_snapshot/zfs_snapshot_004_neg.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_snapshot/zfs_snapshot_004_neg.ksh
index 16926a48ddc4..62bf71390c70 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_snapshot/zfs_snapshot_004_neg.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_snapshot/zfs_snapshot_004_neg.ksh
@@ -59,18 +59,18 @@ while ((ret == 0)); do
ret=$?
if ((ret != 0)); then
- len=$(echo $basefs| wc -c)
+ len=${#basefs}
log_note "The deeply-nested filesystem len: $len"
#
- # Make sure there are at lease 2 characters left
+ # Make sure there are at least 2 characters left
# for snapshot name space, otherwise snapshot name
# is incorrect
#
if ((len >= 255)); then
datasetexists $basefs && destroy_dataset $basefs -r
basefs=${basefs%/*}
- len=$(echo $basefs| wc -c)
+ len=${#basefs}
fi
break
fi
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_snapshot/zfs_snapshot_005_neg.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_snapshot/zfs_snapshot_005_neg.ksh
index c133403ac84a..be5bbc8346d6 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_snapshot/zfs_snapshot_005_neg.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_snapshot/zfs_snapshot_005_neg.ksh
@@ -60,7 +60,7 @@ while ((ret == 0)); do
ret=$?
if ((ret != 0)); then
- len=$(echo $basefs | wc -c)
+ len=$(( ${#basefs} + 1 )) # +1 for NUL
log_note "The deeply-nested filesystem len: $len"
#
@@ -71,7 +71,7 @@ while ((ret == 0)); do
if ((len >= 255)); then
datasetexists $basefs && destroy_dataset $basefs -r
basefs=${basefs%/*}
- len=$(echo $basefs| wc -c)
+ len=$(( ${#basefs} + 1 ))
fi
break
fi
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_snapshot/zfs_snapshot_007_neg.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_snapshot/zfs_snapshot_007_neg.ksh
index 9499dca21e78..40b936dee977 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_snapshot/zfs_snapshot_007_neg.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_snapshot/zfs_snapshot_007_neg.ksh
@@ -72,18 +72,13 @@ typeset ro_props="type used available avail creation referenced refer compressra
mounted origin"
typeset snap_ro_props="volsize recordsize recsize quota reservation reserv mountpoint \
sharenfs checksum compression compress atime devices exec readonly rdonly \
- setuid"
+ setuid version"
if is_freebsd; then
snap_ro_props+=" jailed"
else
snap_ro_props+=" zoned"
fi
-zfs upgrade -v > /dev/null 2>&1
-if [[ $? -eq 0 ]]; then
- snap_ro_props="$snap_ro_props version"
-fi
-
for fs in $TESTPOOL/$TESTFS $TESTPOOL/$TESTVOL $TESTPOOL/$TESTCTR $TESTPOOL ; do
typeset fssnap=$fs@snap
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_snapshot/zfs_snapshot_009_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_snapshot/zfs_snapshot_009_pos.ksh
index 4ff539a377d4..a81e82ddf546 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_snapshot/zfs_snapshot_009_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_snapshot/zfs_snapshot_009_pos.ksh
@@ -84,11 +84,11 @@ while (( i < ${#invalid_args[*]} )); do
((i = i + 1))
done
log_note "verify multiple snapshot transaction group"
-txg_group=$(zdb -Pd $TESTPOOL | grep snap | awk '{print $7}')
+txg_group=$(zdb -Pd $TESTPOOL | awk '/snap/ {print $7}')
for i in 1 2 3; do
- txg_tag=$(echo "$txg_group" | nawk -v j=$i 'FNR == j {print}')
+ txg_tag=$(echo "$txg_group" | awk -v j=$i 'FNR == j {print}')
[[ $txg_tag != $(echo "$txg_group" | \
- nawk -v j=$i 'FNR == j {print}') ]] \
+ awk -v j=$i 'FNR == j {print}') ]] \
&& log_fail "snapshots belong to different transaction groups"
done
log_note "verify snapshot contents"
@@ -120,7 +120,7 @@ for x in {1..$ITERATIONS}; do
for y in {1..$NUM_SNAPS}; do
log_must zfs snapshot $TESTPOOL/$MYTEST@$y
done;
- n=$(ls -1 /$TESTPOOL/$MYTEST/.zfs/snapshot | wc -l)
+ n=$(ls /$TESTPOOL/$MYTEST/.zfs/snapshot | wc -l)
verify_eq $n $NUM_SNAPS "count"
zfs destroy -r $TESTPOOL/$MYTEST;
done;
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_sysfs/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_sysfs/Makefile.am
deleted file mode 100644
index 6a83edf2a443..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_sysfs/Makefile.am
+++ /dev/null
@@ -1,10 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zfs_sysfs
-dist_pkgdata_SCRIPTS = \
- setup.ksh \
- cleanup.ksh \
- zfeature_set_unsupported.ksh \
- zfs_get_unsupported.ksh \
- zfs_set_unsupported.ksh \
- zfs_sysfs_live.ksh \
- zpool_get_unsupported.ksh \
- zpool_set_unsupported.ksh
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_unload-key/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_unload-key/Makefile.am
deleted file mode 100644
index 74cdf5c2b558..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_unload-key/Makefile.am
+++ /dev/null
@@ -1,7 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zfs_unload-key
-dist_pkgdata_SCRIPTS = \
- setup.ksh \
- cleanup.ksh \
- zfs_unload-key.ksh \
- zfs_unload-key_all.ksh \
- zfs_unload-key_recursive.ksh
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_unload-key/zfs_unload-key_all.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_unload-key/zfs_unload-key_all.ksh
index 55da68262019..6d3d37bd618a 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_unload-key/zfs_unload-key_all.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_unload-key/zfs_unload-key_all.ksh
@@ -54,7 +54,8 @@ log_must zfs create $TESTPOOL/$TESTFS1/child
log_must zfs create -V 64M -o encryption=on -o keyformat=passphrase \
-o keylocation=file:///$TESTPOOL/pkey $TESTPOOL/zvol
-typeset DISK2="$(echo $DISKS | awk '{ print $2}')"
+typeset DISK2 _
+read -r _ DISK2 _ <<<"$DISKS"
log_must zpool create -O encryption=on -O keyformat=passphrase \
-O keylocation=file:///$TESTPOOL/pkey $TESTPOOL1 $DISK2
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_unmount/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_unmount/Makefile.am
deleted file mode 100644
index 6507b094df47..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_unmount/Makefile.am
+++ /dev/null
@@ -1,20 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zfs_unmount
-dist_pkgdata_SCRIPTS = \
- setup.ksh \
- cleanup.ksh \
- zfs_unmount_001_pos.ksh \
- zfs_unmount_002_pos.ksh \
- zfs_unmount_003_pos.ksh \
- zfs_unmount_004_pos.ksh \
- zfs_unmount_005_pos.ksh \
- zfs_unmount_006_pos.ksh \
- zfs_unmount_007_neg.ksh \
- zfs_unmount_008_neg.ksh \
- zfs_unmount_009_pos.ksh \
- zfs_unmount_all_001_pos.ksh \
- zfs_unmount_nested.ksh \
- zfs_unmount_unload_keys.ksh
-
-dist_pkgdata_DATA = \
- zfs_unmount.cfg \
- zfs_unmount.kshlib
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_unmount/zfs_unmount.kshlib b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_unmount/zfs_unmount.kshlib
index 525dfd162957..3fc5509a612e 100644
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_unmount/zfs_unmount.kshlib
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_unmount/zfs_unmount.kshlib
@@ -53,7 +53,7 @@ function do_unmount #cmd #opt #mnt #expect
zfs $cmd $opt $mnt
ret=$?
- if (( ret != expect)); then
+ if (( ret != expect )); then
log_fail "'zfs $cmd $opt $mnt' " \
"unexpected return code of $ret."
fi
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_unmount/zfs_unmount_006_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_unmount/zfs_unmount_006_pos.ksh
index 8b70e8868a02..0afb9b6f8501 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_unmount/zfs_unmount_006_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_unmount/zfs_unmount_006_pos.ksh
@@ -56,7 +56,6 @@ log_onexit cleanup
# Call cleanup to make sure the file system are mounted.
cleanup
mntpnt=$(get_prop mountpoint $TESTPOOL/$TESTFS)
-(($? != 0)) && log_fail "get_prop mountpoint $TESTPOOL/$TESTFS"
typeset -i i=0
while (( i < 10000 )); do
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_unshare/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_unshare/Makefile.am
deleted file mode 100644
index 0845f1e2f9f6..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_unshare/Makefile.am
+++ /dev/null
@@ -1,11 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zfs_unshare
-dist_pkgdata_SCRIPTS = \
- setup.ksh \
- cleanup.ksh \
- zfs_unshare_001_pos.ksh \
- zfs_unshare_002_pos.ksh \
- zfs_unshare_003_pos.ksh \
- zfs_unshare_004_neg.ksh \
- zfs_unshare_005_neg.ksh \
- zfs_unshare_006_pos.ksh \
- zfs_unshare_007_pos.ksh
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_unshare/setup.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_unshare/setup.ksh
index 29f38e802c57..b5208415d45c 100755..120000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_unshare/setup.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_unshare/setup.ksh
@@ -1,39 +1 @@
-#!/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
-
-share -s
-if [ $? -ne 0 ]; then
- log_unsupported "The NFS utilities are not installed"
-fi
-
-# Make sure NFS server is running before testing.
-setup_nfs_server
-
-DISK=${DISKS%% *}
-default_container_volume_setup $DISK
+../zfs_share/setup.ksh \ No newline at end of file
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_unshare/zfs_unshare_001_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_unshare/zfs_unshare_001_pos.ksh
index ac16fe97b928..3955f0ee3590 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_unshare/zfs_unshare_001_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_unshare/zfs_unshare_001_pos.ksh
@@ -149,7 +149,7 @@ while (( i < ${#mntp_fs[*]} )); do
else
log_must zfs set sharenfs=on ${mntp_fs[((i+1))]}
is_shared ${mntp_fs[i]} || \
- log_fail "'zfs set sharenfs=on' fails to share filesystem."
+ log_fail "'zfs set sharenfs=on' fails to share filesystem: ${mntp_fs[i]} not shared."
fi
((i = i + 2))
@@ -166,7 +166,7 @@ log_must zfs unshare -a
i=0
while (( i < ${#mntp_fs[*]} )); do
not_shared ${mntp_fs[i]} || \
- log_fail "'zfs unshare -a' fails to unshare all shared zfs filesystems."
+ log_fail "'zfs unshare -a' fails to unshare all shared zfs filesystems: ${mntp_fs[i]} still shared."
((i = i + 2))
done
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_unshare/zfs_unshare_002_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_unshare/zfs_unshare_002_pos.ksh
index 1ded1b42c7ec..2fb8ae7814ea 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_unshare/zfs_unshare_002_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_unshare/zfs_unshare_002_pos.ksh
@@ -91,7 +91,7 @@ function test_legacy_unshare # <mntp> <filesystem>
log_fail "'zfs set sharenfs=off' fails to make ZFS " \
"filesystem $filesystem unshared."
- log_must eval "share_nfs $mntp"
+ log_must share_nfs $mntp
is_shared $mntp || \
log_fail "'share' command fails to share ZFS file system."
#
@@ -179,4 +179,3 @@ while (( i < ${#mntp_fs[*]} )); do
done
log_pass "'zfs unshare [-a]' succeeds to be aware of legacy share."
-
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_unshare/zfs_unshare_006_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_unshare/zfs_unshare_006_pos.ksh
index b4318020cc7f..b6e5178cf2bb 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_unshare/zfs_unshare_006_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_unshare/zfs_unshare_006_pos.ksh
@@ -41,9 +41,7 @@
verify_runnable "global"
-if is_linux; then
- log_unsupported "some distros come with Samba "user shares" disabled"
-fi
+[ -d "/var/lib/samba/usershares" ] || log_unsupported "Samba usershares disabled"
function cleanup
{
@@ -51,9 +49,10 @@ function cleanup
log_must zfs destroy -f $TESTPOOL/$TESTFS/shared1
log_must zfs destroy -f $TESTPOOL/$TESTFS/shared2
log_must zfs destroy -f $TESTPOOL/$TESTFS/shared3
+ log_must rm -f /var/lib/samba/usershares/testpool_testfs_shared{2,3}
}
-log_assert "Verify 'zfs unshare [nfs|smb] -a' only works on the specified "\
+log_assert "Verify 'zfs unshare [nfs|smb] -a' only works on the specified" \
"protocol."
log_onexit cleanup
@@ -74,19 +73,19 @@ log_must zfs share -a
log_must zfs unshare nfs -a
# 3. Verify that only nfs filesystems are unshared.
-log_must eval "not_shared $TESTPOOL/$TESTFS/shared1"
-log_must eval "not_shared $TESTPOOL/$TESTFS/shared2"
-log_must eval "is_shared_smb $TESTPOOL/$TESTFS/shared2"
-log_must eval "is_shared_smb $TESTPOOL/$TESTFS/shared3"
+log_must not_shared $TESTPOOL/$TESTFS/shared1
+log_must not_shared $TESTPOOL/$TESTFS/shared2
+log_must is_shared_smb $TESTPOOL/$TESTFS/shared2
+log_must is_shared_smb $TESTPOOL/$TESTFS/shared3
# 4. Share all filesystems again.
log_must zfs share -a
# 5. Invoke 'zfs unshare smb -a' and verify only smb filesystems are unshared.
log_must zfs unshare smb -a
-log_must eval "is_shared $TESTPOOL/$TESTFS/shared1"
-log_must eval "is_shared $TESTPOOL/$TESTFS/shared2"
-log_must eval "not_shared_smb $TESTPOOL/$TESTFS/shared2"
-log_must eval "not_shared_smb $TESTPOOL/$TESTFS/shared3"
+log_must is_shared $TESTPOOL/$TESTFS/shared1
+log_must is_shared $TESTPOOL/$TESTFS/shared2
+log_must not_shared_smb $TESTPOOL/$TESTFS/shared2
+log_must not_shared_smb $TESTPOOL/$TESTFS/shared3
log_pass "'zfs unshare [nfs|smb] -a' only works on the specified protocol."
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_unshare/zfs_unshare_008_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_unshare/zfs_unshare_008_pos.ksh
new file mode 100755
index 000000000000..21d5ac79bbdc
--- /dev/null
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_unshare/zfs_unshare_008_pos.ksh
@@ -0,0 +1,58 @@
+#!/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
+#
+
+. $STF_SUITE/include/libtest.shlib
+
+#
+# DESCRIPTION:
+# Verify that datasets mounted at directories with whitespace are properly escaped
+# both going in (for mountd consumption) and going out (for removing from export list)
+#
+# STRATEGY:
+# 1. Create and share a dataset with spaces, tabs, and newlines
+# 2. Verify it's shared
+# 3. Unshare it
+# 4. Verify it's not shared
+#
+
+shares_can_have_whitespace || log_unsupported "Platform doesn't permit whitespace in NFS shares"
+basename='a + b
+ c d'
+escname='a\040+\040b\012\040c\011d'
+
+verify_runnable "global"
+
+function cleanup
+{
+ datasetexists "$TESTPOOL/$TESTFS/shared1" && \
+ destroy_dataset "$TESTPOOL/$TESTFS/shared1" -f
+}
+
+log_assert "Datasets with spaces are properly shared and unshared."
+log_onexit cleanup
+
+log_must zfs create -o sharenfs=on -o mountpoint="$TESTDIR/$basename" "$TESTPOOL/$TESTFS/shared1"
+log_must is_shared "$TESTDIR/$escname"
+log_must zfs unshare "$TESTPOOL/$TESTFS/shared1"
+log_mustnot is_shared "$TESTDIR/$escname"
+
+log_pass "Datasets with spaces are properly shared and unshared."
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_upgrade/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_upgrade/Makefile.am
deleted file mode 100644
index 7a71bae4bb42..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_upgrade/Makefile.am
+++ /dev/null
@@ -1,14 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zfs_upgrade
-dist_pkgdata_SCRIPTS = \
- setup.ksh \
- cleanup.ksh \
- zfs_upgrade_001_pos.ksh \
- zfs_upgrade_002_pos.ksh \
- zfs_upgrade_003_pos.ksh \
- zfs_upgrade_004_pos.ksh \
- zfs_upgrade_005_pos.ksh \
- zfs_upgrade_006_neg.ksh \
- zfs_upgrade_007_neg.ksh
-
-dist_pkgdata_DATA = \
- zfs_upgrade.kshlib
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_upgrade/zfs_upgrade_001_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_upgrade/zfs_upgrade_001_pos.ksh
index ab76461638b9..db8b96f50568 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_upgrade/zfs_upgrade_001_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_upgrade/zfs_upgrade_001_pos.ksh
@@ -71,8 +71,8 @@ typeset expect_str2="All filesystems are formatted with the current version"
typeset expect_str3="The following filesystems are out of date, and can be upgraded"
typeset -i COUNT OLDCOUNT
-zfs upgrade | nawk '$1 ~ "^[0-9]+$" {print $2}'> $oldoutput
-OLDCOUNT=$( wc -l $oldoutput | awk '{print $1}' )
+zfs upgrade | awk '$1 ~ "^[0-9]+$" {print $2}'> $oldoutput
+OLDCOUNT=$(wc -l < $oldoutput)
old_datasets=""
for version in $ZFS_ALL_VERSIONS ; do
@@ -98,9 +98,9 @@ log_must eval 'zfs upgrade > $output 2>&1'
# we also check that the usage message contains at least a description
# of the current ZFS version.
-log_must eval 'grep "${expect_str1} $ZFS_VERSION" $output > /dev/null 2>&1'
-zfs upgrade | nawk '$1 ~ "^[0-9]+$" {print $2}'> $output
-COUNT=$( wc -l $output | awk '{print $1}' )
+log_must grep -q "${expect_str1} $ZFS_VERSION" $output
+zfs upgrade | awk '$1 ~ "^[0-9]+$" {print $2}'> $output
+COUNT=$(wc -l < $output)
typeset -i i=0
for fs in ${old_datasets}; do
@@ -118,14 +118,14 @@ for fs in $old_datasets ; do
done
log_must eval 'zfs upgrade > $output 2>&1'
-log_must eval 'grep "${expect_str1} $ZFS_VERSION" $output > /dev/null 2>&1'
+log_must grep -q "${expect_str1} $ZFS_VERSION" $output
if (( OLDCOUNT == 0 )); then
- log_must eval 'grep "${expect_str2}" $output > /dev/null 2>&1'
+ log_must grep -q "${expect_str2}" $output
else
- log_must eval 'grep "${expect_str3}" $output > /dev/null 2>&1'
+ log_must grep -q "${expect_str3}" $output
fi
-zfs upgrade | nawk '$1 ~ "^[0-9]+$" {print $2}'> $output
-COUNT=$( wc -l $output | awk '{print $1}' )
+zfs upgrade | awk '$1 ~ "^[0-9]+$" {print $2}'> $output
+COUNT=$(wc -l < $output)
if (( COUNT != OLDCOUNT )); then
cat $output
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_upgrade/zfs_upgrade_002_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_upgrade/zfs_upgrade_002_pos.ksh
index ba6e7c483edd..994ee2b3475a 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_upgrade/zfs_upgrade_002_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_upgrade/zfs_upgrade_002_pos.ksh
@@ -60,8 +60,8 @@ typeset expect_str2="Enhanced directory entries"
log_must eval 'zfs upgrade -v > /dev/null 2>&1'
-zfs upgrade -v | nawk '$1 ~ "^[0-9]+$" {print $0}'> $output
-log_must eval 'grep "${expect_str1}" $output > /dev/null 2>&1'
-log_must eval 'grep "${expect_str2}" $output > /dev/null 2>&1'
+zfs upgrade -v | awk '$1 ~ "^[0-9]+$" {print $0}'> $output
+log_must grep -q "${expect_str1}" $output
+log_must grep -q "${expect_str2}" $output
log_pass "Executing 'zfs upgrade -v' command succeeds."
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_wait/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_wait/Makefile.am
deleted file mode 100644
index 5d385d915720..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_wait/Makefile.am
+++ /dev/null
@@ -1,9 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zfs_wait
-dist_pkgdata_SCRIPTS = \
- setup.ksh \
- cleanup.ksh \
- zfs_wait_deleteq.ksh \
- zfs_wait_getsubopt.ksh
-
-dist_pkgdata_DATA = \
- zfs_wait.kshlib
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zhack/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zhack/Makefile.am
deleted file mode 100644
index 931dacde6beb..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zhack/Makefile.am
+++ /dev/null
@@ -1,3 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zhack
-dist_pkgdata_SCRIPTS = \
- zhack_label_checksum.ksh
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool/Makefile.am
deleted file mode 100644
index 327f23621158..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool/Makefile.am
+++ /dev/null
@@ -1,8 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zpool
-dist_pkgdata_SCRIPTS = \
- setup.ksh \
- cleanup.ksh \
- zpool_001_neg.ksh \
- zpool_002_pos.ksh \
- zpool_003_pos.ksh \
- zpool_colors.ksh
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool/zpool_002_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool/zpool_002_pos.ksh
index e4ffa2a6c028..ef88925dc92f 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool/zpool_002_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool/zpool_002_pos.ksh
@@ -47,33 +47,27 @@ function cleanup
{
unset ZFS_ABORT
- if is_freebsd && [ -n "$old_corefile" ]; then
- sysctl kern.corefile=$old_corefile
- fi
+ log_must pop_coredump_pattern "$coresavepath"
+ log_must rm -rf $corepath $vdev1 $vdev2 $vdev3
# Clean up the pool created if we failed to abort.
poolexists $pool && destroy_pool $pool
-
- rm -rf $corepath $vdev1 $vdev2 $vdev3
}
log_assert "With ZFS_ABORT set, all zpool commands can abort and generate a core file."
log_onexit cleanup
corepath=$TESTDIR/core
-corefile=$corepath/zpool.core
-if [[ -d $corepath ]]; then
- log_must rm -rf $corepath
-fi
+corefile=$corepath/core.zpool
+coresavepath=$corepath/save
+log_must rm -rf $corepath
log_must mkdir $corepath
pool=pool.$$
vdev1=$TESTDIR/file1
vdev2=$TESTDIR/file2
vdev3=$TESTDIR/file3
-for vdev in $vdev1 $vdev2 $vdev3; do
- log_must mkfile $MINVDEVSIZE $vdev
-done
+log_must mkfile $MINVDEVSIZE $vdev1 $vdev2 $vdev3
set -A cmds "create $pool mirror $vdev1 $vdev2" "list $pool" "iostat $pool" \
"status $pool" "upgrade $pool" "get delegation $pool" "set delegation=off $pool" \
@@ -86,25 +80,12 @@ set -A badparams "" "create" "destroy" "add" "remove" "list *" "iostat" "status"
"online" "offline" "clear" "attach" "detach" "replace" "scrub" \
"import" "export" "upgrade" "history -?" "get" "set"
-if is_linux; then
- echo $corefile >/proc/sys/kernel/core_pattern
- echo 0 >/proc/sys/kernel/core_uses_pid
-elif is_freebsd; then
- old_corefile=$(sysctl -n kern.corefile)
- log_must sysctl kern.corefile=$corefile
-fi
-ulimit -c unlimited
-
-export ZFS_ABORT=yes
+log_must eval "push_coredump_pattern \"$corepath\" > \"$coresavepath\""
+log_must export ZFS_ABORT=yes
for subcmd in "${cmds[@]}" "${badparams[@]}"; do
- zpool $subcmd >/dev/null 2>&1
- if [[ ! -e $corefile ]]; then
- log_fail "zpool $subcmd cannot generate core file with ZFS_ABORT set."
- fi
- rm -f $corefile
+ log_mustnot eval "zpool $subcmd"
+ log_must rm "$corefile"
done
-unset ZFS_ABORT
-
log_pass "With ZFS_ABORT set, zpool command can abort and generate core file as expected."
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool/zpool_003_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool/zpool_003_pos.ksh
index 6f15c09a5229..00f24bdff020 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool/zpool_003_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool/zpool_003_pos.ksh
@@ -46,15 +46,12 @@ function cleanup
{
unset ZFS_ABORT
- if is_freebsd && [ -n "$old_corefile" ]; then
- sysctl kern.corefile=$old_corefile
- fi
-
- rm -rf $corepath
+ log_must pop_coredump_pattern "$coresavepath"
+ log_must rm -rf $corepath
# Don't leave the pool frozen.
- destroy_pool $TESTPOOL
- default_mirror_setup $DISKS
+ log_must destroy_pool $TESTPOOL
+ log_must default_mirror_setup $DISKS
}
verify_runnable "both"
@@ -63,15 +60,14 @@ log_assert "Debugging features of zpool should succeed."
log_onexit cleanup
corepath=$TESTDIR/core
-corefile=$corepath/zpool.core
-if [[ -d $corepath ]]; then
- log_must rm -rf $corepath
-fi
+corefile=$corepath/core.zpool
+coresavepath=$corepath/save
+log_must rm -rf $corepath
log_must mkdir $corepath
log_must eval "zpool -? >/dev/null 2>&1"
-if is_global_zone ; then
+if is_global_zone; then
log_must zpool freeze $TESTPOOL
else
log_mustnot zpool freeze $TESTPOOL
@@ -80,21 +76,10 @@ fi
log_mustnot zpool freeze fakepool
-if is_linux; then
- echo $corefile >/proc/sys/kernel/core_pattern
- echo 0 >/proc/sys/kernel/core_uses_pid
-elif is_freebsd; then
- old_corefile=$(sysctl -n kern.corefile)
- log_must sysctl kern.corefile=$corefile
-fi
-ulimit -c unlimited
-
-export ZFS_ABORT=yes
-
-zpool >/dev/null 2>&1
-
-unset ZFS_ABORT
+log_must eval "push_coredump_pattern \"$corepath\" > \"$coresavepath\""
+log_must export ZFS_ABORT=yes
-[[ -f $corefile ]] || log_fail "zpool did not dump core by request."
+log_mustnot eval "zpool >/dev/null 2>&1"
+log_must [ -f "$corefile" ]
log_pass "Debugging features of zpool succeed."
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool/zpool_colors.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool/zpool_colors.ksh
index 8c7f40ba9c0b..b131bc708dbc 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool/zpool_colors.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool/zpool_colors.ksh
@@ -39,8 +39,7 @@ log_onexit cleanup
log_assert "Test colorized zpool status output"
-DISK2="$(echo $DISKS | cut -d' ' -f2)"
-DISK3="$(echo $DISKS | cut -d' ' -f3)"
+read -r _ DISK2 DISK3 _ <<<"$DISKS"
log_must dd if=/dev/urandom of=/$TESTDIR/testfile bs=10M count=1
@@ -62,16 +61,15 @@ log_note "$(faketty TERM=xterm-256color ZFS_COLOR=1 zpool status)"
# Replace the escape codes with "ESC" so they're easier to grep
out="$(faketty TERM=xterm-256color ZFS_COLOR=1 zpool status | \
- grep -E 'pool:|DEGRADED' | \
- sed -r 's/[[:space:]]+//g;'$(echo -e 's/\033/ESC/g'))"
+ sed -E '/pool:|DEGRADED/!d;s/[[:space:]]+//g;'$(printf 's/\033/ESC/g'))"
log_note "$(echo $out)"
log_note "Look for 'pool:' in bold"
-log_must eval "echo \"$out\" | grep -q 'ESC\[1mpool:ESC\[0m' "
+log_must grep -q 'ESC\[1mpool:ESC\[0m' <<<"$out"
log_note "Look for 'DEGRADED' in yellow"
-log_must eval "echo \"$out\" | grep -q 'ESC\[0;33mDEGRADEDESC\[0m'"
+log_must grep -q 'ESC\[0;33mDEGRADEDESC\[0m' <<<"$out"
#
# The escape code for 'FAULTED' is a little more tricky. The line starts like
@@ -83,9 +81,11 @@ log_must eval "echo \"$out\" | grep -q 'ESC\[0;33mDEGRADEDESC\[0m'"
# we can easily remove the vdev field to get what we want.
#
out="$(faketty TERM=xterm-256color ZFS_COLOR=1 zpool status \
- | awk '/FAULTED/{print $1$3$4}' | sed -r $(echo -e 's/\033/ESC/g'))"
+ | awk '/FAULTED/ {print $1$3$4}' | sed -E $(printf 's/\033/ESC/g'))"
+
+log_note "$(echo $out)"
log_note "Look for 'FAULTED' in red"
-log_must eval "echo \"$out\" | grep -q 'ESC\[0;31mFAULTEDESC\[0m'"
+log_must grep -q 'ESC\[0;31mFAULTEDESC\[0m' <<<"$out"
log_pass "zpool status displayed colors"
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_add/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_add/Makefile.am
deleted file mode 100644
index 8d54d13f7207..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_add/Makefile.am
+++ /dev/null
@@ -1,22 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zpool_add
-dist_pkgdata_SCRIPTS = \
- setup.ksh \
- cleanup.ksh \
- zpool_add_001_pos.ksh \
- zpool_add_002_pos.ksh \
- zpool_add_003_pos.ksh \
- zpool_add_004_pos.ksh \
- zpool_add_005_pos.ksh \
- zpool_add_006_pos.ksh \
- zpool_add_007_neg.ksh \
- zpool_add_008_neg.ksh \
- zpool_add_009_neg.ksh \
- zpool_add_010_pos.ksh \
- add-o_ashift.ksh \
- add_prop_ashift.ksh \
- add_nested_replacing_spare.ksh \
- zpool_add_dryrun_output.ksh
-
-dist_pkgdata_DATA = \
- zpool_add.cfg \
- zpool_add.kshlib
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_add/add-o_ashift.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_add/add-o_ashift.ksh
index 89cc4b0d3082..80a2213d9aa8 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_add/add-o_ashift.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_add/add-o_ashift.ksh
@@ -64,12 +64,8 @@ for ashift in ${ashifts[@]}
do
log_must zpool create $TESTPOOL $disk1
log_must zpool add -o ashift=$ashift $TESTPOOL $disk2
- verify_ashift $disk2 $ashift
- if [[ $? -ne 0 ]]
- then
- log_fail "Device was added without setting ashift value to "\
- "$ashift"
- fi
+ log_must verify_ashift $disk2 $ashift
+
# clean things for the next run
log_must zpool destroy $TESTPOOL
log_must zpool labelclear $disk1
@@ -81,12 +77,8 @@ do
log_must zpool create $TESTPOOL $disk1
log_must set_tunable64 VDEV_FILE_PHYSICAL_ASHIFT $ashift
log_must zpool add $TESTPOOL $disk2
- verify_ashift $disk2 $ashift
- if [[ $? -ne 0 ]]
- then
- log_fail "Device was added without setting ashift value to "\
- "$ashift"
- fi
+ log_must verify_ashift $disk2 $ashift
+
# clean things for the next run
log_must set_tunable64 VDEV_FILE_PHYSICAL_ASHIFT $orig_ashift
log_must zpool destroy $TESTPOOL
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_add/add_nested_replacing_spare.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_add/add_nested_replacing_spare.ksh
index 61f5f6d1ceed..677d0762eecb 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_add/add_nested_replacing_spare.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_add/add_nested_replacing_spare.ksh
@@ -90,10 +90,8 @@ do
log_must wait_vdev_state $TESTPOOL $REPLACE_DEV "ONLINE" 60
zpool status | awk -v poolname="$TESTPOOL" -v type="$type" 'BEGIN {s=""}
$1 ~ poolname {c=4}; (c && c--) { s=s$1":" }
- END { if (s != poolname":"type"-0:spare-0:replacing-0:") exit 1; }'
- if [[ $? -ne 0 ]]; then
+ END { if (s != poolname":"type"-0:spare-0:replacing-0:") exit 1; }' ||
log_fail "Pool does not contain nested replacing/spare vdevs"
- fi
# 3. Verify 'zpool add' is able to add new devices
log_must zpool add $TESTPOOL spare $SPARE_DEV2
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_add/add_prop_ashift.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_add/add_prop_ashift.ksh
index 4637fe0d84a3..df04ecc5b89e 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_add/add_prop_ashift.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_add/add_prop_ashift.ksh
@@ -70,12 +70,8 @@ for ashift in ${ashifts[@]}
do
log_must zpool create -o ashift=$ashift $TESTPOOL $disk1
log_must zpool add $TESTPOOL $disk2
- verify_ashift $disk2 $ashift
- if [[ $? -ne 0 ]]
- then
- log_fail "Device was added without setting ashift value to "\
- "$ashift"
- fi
+ log_must verify_ashift $disk2 $ashift
+
# clean things for the next run
log_must zpool destroy $TESTPOOL
log_must zpool labelclear $disk1
@@ -88,12 +84,8 @@ do
do
log_must zpool create -o ashift=$ashift $TESTPOOL $disk1
log_must zpool add -o ashift=$cmdval $TESTPOOL $disk2
- verify_ashift $disk2 $cmdval
- if [[ $? -ne 0 ]]
- then
- log_fail "Device was added without setting ashift " \
- "value to $cmdval"
- fi
+ log_must verify_ashift $disk2 $cmdval
+
# clean things for the next run
log_must zpool destroy $TESTPOOL
log_must zpool labelclear $disk1
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_add/zpool_add.kshlib b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_add/zpool_add.kshlib
index c64b4a35aa03..e10357340b40 100644
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_add/zpool_add.kshlib
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_add/zpool_add.kshlib
@@ -50,9 +50,8 @@ function find_vfstab_dev
#
function find_mnttab_dev
{
- typeset mnttabdev
+ typeset mnttabdev _
typeset mnttabdevs=""
- typeset line
if is_freebsd; then
# FreeBSD doesn't have a mnttab file.
@@ -61,21 +60,16 @@ function find_mnttab_dev
return 0
elif is_linux; then
typeset mnttab="/etc/mtab"
- typeset tmpfile="$TEST_BASE_DIR/mtab.tmp"
else
typeset mnttab="/etc/mnttab"
- typeset tmpfile="$TEST_BASE_DIR/mnttab.tmp"
fi
- cat $mnttab | grep "^${DEV_DSKDIR}" >$tmpfile
- while read -r line
+ while read -r mnttabdev _
do
- mnttabdev=`echo "$line" | awk '{print $1}'`
mnttabdev=${mnttabdev%%:}
mnttabdevs="$mnttabdev $mnttabdevs"
- done <$tmpfile
+ done < <(grep "^${DEV_DSKDIR}" $mnttab)
- rm -f $tmpfile
echo $mnttabdevs
}
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_add/zpool_add_003_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_add/zpool_add_003_pos.ksh
index a6b03ff3257f..3816444667cf 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_add/zpool_add_003_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_add/zpool_add_003_pos.ksh
@@ -90,8 +90,8 @@ done
log_must zpool add -f $TESTPOOL $config
zpool status $TESTPOOL | awk 'NR == 1, /NAME/ { next } /^$/ {exit}
{print $1}' > "$TMPFILE_PREFIX-vdevtree"
-cat "$TMPFILE_PREFIX-dryrun" | awk 'NR == 1, /would/ {next}
- /^$/ {next} {print $1}' > "$TMPFILE_PREFIX-vdevtree-n"
-log_must eval "diff $TMPFILE_PREFIX-vdevtree-n $TMPFILE_PREFIX-vdevtree"
+awk 'NR == 1, /would/ {next}
+ /^$/ {next} {print $1}' "$TMPFILE_PREFIX-dryrun" > "$TMPFILE_PREFIX-vdevtree-n"
+log_must diff $TMPFILE_PREFIX-vdevtree-n $TMPFILE_PREFIX-vdevtree
log_pass "'zpool add -n <pool> <vdev> ...' executes successfully."
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_attach/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_attach/Makefile.am
deleted file mode 100644
index cc742f33d2aa..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_attach/Makefile.am
+++ /dev/null
@@ -1,6 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zpool_attach
-dist_pkgdata_SCRIPTS = \
- setup.ksh \
- cleanup.ksh \
- zpool_attach_001_neg.ksh \
- attach-o_ashift.ksh
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_attach/attach-o_ashift.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_attach/attach-o_ashift.ksh
index 618c6992edb4..745f60507bed 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_attach/attach-o_ashift.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_attach/attach-o_ashift.ksh
@@ -69,23 +69,14 @@ do
for cmdval in ${ashifts[@]}
do
log_must zpool create -o ashift=$ashift $TESTPOOL1 $disk1
- verify_ashift $disk1 $ashift
- if [[ $? -ne 0 ]]
- then
- log_fail "Pool was created without setting ashift " \
- "value to $ashift"
- fi
+ log_must verify_ashift $disk1 $ashift
+
# ashift_of(attached_disk) <= ashift_of(existing_vdev)
if [[ $cmdval -le $ashift ]]
then
log_must zpool attach -o ashift=$cmdval $TESTPOOL1 \
$disk1 $disk2
- verify_ashift $disk2 $ashift
- if [[ $? -ne 0 ]]
- then
- log_fail "Device was attached without " \
- "setting ashift value to $ashift"
- fi
+ log_must verify_ashift $disk2 $ashift
else
log_mustnot zpool attach -o ashift=$cmdval $TESTPOOL1 \
$disk1 $disk2
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_clear/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_clear/Makefile.am
deleted file mode 100644
index 6986d38efc9d..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_clear/Makefile.am
+++ /dev/null
@@ -1,11 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zpool_clear
-dist_pkgdata_SCRIPTS = \
- setup.ksh \
- cleanup.ksh \
- zpool_clear_001_pos.ksh \
- zpool_clear_002_neg.ksh \
- zpool_clear_003_neg.ksh \
- zpool_clear_readonly.ksh
-
-dist_pkgdata_DATA = \
- zpool_clear.cfg
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_clear/zpool_clear_001_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_clear/zpool_clear_001_pos.ksh
index 1188ca10d14d..f1f926831baa 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_clear/zpool_clear_001_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_clear/zpool_clear_001_pos.ksh
@@ -50,9 +50,7 @@ function cleanup
poolexists $TESTPOOL1 && \
log_must zpool destroy -f $TESTPOOL1
- for file in `ls $TEST_BASE_DIR/file.*`; do
- log_must rm -f $file
- done
+ log_must rm -f $fbase.{0..2}
}
@@ -60,14 +58,8 @@ log_assert "Verify 'zpool clear' can clear errors of a storage pool."
log_onexit cleanup
#make raw files to create various configuration pools
-typeset -i i=0
-while (( i < 3 )); do
- log_must truncate -s $FILESIZE $TEST_BASE_DIR/file.$i
-
- (( i = i + 1 ))
-done
-
fbase=$TEST_BASE_DIR/file
+log_must truncate -s $FILESIZE $fbase.{0..2}
set -A poolconf "mirror $fbase.0 $fbase.1 $fbase.2" \
"raidz1 $fbase.0 $fbase.1 $fbase.2" \
"raidz2 $fbase.0 $fbase.1 $fbase.2"
@@ -75,59 +67,24 @@ set -A poolconf "mirror $fbase.0 $fbase.1 $fbase.2" \
function check_err # <pool> [<vdev>]
{
typeset pool=$1
- shift
- if (( $# > 0 )); then
- typeset checkvdev=$1
- else
- typeset checkvdev=""
- fi
- typeset -i errnum=0
- typeset c_read=0
- typeset c_write=0
- typeset c_cksum=0
- typeset tmpfile=$TEST_BASE_DIR/file.$$
- typeset healthstr="pool '$pool' is healthy"
- typeset output="`zpool status -x $pool`"
-
- [[ "$output" == "$healthstr" ]] && return $errnum
-
- zpool status -x $pool | grep -v "^$" | grep -v "pool:" \
- | grep -v "state:" | grep -v "config:" \
- | grep -v "errors:" > $tmpfile
- typeset line
- typeset -i fetchbegin=1
- while read line; do
- if (( $fetchbegin != 0 )); then
- echo $line | grep "NAME" >/dev/null 2>&1
- (( $? == 0 )) && (( fetchbegin = 0 ))
- continue
- fi
+ typeset checkvdev=$2
- if [[ -n $checkvdev ]]; then
- echo $line | grep $checkvdev >/dev/null 2>&1
- (( $? != 0 )) && continue
- c_read=`echo $line | awk '{print $3}'`
- c_write=`echo $line | awk '{print $4}'`
- c_cksum=`echo $line | awk '{print $5}'`
- if [ $c_read != 0 ] || [ $c_write != 0 ] || \
- [ $c_cksum != 0 ]
- then
- (( errnum = errnum + 1 ))
- fi
- break
- fi
+ [ "$(zpool status -x $pool)" = "pool '$pool' is healthy" ] && return
+
+ typeset -i skipstart=1
+ typeset vdev _ c_read c_write c_cksum rest
+ while read -r vdev _ c_read c_write c_cksum rest; do
+ if [ $skipstart -ne 0 ]; then
+ [ "$vdev" = "NAME" ] && skipstart=0
+ continue
+ fi
- c_read=`echo $line | awk '{print $3}'`
- c_write=`echo $line | awk '{print $4}'`
- c_cksum=`echo $line | awk '{print $5}'`
- if [ $c_read != 0 ] || [ $c_write != 0 ] || \
- [ $c_cksum != 0 ]
- then
- (( errnum = errnum + 1 ))
+ if [ -n "$checkvdev" ]; then
+ [ "$vdev" = "$checkvdev" ] || continue
fi
- done <$tmpfile
- return $errnum
+ [ $c_read$c_write$c_cksum = 000 ] || return
+ done < <(zpool status -x $pool | grep -ve "^$" -e "pool:" -e "state:" -e "config:" -e "errors:")
}
function do_testing #<clear type> <vdevs>
@@ -137,6 +94,7 @@ function do_testing #<clear type> <vdevs>
typeset type=$1
shift
typeset vdev="$@"
+ (( i = $RANDOM % 3 ))
log_must zpool create -f $TESTPOOL1 $vdev
log_must zfs create $FS
@@ -146,14 +104,13 @@ function do_testing #<clear type> <vdevs>
#
avail=$(get_prop available $FS)
fill_mb=$(((avail / 1024 / 1024) * 25 / 100))
- log_must dd if=/dev/urandom of=$file.$i bs=$BLOCKSZ count=$fill_mb
+ log_must dd if=/dev/urandom of=$file bs=$BLOCKSZ count=$fill_mb
#
# Make errors to the testing pool by overwrite the vdev device with
# dd command. We do not want to have a full overwrite. That
# may cause the system panic. So, we should skip the vdev label space.
#
- (( i = $RANDOM % 3 ))
typeset -i wcount=0
typeset -i size
case $FILESIZE in
@@ -173,25 +130,19 @@ function do_testing #<clear type> <vdevs>
(( wcount = FILESIZE/1024 - 512 ))
;;
esac
- dd if=/dev/zero of=$fbase.$i seek=512 bs=1024 count=$wcount conv=notrunc \
- > /dev/null 2>&1
+ dd if=/dev/zero of=$fbase.$i seek=512 bs=1024 count=$wcount conv=notrunc 2>/dev/null
sync_all_pools
log_must sync #ensure the vdev files are written out
log_must zpool scrub -w $TESTPOOL1
- check_err $TESTPOOL1 && \
- log_fail "No error generated."
- if [[ $type == "device" ]]; then
- log_must zpool clear $TESTPOOL1 $fbase.$i
- ! check_err $TESTPOOL1 $fbase.$i && \
- log_fail "'zpool clear' fails to clear error for $fbase.$i device."
+ log_mustnot check_err $TESTPOOL1
+ typeset dev=
+ if [ "$type" = "device" ]; then
+ dev=$fbase.$i
fi
- if [[ $type == "pool" ]]; then
- log_must zpool clear $TESTPOOL1
- ! check_err $TESTPOOL1 && \
- log_fail "'zpool clear' fails to clear error for pool $TESTPOOL1."
- fi
+ log_must zpool clear $TESTPOOL1 $dev
+ log_must check_err $TESTPOOL1 $dev
log_must zpool destroy $TESTPOOL1
}
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_create/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_create/Makefile.am
deleted file mode 100644
index 5ffaae5b152c..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_create/Makefile.am
+++ /dev/null
@@ -1,50 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zpool_create
-dist_pkgdata_SCRIPTS = \
- setup.ksh \
- cleanup.ksh \
- zpool_create_001_pos.ksh \
- zpool_create_002_pos.ksh \
- zpool_create_003_pos.ksh \
- zpool_create_004_pos.ksh \
- zpool_create_005_pos.ksh \
- zpool_create_006_pos.ksh \
- zpool_create_007_neg.ksh \
- zpool_create_008_pos.ksh \
- zpool_create_009_neg.ksh \
- zpool_create_010_neg.ksh \
- zpool_create_011_neg.ksh \
- zpool_create_012_neg.ksh \
- zpool_create_014_neg.ksh \
- zpool_create_015_neg.ksh \
- zpool_create_016_pos.ksh \
- zpool_create_017_neg.ksh \
- zpool_create_018_pos.ksh \
- zpool_create_019_pos.ksh \
- zpool_create_020_pos.ksh \
- zpool_create_021_pos.ksh \
- zpool_create_022_pos.ksh \
- zpool_create_023_neg.ksh \
- zpool_create_024_pos.ksh \
- zpool_create_encrypted.ksh \
- zpool_create_crypt_combos.ksh \
- zpool_create_draid_001_pos.ksh \
- zpool_create_draid_002_pos.ksh \
- zpool_create_draid_003_pos.ksh \
- zpool_create_draid_004_pos.ksh \
- zpool_create_features_001_pos.ksh \
- zpool_create_features_002_pos.ksh \
- zpool_create_features_003_pos.ksh \
- zpool_create_features_004_neg.ksh \
- zpool_create_features_005_pos.ksh \
- zpool_create_features_006_pos.ksh \
- zpool_create_features_007_pos.ksh \
- zpool_create_features_008_pos.ksh \
- zpool_create_features_009_pos.ksh \
- create-o_ashift.ksh \
- zpool_create_tempname.ksh \
- zpool_create_dryrun_output.ksh
-
-dist_pkgdata_DATA = \
- draidcfg.gz \
- zpool_create.cfg \
- zpool_create.shlib
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_create/create-o_ashift.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_create/create-o_ashift.ksh
index 2c1f6e0ca659..426321db06d6 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_create/create-o_ashift.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_create/create-o_ashift.ksh
@@ -59,8 +59,7 @@ function write_device_uberblocks # <device> <pool>
typeset device=$1
typeset pool=$2
- while [ "$(zdb -quuul $device | grep -c 'invalid')" -ne 0 ]
- do
+ while zdb -quuul $device | grep -q 'invalid'; do
sync_pool $pool true
done
}
@@ -89,8 +88,6 @@ function verify_device_uberblocks # <device> <count>
exit 1
}
}'
-
- return $?
}
log_assert "zpool create -o ashift=<n>' works with different ashift values"
@@ -114,11 +111,8 @@ do
"$ashift (current = $pprop)"
fi
write_device_uberblocks $disk $TESTPOOL
- verify_device_uberblocks $disk ${ubcount[$i]}
- if [[ $? -ne 0 ]]
- then
- log_fail "Pool was created with unexpected number of uberblocks"
- fi
+ log_must verify_device_uberblocks $disk ${ubcount[$i]}
+
# clean things for the next run
log_must zpool destroy $TESTPOOL
log_must zpool labelclear $disk
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create.shlib b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create.shlib
index 005cf979befa..9954bc23fc9f 100644
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create.shlib
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create.shlib
@@ -83,14 +83,9 @@ function find_vfstab_dev
#
function save_dump_dev
{
- typeset dumpdev=""
-
if is_illumos; then
- typeset fnd="Dump device"
- dumpdev=`dumpadm | grep "$fnd" | cut -f2 -d : | \
- awk '{print $1}'`
+ dumpadm | grep "Dump device" | cut -f2 -d : | awk '{print $1}'
fi
- echo $dumpdev
}
#
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_005_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_005_pos.ksh
index e1d8cc474545..98f469108b15 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_005_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_005_pos.ksh
@@ -90,8 +90,8 @@ do
$file.1 $file.2 $file.3 $file.4
! poolexists $TESTPOOL && \
log_fail "Creating pool with $opt fails."
- mpt=`zfs mount | egrep "^$TESTPOOL[^/]" | awk '{print $2}'`
- (( ${#mpt} == 0 )) && \
+ mpt=`zfs mount | awk -v pat="^$TESTPOOL[^/]" '$0 ~ pat {print $2}'`
+ [ -z "$mpt" ] && \
log_fail "$TESTPOOL created with $opt is not mounted."
mpt_val=$(get_prop "mountpoint" $TESTPOOL)
[[ "$mpt" != "$mpt_val" ]] && \
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_012_neg.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_012_neg.ksh
index 36888e497369..b9274c08b2ab 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_012_neg.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_012_neg.ksh
@@ -51,12 +51,11 @@ function cleanup
}
if is_freebsd; then
- typeset swap_disks=$(swapinfo -l | grep "/dev" | awk '{print $1}')
+ typeset swap_disks=$(swapinfo -l | awk '/\/dev/ {print $1}')
elif is_linux; then
- typeset swap_disks=`swapon -s | grep "/dev" | awk '{print $1}'`
+ typeset swap_disks=$(swapon -s | awk '/\/dev/ {print $1}')
else
- typeset swap_disks=`swap -l | grep "c[0-9].*d[0-9].*s[0-9]" | \
- awk '{print $1}'`
+ typeset swap_disks=$(swap -l | awk '/c[0-9].*d[0-9].*s[0-9]/ {print $1}')
fi
log_assert "'zpool create' should fail with disk slice in swap."
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_016_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_016_pos.ksh
index 1fa205b0f253..b3dd2cefc76c 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_016_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_016_pos.ksh
@@ -67,19 +67,17 @@ function cleanup
fi
}
-typeset swap_disks=$(swap -l | grep -v "swapfile" | awk '{print $1}')
-typeset dump_device=$(dumpadm | grep "Dump device" | awk '{print $3}')
+typeset swap_disks=$(swap -l | awk '!/swapfile/ {print $1}')
+typeset dump_device=$(dumpadm | awk '/Dump device/ {print $3}')
log_assert "'zpool create' should success with no device in swap."
log_onexit cleanup
for sdisk in $swap_disks; do
log_note "Executing: swap -d $sdisk"
- swap -d $sdisk >/dev/null 2>&1;
- if [[ $? != 0 ]]; then
+ swap -d $sdisk >/dev/null 2>&1 ||
log_untested "Unable to delete swap device $sdisk because of" \
"insufficient RAM"
- fi
done
log_must zpool create $TESTPOOL $DISK0
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_020_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_020_pos.ksh
index 104b5ec9868a..39097df2fb59 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_020_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_020_pos.ksh
@@ -75,25 +75,16 @@ log_must zpool get all $TESTPOOL
zpool get all $TESTPOOL > $values
# check for the cachefile property, verifying that it's set to 'none'
-grep "$TESTPOOL[ ]*cachefile[ ]*none" $values > /dev/null 2>&1
-if [ $? -ne 0 ]
-then
- log_fail "zpool property \'cachefile\' was not set to \'none\'."
-fi
+log_must grep -q "$TESTPOOL[ ]*cachefile[ ]*none" $values
# check that the root = /mountpoint property is set correctly
-grep "$TESTPOOL[ ]*altroot[ ]*/${TESTPOOL}.root" $values > /dev/null 2>&1
-if [ $? -ne 0 ]
-then
- log_fail "zpool property root was not found in pool output."
-fi
+log_must grep -q "$TESTPOOL[ ]*altroot[ ]*/${TESTPOOL}.root" $values
rm $values
# finally, check that the pool has no reference in /etc/zfs/zpool.cache
if [[ -f /etc/zfs/zpool.cache ]] ; then
- REF=$(strings /etc/zfs/zpool.cache | grep ${TESTPOOL})
- if [ ! -z "$REF" ]
+ if strings /etc/zfs/zpool.cache | grep -q ${TESTPOOL}
then
strings /etc/zfs/zpool.cache
log_fail "/etc/zfs/zpool.cache appears to have a reference to $TESTPOOL"
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_021_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_021_pos.ksh
index 655f887b60ad..264c75279d17 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_021_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_021_pos.ksh
@@ -49,12 +49,13 @@ verify_runnable "global"
function cleanup
{
datasetexists $TESTPOOL && destroy_pool $TESTPOOL
+ log_must rm -df "/tmp/mnt$$"
}
log_onexit cleanup
-log_assert "'zpool create -O property=value pool' can successfully create a pool \
- with correct filesystem property set."
+log_assert "'zpool create -O property=value pool' can successfully create a pool" \
+ "with correct filesystem property set."
set -A RW_FS_PROP "quota=536870912" \
"reservation=536870912" \
@@ -80,14 +81,11 @@ fi
typeset -i i=0
while (( $i < ${#RW_FS_PROP[*]} )); do
log_must zpool create -O ${RW_FS_PROP[$i]} -f $TESTPOOL $DISKS
- datasetexists $TESTPOOL || \
- log_fail "zpool create $TESTPOOL fail."
- propertycheck $TESTPOOL ${RW_FS_PROP[i]} || \
- log_fail "${RW_FS_PROP[i]} is failed to set."
+ log_must datasetexists $TESTPOOL
+ log_must propertycheck $TESTPOOL ${RW_FS_PROP[i]}
log_must zpool destroy $TESTPOOL
(( i = i + 1 ))
done
-log_pass "'zpool create -O property=value pool' can successfully create a pool \
- with correct filesystem property set."
-
+log_pass "'zpool create -O property=value pool' can successfully create a pool" \
+ "with correct filesystem property set."
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_022_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_022_pos.ksh
index 4a918c0a683a..717fcaa6ec51 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_022_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_022_pos.ksh
@@ -49,12 +49,13 @@ verify_runnable "global"
function cleanup
{
poolexists $TESTPOOL && destroy_pool $TESTPOOL
+ log_must rm -df "/tmp/mnt$$"
}
log_onexit cleanup
-log_assert "'zpool create -O property=value pool' can successfully create a pool \
- with multiple filesystem properties set."
+log_assert "'zpool create -O property=value pool' can successfully create a pool" \
+ "with multiple filesystem properties set."
set -A RW_FS_PROP "quota=536870912" \
"reservation=536870912" \
@@ -81,15 +82,13 @@ while (( $i < ${#RW_FS_PROP[*]} )); do
done
log_must zpool create $opts -f $TESTPOOL $DISKS
-datasetexists $TESTPOOL || log_fail "zpool create $TESTPOOL fail."
+log_must datasetexists $TESTPOOL
i=0
while (( $i < ${#RW_FS_PROP[*]} )); do
- propertycheck $TESTPOOL ${RW_FS_PROP[i]} || \
- log_fail "${RW_FS_PROP[i]} is failed to set."
+ log_must propertycheck $TESTPOOL ${RW_FS_PROP[i]}
(( i = i + 1 ))
done
-log_pass "'zpool create -O property=value pool' can successfully create a pool \
- with multiple filesystem properties set."
-
+log_pass "'zpool create -O property=value pool' can successfully create a pool" \
+ "with multiple filesystem properties set."
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_023_neg.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_023_neg.ksh
index f101521bd3e8..780cf86d6c5e 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_023_neg.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_023_neg.ksh
@@ -52,7 +52,7 @@ log_onexit cleanup
set -A args "QuOta=none" "quota=non" "quota=abcd" "quota=0" "quota=" \
"ResErVaTi0n=none" "reserV=none" "reservation=abcd" "reserv=" \
- "recorDSize=64k" "recordsize=2M" "recordsize=2048K" \
+ "recorDSize=64k" "recordsize=32M" "recordsize=32768K" \
"recordsize=256" "recsize=" "recsize=zero" "recordsize=0" \
"mountPoint=/tmp/tmpfile$$" "mountpoint=non0" "mountpoint=" \
"mountpoint=LEGACY" "mounpoint=none" \
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_024_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_024_pos.ksh
index 5b464c3c248b..3e3c9ce942b5 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_024_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_024_pos.ksh
@@ -74,24 +74,20 @@ child_pools=""
function zpool_stress
{
- typeset pool=$1
+ typeset pool="$1-$$"
typeset vdev0="$TEST_BASE_DIR/$pool-vdev0.img"
typeset vdev1="$TEST_BASE_DIR/$pool-vdev1.img"
typeset -i iters=$2
typeset retry=10
typeset j=0
- truncate -s $FILESIZE $vdev0
- truncate -s $FILESIZE $vdev1
+ truncate -s $FILESIZE $vdev0 $vdev1
while [[ $j -lt $iters ]]; do
((j = j + 1))
sleep 1
- zpool create $pool $vdev0 $vdev1
- if [ $? -ne 0 ]; then
- return 1;
- fi
+ zpool create $pool $vdev0 $vdev1 || return 1
# The 'zfs destroy' command is retried because it can
# transiently return EBUSY when blkid is concurrently
@@ -100,13 +96,8 @@ function zpool_stress
while [[ $k -lt $retry ]]; do
((k = k + 1))
- zpool destroy $pool
- if [ $? -eq 0 ]; then
- break;
- elif [ $k -eq $retry ]; then
- return 1;
- fi
-
+ zpool destroy $pool && break
+ [ $k -eq $retry ] && return 1
sleep 3
done
done
@@ -118,13 +109,11 @@ function zpool_stress
# 1. Create 128 process each of which create/destroy a pool 5 times.
typeset i=0
while [[ $i -lt 128 ]]; do
- typeset uuid=$(uuidgen | cut -c1-13)
-
- zpool_stress $TESTPOOL-$uuid 5 &
+ zpool_stress $TESTPOOL-$i 5 &
typeset pid=$!
child_pids="$child_pids $pid"
- child_pools="$child_pools $TESTPOOL-$uuid"
+ child_pools="$child_pools $TESTPOOL-$i-$pid"
((i = i + 1))
done
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_tempname.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_tempname.ksh
index 8fd1cea36e28..a75bdecff475 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_tempname.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_tempname.ksh
@@ -55,11 +55,9 @@ for poolprop in "${poolprops[@]}"; do
# 2. Verify the pool is created with the specified temporary name
log_must poolexists $TEMPPOOL
log_mustnot poolexists $TESTPOOL
- propname="$(awk -F= '{print $1}' <<< $fsprop)"
- propval="$(awk -F= '{print $2}' <<< $fsprop)"
+ IFS='=' read -r propname propval <<<"$fsprop"
log_must test "$(get_prop $propname $TEMPPOOL)" == "$propval"
- propname="$(awk -F= '{print $1}' <<< $poolprop)"
- propval="$(awk -F= '{print $2}' <<< $poolprop)"
+ IFS='=' read -r propname propval <<<"$poolprop"
log_must test "$(get_pool_prop $propname $TEMPPOOL)" == "$propval"
# Cleanup
destroy_pool $TEMPPOOL
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_destroy/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_destroy/Makefile.am
deleted file mode 100644
index 7f9e00d5826f..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_destroy/Makefile.am
+++ /dev/null
@@ -1,8 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zpool_destroy
-dist_pkgdata_SCRIPTS = \
- zpool_destroy_001_pos.ksh \
- zpool_destroy_002_pos.ksh \
- zpool_destroy_003_neg.ksh
-
-dist_pkgdata_DATA = \
- zpool_destroy.cfg
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_destroy/zpool_destroy.cfg b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_destroy/zpool_destroy.cfg
index bf6026747f9a..906cba700573 100644
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_destroy/zpool_destroy.cfg
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_destroy/zpool_destroy.cfg
@@ -28,7 +28,7 @@
# Copyright (c) 2012 by Delphix. All rights reserved.
#
-export DISK_ARRAY_NUM=$(echo ${DISKS} | nawk '{print NF}')
+export DISK_ARRAY_NUM=$(echo ${DISKS} | awk '{print NF}')
export DISKSARRAY=$DISKS
echo $DISKS | read DISK0 DISK1
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_detach/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_detach/Makefile.am
deleted file mode 100644
index b22018c1d550..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_detach/Makefile.am
+++ /dev/null
@@ -1,5 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zpool_detach
-dist_pkgdata_SCRIPTS = \
- setup.ksh \
- cleanup.ksh \
- zpool_detach_001_neg.ksh
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_events/.gitignore b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_events/.gitignore
deleted file mode 100644
index a1f8c14838fa..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_events/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/ereports
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_events/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_events/Makefile.am
deleted file mode 100644
index 765df102229d..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_events/Makefile.am
+++ /dev/null
@@ -1,26 +0,0 @@
-include $(top_srcdir)/config/Rules.am
-
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zpool_events
-pkgexecdir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zpool_events
-
-dist_pkgdata_SCRIPTS = \
- setup.ksh \
- cleanup.ksh \
- zpool_events_clear.ksh \
- zpool_events_cliargs.ksh \
- zpool_events_follow.ksh \
- zpool_events_poolname.ksh \
- zpool_events_errors.ksh \
- zpool_events_duplicates.ksh \
- zpool_events_clear_retained.ksh
-
-dist_pkgdata_DATA = \
- zpool_events.cfg \
- zpool_events.kshlib
-
-ereports_LDADD = \
- $(abs_top_builddir)/lib/libnvpair/libnvpair.la \
- $(abs_top_builddir)/lib/libzfs/libzfs.la
-
-pkgexec_PROGRAMS = ereports
-ereports_SOURCES = ereports.c
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_events/ereports.c b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_events/ereports.c
deleted file mode 100644
index bff3bb1ee808..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_events/ereports.c
+++ /dev/null
@@ -1,173 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * This file and its contents are supplied under the terms of the
- * Common Development and Distribution License ("CDDL"), version 1.0.
- * You may only use this file in accordance with the terms of version
- * 1.0 of the CDDL.
- *
- * A full copy of the text of the CDDL should have accompanied this
- * source. A copy of the CDDL is also available via the Internet at
- * http://www.illumos.org/license/CDDL.
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright (c) 2020 by Delphix. All rights reserved.
- */
-
-#include <assert.h>
-#include <fcntl.h>
-#include <stdio.h>
-#include <libzfs.h>
-#include <sys/zfs_ioctl.h>
-#include <sys/nvpair.h>
-#include <sys/fm/protocol.h>
-#include <sys/fm/fs/zfs.h>
-
-/*
- * Command to output io and checksum ereport values, one per line.
- * Used by zpool_events_duplicates.ksh to check for duplicate events.
- *
- * example output line:
- *
- * checksum "error_pool" 0x856dd01ce52e336 0x000034 0x000400 0x000a402c00
- * 0x000004 0x000000 0x000000 0x000000 0x000001
- */
-
-/*
- * Our ereport duplicate criteria
- *
- * When the class and all of these values match, then an ereport is
- * considered to be a duplicate.
- */
-static const char *criteria_name[] = {
- FM_EREPORT_PAYLOAD_ZFS_POOL,
- FM_EREPORT_PAYLOAD_ZFS_VDEV_GUID,
- FM_EREPORT_PAYLOAD_ZFS_ZIO_ERR,
- FM_EREPORT_PAYLOAD_ZFS_ZIO_SIZE,
- FM_EREPORT_PAYLOAD_ZFS_ZIO_OFFSET,
- FM_EREPORT_PAYLOAD_ZFS_ZIO_PRIORITY,
-
- /* logical zio criteriai (optional) */
- FM_EREPORT_PAYLOAD_ZFS_ZIO_OBJSET,
- FM_EREPORT_PAYLOAD_ZFS_ZIO_OBJECT,
- FM_EREPORT_PAYLOAD_ZFS_ZIO_BLKID,
- FM_EREPORT_PAYLOAD_ZFS_ZIO_LEVEL,
-};
-
-#define CRITERIA_NAMES_COUNT ARRAY_SIZE(criteria_name)
-
-static void
-print_ereport_line(nvlist_t *nvl)
-{
- char *class;
- int last = CRITERIA_NAMES_COUNT - 1;
-
- /*
- * For the test case context, we only want to see 'io' and
- * 'checksum' subclass. We skip 'data' to minimize the output.
- */
- if (nvlist_lookup_string(nvl, FM_CLASS, &class) != 0 ||
- strstr(class, "ereport.fs.zfs.") == NULL ||
- strcmp(class, "ereport.fs.zfs.data") == 0) {
- return;
- }
-
- (void) printf("%s\t", class + strlen("ereport.fs.zfs."));
-
- for (int i = 0; i < CRITERIA_NAMES_COUNT; i++) {
- nvpair_t *nvp;
- uint32_t i32 = 0;
- uint64_t i64 = 0;
- char *str = NULL;
-
- if (nvlist_lookup_nvpair(nvl, criteria_name[i], &nvp) != 0) {
- /* print a proxy for optional criteria */
- (void) printf("--------");
- (void) printf("%c", i == last ? '\n' : '\t');
- continue;
- }
-
- switch (nvpair_type(nvp)) {
- case DATA_TYPE_STRING:
- (void) nvpair_value_string(nvp, &str);
- (void) printf("\"%s\"", str ? str : "<NULL>");
- break;
-
- case DATA_TYPE_INT32:
- (void) nvpair_value_int32(nvp, (void *)&i32);
- (void) printf("0x%06x", i32);
- break;
-
- case DATA_TYPE_UINT32:
- (void) nvpair_value_uint32(nvp, &i32);
- (void) printf("0x%06x", i32);
- break;
-
- case DATA_TYPE_INT64:
- (void) nvpair_value_int64(nvp, (void *)&i64);
- (void) printf("0x%06llx", (u_longlong_t)i64);
- break;
-
- case DATA_TYPE_UINT64:
- (void) nvpair_value_uint64(nvp, &i64);
- if (strcmp(FM_EREPORT_PAYLOAD_ZFS_ZIO_OFFSET,
- criteria_name[i]) == 0)
- (void) printf("0x%010llx", (u_longlong_t)i64);
- else
- (void) printf("0x%06llx", (u_longlong_t)i64);
- break;
- default:
- (void) printf("<unknown>");
- break;
- }
- (void) printf("%c", i == last ? '\n' : '\t');
- }
-}
-
-static void
-ereports_dump(libzfs_handle_t *zhdl, int zevent_fd)
-{
- nvlist_t *nvl;
- int ret, dropped;
-
- while (1) {
- ret = zpool_events_next(zhdl, &nvl, &dropped, ZEVENT_NONBLOCK,
- zevent_fd);
- if (ret || nvl == NULL)
- break;
- if (dropped > 0)
- (void) fprintf(stdout, "dropped %d events\n", dropped);
- print_ereport_line(nvl);
- (void) fflush(stdout);
- nvlist_free(nvl);
- }
-}
-
-int
-main(void)
-{
- libzfs_handle_t *hdl;
- int fd;
-
- hdl = libzfs_init();
- if (hdl == NULL) {
- (void) fprintf(stderr, "libzfs_init: %s\n", strerror(errno));
- exit(2);
- }
- fd = open(ZFS_DEV, O_RDWR);
- if (fd < 0) {
- (void) fprintf(stderr, "open: %s\n", strerror(errno));
- libzfs_fini(hdl);
- exit(2);
- }
-
- ereports_dump(hdl, fd);
-
- (void) close(fd);
- libzfs_fini(hdl);
-
- return (0);
-}
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_events/zpool_events_clear_retained.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_events/zpool_events_clear_retained.ksh
index 22212a8f50a5..c16094f54038 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_events/zpool_events_clear_retained.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_events/zpool_events_clear_retained.ksh
@@ -55,8 +55,6 @@ OLD_LEN_MAX=$(get_tunable ZEVENT_LEN_MAX)
RETAIN_MAX=$(get_tunable ZEVENT_RETAIN_MAX)
OLD_CHECKSUMS=$(get_tunable CHECKSUM_EVENTS_PER_SECOND)
-EREPORTS="$STF_SUITE/tests/functional/cli_root/zpool_events/ereports"
-
function cleanup
{
log_must set_tunable64 CHECKSUM_EVENTS_PER_SECOND $OLD_CHECKSUMS
@@ -66,7 +64,7 @@ function cleanup
if poolexists $POOL ; then
zpool export $POOL
fi
- log_must rm -f $VDEV1 $VDEV2 $VDEV3
+ log_must rm -fd $VDEV1 $VDEV2 $VDEV3 $SUPPLY $MOUNTDIR
}
function damage_and_repair
@@ -78,9 +76,9 @@ function damage_and_repair
log_must dd conv=notrunc if=$SUPPLY of=$VDEV1 bs=1M seek=4 count=$DAMAGEBLKS
log_must zpool scrub $POOL
log_must zpool wait -t scrub $POOL
- log_note "pass $1 observed $($EREPORTS | grep -c checksum) checksum ereports"
+ log_note "pass $1 observed $(ereports | grep -c checksum) checksum ereports"
- repaired=$(zpool status $POOL | grep "scan: scrub repaired" | awk '{print $4}')
+ repaired=$(zpool status $POOL | awk '/scan: scrub repaired/ {print $4}')
if [ "$repaired" == "0B" ]; then
log_fail "INVALID TEST -- expected scrub to repair some blocks"
else
@@ -90,7 +88,7 @@ function damage_and_repair
function checksum_error_count
{
- zpool status -p $POOL | grep $VDEV1 | awk '{print $5}'
+ zpool status -p $POOL | awk -v dev=$VDEV1 '$0 ~ dev {print $5}'
}
assertion="Damage to recently repaired blocks should be reported/counted"
@@ -132,4 +130,3 @@ else
log_note observed $errcnt new checksum errors after a scrub
log_pass "$assertion"
fi
-
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_events/zpool_events_cliargs.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_events/zpool_events_cliargs.ksh
index 1623a18e4740..27e2cf0ba472 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_events/zpool_events_cliargs.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_events/zpool_events_cliargs.ksh
@@ -37,7 +37,7 @@ function log_must_follow # <command>
sleep 3
kill $pid
if [[ $? -ne 0 ]]; then
- log_fail "'$command' does not work as expected."
+ log_fail "'$command' exited early."
else
log_note "'$command' works successfully."
fi
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_events/zpool_events_duplicates.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_events/zpool_events_duplicates.ksh
index 7023c49e51f2..9097ac008334 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_events/zpool_events_duplicates.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_events/zpool_events_duplicates.ksh
@@ -46,8 +46,6 @@ FILESIZE="10M"
OLD_LEN_MAX=$(get_tunable ZEVENT_LEN_MAX)
RETAIN_MAX=$(get_tunable ZEVENT_RETAIN_MAX)
-EREPORTS="$STF_SUITE/tests/functional/cli_root/zpool_events/ereports"
-
duplicates=false
function cleanup
@@ -58,7 +56,7 @@ function cleanup
if poolexists $POOL ; then
destroy_pool $POOL
fi
- log_must rm -f $VDEV1 $VDEV2
+ log_must rm -fd $VDEV1 $VDEV2 $MOUNTDIR
}
log_assert "Duplicate I/O ereport errors are not posted"
@@ -103,7 +101,7 @@ function do_dup_test
# Read the file a few times to generate some
# duplicate errors of the same blocks
for _ in {1..15}; do
- dd if=$FILEPATH of=/dev/null bs=128K > /dev/null 2>&1
+ dd if=$FILEPATH of=/dev/null bs=128K 2>/dev/null
done
log_must zinject -c all
fi
@@ -117,7 +115,7 @@ function do_dup_test
log_must zinject -c all
- ereports="$($EREPORTS | sort)"
+ ereports="$(ereports | sort)"
actual=$(echo "$ereports" | wc -l)
unique=$(echo "$ereports" | uniq | wc -l)
log_note "$actual total $ERR $RW ereports where $unique were unique"
@@ -140,4 +138,3 @@ if $duplicates; then
else
log_pass "Duplicate I/O ereport errors are not posted"
fi
-
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_events/zpool_events_errors.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_events/zpool_events_errors.ksh
index f26c65f9db2c..82a1a1131f06 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_events/zpool_events_errors.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_events/zpool_events_errors.ksh
@@ -59,7 +59,7 @@ function cleanup
if poolexists $POOL ; then
log_must destroy_pool $POOL
fi
- log_must rm -f $VDEV1 $VDEV2 $VDEV3
+ log_must rm -fd $VDEV1 $VDEV2 $VDEV3 $MOUNTDIR
}
log_assert "Check that the number of zpool errors match the number of events"
@@ -115,7 +115,7 @@ function do_test
out="$(zpool status -p | grep $VDEV1)"
if [ "$ERR" == "corrupt" ] ; then
- events=$(zpool events | grep checksum | wc -l)
+ events=$(zpool events | grep -c checksum)
val=$(echo "$out" | awk '{print $5}')
str="checksum"
elif [ "$ERR" == "io" ] ; then
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_events/zpool_events_follow.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_events/zpool_events_follow.ksh
index 258de033b86c..3311eb546676 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_events/zpool_events_follow.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_events/zpool_events_follow.ksh
@@ -49,14 +49,14 @@ log_must eval "zpool events -H -f > $EVENTS_FILE &"
pid=$!
# 3. Generate some ZFS events
-for i in `seq 1 $EVENTS_NUM`; do
+for i in {1..$EVENTS_NUM}; do
log_must zpool clear $TESTPOOL
done
# wait a bit to allow the kernel module to process new events
zpool_events_settle
# 4. Verify 'zpool events -f' successfully recorded these new events
-EVENTS_LOG=$(cat $EVENTS_FILE | wc -l)
+EVENTS_LOG=$(wc -l < $EVENTS_FILE)
if [[ $EVENTS_LOG -ne $EVENTS_NUM ]]; then
log_fail "Unexpected number of events: $EVENTS_LOG != $EVENTS_NUM"
fi
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_events/zpool_events_poolname.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_events/zpool_events_poolname.ksh
index 42c46712f3d9..0e3829fcc8d8 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_events/zpool_events_poolname.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_events/zpool_events_poolname.ksh
@@ -50,10 +50,8 @@ log_must zpool create $NEWPOOL $DISK
log_must zpool events -c
# 3. Generate some ZFS events on both pools
-for i in `seq 1 $EVENTS_NUM`; do
+for i in {1..$EVENTS_NUM}; do
log_must zpool clear $TESTPOOL
-done
-for i in `seq 1 $EVENTS_NUM`; do
log_must zpool clear $NEWPOOL
done
# wait a bit to allow the kernel module to process new events
@@ -61,14 +59,11 @@ zpool_events_settle
# 4. Verify 'zpool events poolname' successfully display events
zpool events -v $TESTPOOL |
- awk -v POOL=$TESTPOOL '/pool = / {if ($3 != "\""POOL"\"") exit 1}'
-if [[ $? -ne 0 ]]; then
+ awk -v POOL=$TESTPOOL '/pool = / && $3 != "\""POOL"\"" {exit 1}' ||
log_fail "Unexpected events for pools other than $TESTPOOL"
-fi
+
zpool events -v $NEWPOOL |
- awk -v POOL=$NEWPOOL '/pool = / {if ($3 != "\""POOL"\"") exit 1}'
-if [[ $? -ne 0 ]]; then
+ awk -v POOL=$NEWPOOL '/pool = / && $3 != "\""POOL"\"" {exit 1}' ||
log_fail "Unexpected events for pools other than $NEWPOOL"
-fi
log_pass "'zpool events poolname' display events only from the chosen pool."
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_expand/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_expand/Makefile.am
deleted file mode 100644
index beaa411e37cb..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_expand/Makefile.am
+++ /dev/null
@@ -1,12 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zpool_expand
-dist_pkgdata_SCRIPTS = \
- setup.ksh \
- cleanup.ksh \
- zpool_expand_001_pos.ksh \
- zpool_expand_002_pos.ksh \
- zpool_expand_003_neg.ksh \
- zpool_expand_004_pos.ksh \
- zpool_expand_005_pos.ksh
-
-dist_pkgdata_DATA = \
- zpool_expand.cfg
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_expand/zpool_expand_001_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_expand/zpool_expand_001_pos.ksh
index 6bbd46289f7c..c49777e6b3c4 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_expand/zpool_expand_001_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_expand/zpool_expand_001_pos.ksh
@@ -128,7 +128,7 @@ for type in " " mirror raidz draid:1s; do
typeset size_addition=$(zpool history -il $TESTPOOL1 |\
grep "pool '$TESTPOOL1' size:" | \
grep "vdev online" | \
- grep "(+${expansion_size}" | wc -l)
+ grep -c "(+${expansion_size}")
if [[ $size_addition -ne 3 ]]; then
log_fail "pool $TESTPOOL1 has not expanded, " \
@@ -139,31 +139,22 @@ for type in " " mirror raidz draid:1s; do
zpool history -il $TESTPOOL1 | \
grep "pool '$TESTPOOL1' size:" | \
grep "vdev online" | \
- grep "(+${expansion_size})" >/dev/null 2>&1
-
- if [[ $? -ne 0 ]] ; then
+ grep -q "(+${expansion_size})" ||
log_fail "pool $TESTPOOL1 has not expanded"
- fi
elif [[ $type == "draid:1s" ]]; then
typeset expansion_size=$((2*($exp_size-$org_size)))
zpool history -il $TESTPOOL1 | \
grep "pool '$TESTPOOL1' size:" | \
grep "vdev online" | \
- grep "(+${expansion_size})" >/dev/null 2>&1
-
- if [[ $? -ne 0 ]]; then
- log_fail "pool $TESTPOOL has not expanded"
- fi
+ grep -q "(+${expansion_size})" ||
+ log_fail "pool $TESTPOOL has not expanded"
else
typeset expansion_size=$((3*($exp_size-$org_size)))
zpool history -il $TESTPOOL1 | \
grep "pool '$TESTPOOL1' size:" | \
grep "vdev online" | \
- grep "(+${expansion_size})" >/dev/null 2>&1
-
- if [[ $? -ne 0 ]]; then
- log_fail "pool $TESTPOOL has not expanded"
- fi
+ grep -q "(+${expansion_size})" ||
+ log_fail "pool $TESTPOOL has not expanded"
fi
else
log_fail "pool $TESTPOOL1 is not autoexpanded after vdev " \
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_expand/zpool_expand_002_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_expand/zpool_expand_002_pos.ksh
index 62843b062291..ccd266c727be 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_expand/zpool_expand_002_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_expand/zpool_expand_002_pos.ksh
@@ -131,7 +131,7 @@ for type in " " mirror raidz draid:1s; do
typeset size_addition=$(zpool history -il $TESTPOOL1 \
| grep "pool '$TESTPOOL1' size:" | \
grep "vdev online" | \
- grep "(+${expansion_size}" | wc -l)
+ grep -c "(+${expansion_size}")
if [[ $size_addition -ne $i ]]; then
log_fail "pool $TESTPOOL1 has not expanded " \
@@ -143,34 +143,25 @@ for type in " " mirror raidz draid:1s; do
zpool history -il $TESTPOOL1 | \
grep "pool '$TESTPOOL1' size:" | \
grep "vdev online" | \
- grep "(+${expansion_size})" >/dev/null 2>&1
-
- if [[ $? -ne 0 ]]; then
- log_fail "pool $TESTPOOL1 has not expanded " \
- "after zpool online -e"
- fi
+ grep -q "(+${expansion_size})" ||
+ log_fail "pool $TESTPOOL1 has not expanded " \
+ "after zpool online -e"
elif [[ $type == "draid:1s" ]]; then
typeset expansion_size=$((2*($exp_size-$org_size)))
zpool history -il $TESTPOOL1 | \
grep "pool '$TESTPOOL1' size:" | \
grep "vdev online" | \
- grep "(+${expansion_size})" >/dev/null 2>&1
-
- if [[ $? -ne 0 ]] ; then
- log_fail "pool $TESTPOOL1 has not expanded " \
- "after zpool online -e"
- fi
+ grep -q "(+${expansion_size})" ||
+ log_fail "pool $TESTPOOL1 has not expanded " \
+ "after zpool online -e"
else
typeset expansion_size=$((3*($exp_size-$org_size)))
zpool history -il $TESTPOOL1 | \
grep "pool '$TESTPOOL1' size:" | \
grep "vdev online" | \
- grep "(+${expansion_size})" >/dev/null 2>&1
-
- if [[ $? -ne 0 ]] ; then
- log_fail "pool $TESTPOOL1 has not expanded " \
- "after zpool online -e"
- fi
+ grep -q "(+${expansion_size})" ||
+ log_fail "pool $TESTPOOL1 has not expanded " \
+ "after zpool online -e"
fi
else
log_fail "pool $TESTPOOL1 did not expand after vdev " \
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_expand/zpool_expand_003_neg.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_expand/zpool_expand_003_neg.ksh
index b3c71b666a59..5bd8b56ffd0d 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_expand/zpool_expand_003_neg.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_expand/zpool_expand_003_neg.ksh
@@ -39,7 +39,6 @@
# Once set zpool autoexpand=off, zpool can *NOT* autoexpand by
# Dynamic VDEV Expansion
#
-#
# STRATEGY:
# 1) Create three vdevs (loopback, scsi_debug, and file)
# 2) Create pool by using the different devices and set autoexpand=off
@@ -73,7 +72,7 @@ log_onexit cleanup
log_assert "zpool can not expand if set autoexpand=off after vdev expansion"
-for type in " " mirror raidz draid; do
+for type in "" mirror raidz draid; do
log_note "Setting up loopback, scsi_debug, and file vdevs"
log_must truncate -s $org_size $FILE_LO
DEV1=$(losetup -f)
@@ -89,11 +88,7 @@ for type in " " mirror raidz draid; do
# The -f is required since we're mixing disk and file vdevs.
log_must zpool create -f $TESTPOOL1 $type $DEV1 $DEV2 $DEV3
- typeset autoexp=$(get_pool_prop autoexpand $TESTPOOL1)
- if [[ $autoexp != "off" ]]; then
- log_fail "zpool $TESTPOOL1 autoexpand should be off but is " \
- "$autoexp"
- fi
+ log_must [ "$(get_pool_prop autoexpand $TESTPOOL1)" = "off" ]
typeset prev_size=$(get_pool_prop size $TESTPOOL1)
@@ -107,8 +102,8 @@ for type in " " mirror raidz draid; do
log_must losetup -c $DEV1
sleep 3
- echo "2" > /sys/bus/pseudo/drivers/scsi_debug/virtual_gb
- echo "1" > /sys/class/block/$DEV2/device/rescan
+ log_must eval "echo 2 > /sys/bus/pseudo/drivers/scsi_debug/virtual_gb"
+ log_must eval "echo 1 > /sys/class/block/$DEV2/device/rescan"
block_device_wait
sleep 3
@@ -118,19 +113,11 @@ for type in " " mirror raidz draid; do
sleep 5
# check for zpool history for the pool size expansion
- zpool history -il $TESTPOOL1 | grep "pool '$TESTPOOL1' size:" | \
- grep "vdev online" >/dev/null 2>&1
-
- if [[ $? -eq 0 ]]; then
- log_fail "pool $TESTPOOL1 is not autoexpand after vdev " \
- "expansion"
- fi
-
- typeset expand_size=$(get_pool_prop size $TESTPOOL1)
+ zpool history -il $TESTPOOL1 | grep "pool '$TESTPOOL1' size:" |
+ grep "vdev online" &&
+ log_fail "pool $TESTPOOL1 is not autoexpand after vdev expansion"
- if [[ "$prev_size" != "$expand_size" ]]; then
- log_fail "pool $TESTPOOL1 size changed after vdev expansion"
- fi
+ log_must [ "$(get_pool_prop size $TESTPOOL1)" = "$prev_size" ]
cleanup
done
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_export/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_export/Makefile.am
deleted file mode 100644
index 1c06d5b59e9b..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_export/Makefile.am
+++ /dev/null
@@ -1,12 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zpool_export
-dist_pkgdata_SCRIPTS = \
- setup.ksh \
- cleanup.ksh \
- zpool_export_001_pos.ksh \
- zpool_export_002_pos.ksh \
- zpool_export_003_neg.ksh \
- zpool_export_004_pos.ksh
-
-dist_pkgdata_DATA = \
- zpool_export.cfg \
- zpool_export.kshlib
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_export/zpool_export.cfg b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_export/zpool_export.cfg
index 8bfb067c7aac..349399263da8 100644
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_export/zpool_export.cfg
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_export/zpool_export.cfg
@@ -30,9 +30,9 @@
. $STF_SUITE/include/libtest.shlib
-export DISK_ARRAY_NUM=$(echo ${DISKS} | nawk '{print NF}')
-export DISK1=$(echo $DISKS | awk '{print $1}')
-export DISK2=$(echo $DISKS | awk '{print $3}')
+export DISK_ARRAY_NUM=$(echo ${DISKS} | awk '{print NF}')
+read -r DISK1 _ DISK2 _ <<<"$DISKS"
+export DISK1 DISK2
if is_linux; then
set_slice_prefix
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_export/zpool_export_002_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_export/zpool_export_002_pos.ksh
index 8040d12b92d2..913a4cd6a34c 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_export/zpool_export_002_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_export/zpool_export_002_pos.ksh
@@ -45,9 +45,7 @@ verify_runnable "global"
function cleanup
{
- cd $olddir || \
- log_fail "Couldn't cd back to $olddir"
-
+ log_must cd $olddir
zpool_export_cleanup
}
@@ -57,16 +55,9 @@ log_onexit cleanup
log_assert "Verify a busy ZPOOL cannot be exported."
-ismounted "$TESTPOOL/$TESTFS"
-(( $? != 0 )) && \
- log_fail "$TESTDIR not mounted. Unable to continue."
-
-cd $TESTDIR || \
- log_fail "Couldn't cd to $TESTDIR"
-
+log_must ismounted "$TESTPOOL/$TESTFS"
+log_must cd $TESTDIR
log_mustnot zpool export $TESTPOOL
-
-poolexists $TESTPOOL || \
- log_fail "$TESTPOOL not found in 'zpool list' output."
+log_must poolexists $TESTPOOL
log_pass "Unable to export a busy ZPOOL as expected."
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_get/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_get/Makefile.am
deleted file mode 100644
index 0c87c9b37763..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_get/Makefile.am
+++ /dev/null
@@ -1,12 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zpool_get
-dist_pkgdata_SCRIPTS = \
- setup.ksh \
- cleanup.ksh \
- zpool_get_001_pos.ksh \
- zpool_get_002_pos.ksh \
- zpool_get_003_pos.ksh \
- zpool_get_004_neg.ksh \
- zpool_get_005_pos.ksh
-
-dist_pkgdata_DATA = \
- zpool_get.cfg zpool_get_parsable.cfg
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_get/zpool_get.cfg b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_get/zpool_get.cfg
index fac96e26e460..4ea5725e040e 100644
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_get/zpool_get.cfg
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_get/zpool_get.cfg
@@ -98,5 +98,6 @@ if is_linux || is_freebsd; then
"feature@livelist"
"feature@zstd_compress"
"feature@zilsaxattr"
+ "feature@head_errlog"
)
-fi \ No newline at end of file
+fi
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_get/zpool_get_002_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_get/zpool_get_002_pos.ksh
index ba83fadb06f1..de39aa260f61 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_get/zpool_get_002_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_get/zpool_get_002_pos.ksh
@@ -66,29 +66,20 @@ log_must zpool get all $TESTPOOL
zpool get all $TESTPOOL > $values
log_note "Checking zpool get all output for a header."
-grep ^"NAME " $values > /dev/null 2>&1
-if [ $? -ne 0 ]
-then
- log_fail "The header was not printed from zpool get all"
-fi
+log_must grep -q ^"NAME " $values
while [ $i -lt "${#properties[@]}" ]
do
log_note "Checking for ${properties[$i]} property"
- grep "$TESTPOOL *${properties[$i]}" $values > /dev/null 2>&1
- if [ $? -ne 0 ]
- then
- log_fail "zpool property ${properties[$i]} was not found\
- in pool output."
- fi
+ log_must grep -q "$TESTPOOL *${properties[$i]}" $values
i=$(( $i + 1 ))
done
# increment the counter to include the header line
i=$(( $i + 1 ))
-COUNT=$(wc $values | awk '{print $1}')
+COUNT=$(wc -l < $values)
if [ $i -ne $COUNT ]
then
log_fail "Found zpool features not in the zpool_get test config $i/$COUNT."
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_get/zpool_get_003_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_get/zpool_get_003_pos.ksh
index 89fca9cbd485..7c2e214b7da0 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_get/zpool_get_003_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_get/zpool_get_003_pos.ksh
@@ -60,14 +60,10 @@ while [ $i -lt "${#properties[@]}" ]
do
log_note "Checking for ${properties[$i]} property"
log_must eval "zpool get ${properties[$i]} $TESTPOOL > $values"
- grep "${properties[$i]}" $values > /dev/null 2>&1
- if [ $? -ne 0 ]
- then
- log_fail "${properties[$i]} not seen in output"
- fi
- grep "^NAME " $values > /dev/null 2>&1
+ log_must grep -q "${properties[$i]}" $values
+
# only need to check this once.
- if [ $i -eq 0 ] && [ $? -ne 0 ]
+ if [ $i -eq 0 ] && ! grep -q "^NAME " $values
then
log_fail "Header not seen in zpool get output"
fi
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_get/zpool_get_005_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_get/zpool_get_005_pos.ksh
index ad27d180fdb1..4481dab69f7b 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_get/zpool_get_005_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_get/zpool_get_005_pos.ksh
@@ -50,14 +50,9 @@ typeset -i i=0
while [[ $i -lt "${#properties[@]}" ]]; do
log_note "Checking for parsable ${properties[$i]} property"
log_must eval "zpool get -p ${properties[$i]} $TESTPOOL >/tmp/value.$$"
- grep "${properties[$i]}" /tmp/value.$$ >/dev/null 2>&1
- if [[ $? -ne 0 ]]; then
- log_fail "${properties[$i]} not seen in output"
- fi
-
- typeset v=$(grep "${properties[$i]}" /tmp/value.$$ | awk '{print $3}')
+ log_must grep -q "${properties[$i]}" /tmp/value.$$
- log_note "${properties[$i]} has a value of $v"
+ typeset v=$(awk -v p="${properties[$i]}" '$0 ~ p {print $3}' /tmp/value.$$)
# Determine if this value is a valid number, result in return code
log_must test -n "$v"
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_history/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_history/Makefile.am
deleted file mode 100644
index 8755f8f6c8a9..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_history/Makefile.am
+++ /dev/null
@@ -1,6 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zpool_history
-dist_pkgdata_SCRIPTS = \
- setup.ksh \
- cleanup.ksh \
- zpool_history_001_neg.ksh \
- zpool_history_002_pos.ksh
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_import/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_import/Makefile.am
deleted file mode 100644
index a8c9a31dcfdc..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_import/Makefile.am
+++ /dev/null
@@ -1,51 +0,0 @@
-SUBDIRS = blockfiles
-
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zpool_import
-dist_pkgdata_SCRIPTS = \
- setup.ksh \
- cleanup.ksh \
- import_cachefile_device_added.ksh \
- import_cachefile_device_removed.ksh \
- import_cachefile_device_replaced.ksh \
- import_cachefile_mirror_attached.ksh \
- import_cachefile_mirror_detached.ksh \
- import_cachefile_paths_changed.ksh \
- import_cachefile_shared_device.ksh \
- import_devices_missing.ksh \
- import_paths_changed.ksh \
- import_rewind_config_changed.ksh \
- import_rewind_device_replaced.ksh \
- zpool_import_001_pos.ksh \
- zpool_import_002_pos.ksh \
- zpool_import_003_pos.ksh \
- zpool_import_004_pos.ksh \
- zpool_import_005_pos.ksh \
- zpool_import_006_pos.ksh \
- zpool_import_007_pos.ksh \
- zpool_import_008_pos.ksh \
- zpool_import_009_neg.ksh \
- zpool_import_010_pos.ksh \
- zpool_import_011_neg.ksh \
- zpool_import_012_pos.ksh \
- zpool_import_013_neg.ksh \
- zpool_import_014_pos.ksh \
- zpool_import_015_pos.ksh \
- zpool_import_016_pos.ksh \
- zpool_import_017_pos.ksh \
- zpool_import_all_001_pos.ksh \
- zpool_import_features_001_pos.ksh \
- zpool_import_features_002_neg.ksh \
- zpool_import_features_003_pos.ksh \
- zpool_import_missing_001_pos.ksh \
- zpool_import_missing_002_pos.ksh \
- zpool_import_missing_003_pos.ksh \
- zpool_import_rename_001_pos.ksh \
- zpool_import_encrypted.ksh \
- zpool_import_encrypted_load.ksh \
- zpool_import_errata3.ksh \
- zpool_import_errata4.ksh
-
-dist_pkgdata_DATA = \
- zpool_import.cfg \
- zpool_import.kshlib
-
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_import/blockfiles/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_import/blockfiles/Makefile.am
deleted file mode 100644
index dc3685e4b9cc..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_import/blockfiles/Makefile.am
+++ /dev/null
@@ -1,5 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zpool_import/blockfiles
-dist_pkgdata_DATA = \
- unclean_export.dat.bz2 \
- cryptv0.dat.bz2 \
- missing_ivset.dat.bz2
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_import/import_cachefile_shared_device.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_import/import_cachefile_shared_device.ksh
index 87942b4a52e4..ce9885904b01 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_import/import_cachefile_shared_device.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_import/import_cachefile_shared_device.ksh
@@ -50,14 +50,8 @@ function dev_checksum
log_note "Compute checksum of '$dev'"
- checksum=$(md5digest $dev)
- if [[ $? -ne 0 ]]; then
+ md5digest $dev ||
log_fail "Failed to compute checksum of '$dev'"
- return 1
- fi
-
- echo "$checksum"
- return 0
}
function test_shared_device
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_import/import_rewind_config_changed.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_import/import_rewind_config_changed.ksh
index d79c757d2406..4b6fcbd80af1 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_import/import_rewind_config_changed.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_import/import_rewind_config_changed.ksh
@@ -133,12 +133,8 @@ function test_common
log_must zpool export $TESTPOOL1
- zpool import -d $DEVICE_DIR -T $txg $TESTPOOL1
- if (( $? == 0 )); then
- verify_data_md5sums $MD5FILE
- if (( $? == 0 )); then
- retval=0
- fi
+ if zpool import -d $DEVICE_DIR -T $txg $TESTPOOL1; then
+ verify_data_md5sums $MD5FILE && retval=0
log_must check_pool_config $TESTPOOL1 "$poolcheck"
log_must zpool destroy $TESTPOOL1
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_import/zpool_import.kshlib b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_import/zpool_import.kshlib
index 8bbd668a9317..559810ff0e30 100644
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_import/zpool_import.kshlib
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_import/zpool_import.kshlib
@@ -22,7 +22,7 @@
function cleanup
{
# clear any remaining zinjections
- log_must zinject -c all > /dev/null
+ log_must eval "zinject -c all > /dev/null"
destroy_pool $TESTPOOL1
@@ -64,17 +64,13 @@ function write_some_data
typeset files10mb=${2:-10}
typeset ds="$pool/fillerds"
- zfs create $ds
- [[ $? -ne 0 ]] && return 1
+ zfs create $ds || return 1
# Create 100 MB of data
typeset file="/$ds/fillerfile"
for i in {1..$files10mb}; do
- dd if=/dev/urandom of=$file.$i bs=128k count=80
- [[ $? -ne 0 ]] && return 1
+ dd if=/dev/urandom of=$file.$i bs=128k count=80 || return 1
done
-
- return 0
}
#
@@ -143,13 +139,12 @@ function verify_data_md5sums
return 1
fi
- cat $md5file | \
- while read digest file; do
+ while read -r digest file; do
typeset digest1=$(md5digest $file)
if [[ "$digest1" != "$digest" ]]; then
return 1
fi
- done
+ done < $md5file
return 0
}
@@ -181,20 +176,20 @@ function _translate_vdev
#
typeset keywords="mirror replacing raidz1 raidz2 raidz3 indirect draid1 draid2 draid3"
for word in $keywords; do
- echo $vdev | egrep -qE \
- "^${word}-[0-9]+\$|^${word}:[0-9]+d:[0-9]c:[0-9]+s-[0-9]+\$"
- if [[ $? -eq 0 ]]; then
+ if echo $vdev |
+ grep -qE "^${word}-[0-9]+\$|^${word}:[0-9]+d:[0-9]c:[0-9]+s-[0-9]+\$"
+ then
vdev=$word
break
fi
done
- [[ $vdev == "logs" ]] && echo "log" && return 0
- [[ $vdev == "raidz1" ]] && echo "raidz" && return 0
- [[ $vdev == "draid1" ]] && echo "draid" && return 0
-
- echo $vdev
- return 0
+ case "$vdev" in
+ logs) echo "log" ;;
+ raidz1) echo "raidz" ;;
+ draid1) echo "draid" ;;
+ *) echo $vdev ;;
+ esac
}
#
@@ -217,9 +212,8 @@ function check_pool_config
typeset expected=$2
typeset status
- status=$(zpool status $poolname 2>&1)
- if [[ $? -ne 0 ]]; then
- if ( $logfailure ); then
+ if ! status=$(zpool status $poolname 2>&1); then
+ if $logfailure; then
log_note "zpool status $poolname failed: $status"
fi
return 1
@@ -227,8 +221,7 @@ function check_pool_config
typeset actual=""
typeset began=false
- printf "$status\n" | while read line; do
- typeset vdev=$(echo "$line" | awk '{printf $1}')
+ while read -r vdev _; do
if ( ! $began ) && [[ $vdev == NAME ]]; then
began=true
continue
@@ -240,12 +233,12 @@ function check_pool_config
vdev=$(_translate_vdev $vdev)
actual="$actual $vdev"
fi
- done
+ done <<<"$status"
expected="$poolname $expected"
if [[ "$actual" != "$expected" ]]; then
- if ( $logfailure ); then
+ if $logfailure; then
log_note "expected pool vdevs:"
log_note "> '$expected'"
log_note "actual pool vdevs:"
@@ -272,13 +265,11 @@ function wait_for_pool_config
timeout=$(( $timeout + $(date +%s) ))
while (( $(date +%s) < $timeout )); do
- check_pool_config -q $poolname "$expectedconfig"
- [[ $? -eq 0 ]] && return 0
+ check_pool_config -q $poolname "$expectedconfig" && return 0
sleep 3
done
check_pool_config $poolname "$expectedconfig"
- return $?
}
#
@@ -287,16 +278,14 @@ function wait_for_pool_config
function check_pool_healthy
{
typeset pool=$1
-
typeset status
- status=$(zpool status $pool 2>&1)
- if [[ $? -ne 0 ]]; then
+
+ if ! status=$(zpool status $pool 2>&1); then
log_note "zpool status $pool failed: $status"
return 1
fi
- status=$(echo "$status" | grep "$pool" | grep -v "pool:" | \
- awk '{print $2}')
+ status=$(echo "$status" | awk -v p="$pool" '!/pool:/ && $0 ~ p {print $2}')
if [[ $status != "ONLINE" ]]; then
log_note "Invalid zpool status for '$pool': '$status'" \
@@ -314,9 +303,7 @@ function pool_is_replacing
{
typeset pool=$1
- zpool status $pool | grep "replacing" | grep "ONLINE" > /dev/null
-
- return $?
+ zpool status $pool | grep "replacing" | grep -q "ONLINE"
}
function set_vdev_validate_skip
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_import/zpool_import_001_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_import/zpool_import_001_pos.ksh
index 6369a297c17d..e159c1a04195 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_import/zpool_import_001_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_import/zpool_import_001_pos.ksh
@@ -79,7 +79,7 @@ function cleanup
cleanup_filesystem $TESTPOOL1 $TESTFS
- destroy_pool $TESTPOOL1
+ destroy_pool $TESTPOOL1
[[ -d $ALTER_ROOT ]] && \
log_must rm -rf $ALTER_ROOT
@@ -91,7 +91,7 @@ log_assert "Verify that an exported pool can be imported."
setup_filesystem "$DEVICE_FILES" $TESTPOOL1 $TESTFS $TESTDIR1
-checksum1=$(sum $MYTESTFILE | awk '{print $1}')
+read -r checksum1 _ < <(cksum $MYTESTFILE)
typeset -i i=0
typeset -i j=0
@@ -125,9 +125,8 @@ while (( i < ${#pools[*]} )); do
[[ ! -e $basedir/$TESTFILE0 ]] && \
log_fail "$basedir/$TESTFILE0 missing after import."
- checksum2=$(sum $basedir/$TESTFILE0 | awk '{print $1}')
- [[ "$checksum1" != "$checksum2" ]] && \
- log_fail "Checksums differ ($checksum1 != $checksum2)"
+ read -r checksum2 _ < <(cksum $basedir/$TESTFILE0)
+ log_must [ "$checksum1" = "$checksum2" ]
((j = j + 1))
done
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_import/zpool_import_002_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_import/zpool_import_002_pos.ksh
index 898f93cc9062..95ebe0ae294d 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_import/zpool_import_002_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_import/zpool_import_002_pos.ksh
@@ -90,7 +90,7 @@ log_assert "Verify that an exported pool cannot be imported more than once."
setup_filesystem "$DEVICE_FILES" $TESTPOOL1 $TESTFS $TESTDIR1
-checksum1=$(sum $MYTESTFILE | awk '{print $1}')
+read -r checksum1 _ < <(cksum $MYTESTFILE)
typeset -i i=0
typeset -i j=0
@@ -126,9 +126,8 @@ while (( i < ${#pools[*]} )); do
[[ ! -e $basedir/$TESTFILE0 ]] && \
log_fail "$basedir/$TESTFILE0 missing after import."
- checksum2=$(sum $basedir/$TESTFILE0 | awk '{print $1}')
- [[ "$checksum1" != "$checksum2" ]] && \
- log_fail "Checksums differ ($checksum1 != $checksum2)"
+ read -r checksum2 _ < <(cksum $basedir/$TESTFILE0)
+ log_must [ "$checksum1" = "$checksum2" ]
log_mustnot zpool import ${devs[i]} $target
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_import/zpool_import_012_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_import/zpool_import_012_pos.ksh
index ec387b225665..a9d5e2b319a4 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_import/zpool_import_012_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_import/zpool_import_012_pos.ksh
@@ -165,10 +165,9 @@ for option in "" "-Df"; do
fi
log_note "Import with $nfs_flag and " \
"$guid_flag"
- zpool import $option ${devs[i]} \
- ${options[j]} $target
- #import by GUID if import by pool name fails
- if [[ $? != 0 ]]; then
+ if ! zpool import $option ${devs[i]} \
+ ${options[j]} $target; then
+ # import by GUID if import by pool name fails
log_note "Possible pool name" \
"duplicates. Try GUID import"
target=$guid
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_import/zpool_import_all_001_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_import/zpool_import_all_001_pos.ksh
index b384ec9b1fce..9f5503454d95 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_import/zpool_import_all_001_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_import/zpool_import_all_001_pos.ksh
@@ -76,11 +76,11 @@ function cleanup_all
#
# Try import individually if 'import -a' failed.
#
- for pool in `zpool import | grep "pool:" | awk '{print $2}'`; do
+ for pool in $(zpool import | awk '/pool:/ {print $2}'); do
zpool import -f $pool
done
- for pool in `zpool import -d $DEVICE_DIR | grep "pool:" | awk '{print $2}'`; do
+ for pool in $(zpool import -d $DEVICE_DIR | awk '/pool:/ {print $2}'); do
log_must zpool import -d $DEVICE_DIR -f $pool
done
@@ -108,9 +108,8 @@ function checksum_all #alter_root
[[ ! -e $file ]] && \
log_fail "$file missing after import."
- checksum2=$(sum $file | awk '{print $1}')
- [[ "$checksum1" != "$checksum2" ]] && \
- log_fail "Checksums differ ($checksum1 != $checksum2)"
+ read -r checksum2 _ < <(cksum $file)
+ log_must [ "$checksum1" = "$checksum2" ]
(( id = id + 1 ))
done
@@ -122,7 +121,7 @@ function checksum_all #alter_root
log_assert "Verify that 'zpool import -a' succeeds as root."
log_onexit cleanup_all
-checksum1=$(sum $MYTESTFILE | awk '{print $1}')
+read -r checksum1 _ < <(cksum $MYTESTFILE)
number=1
#
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_import/zpool_import_errata3.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_import/zpool_import_errata3.ksh
index 40b6ca1c1897..c5e578d79edb 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_import/zpool_import_errata3.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_import/zpool_import_errata3.ksh
@@ -44,17 +44,15 @@ POOL_FILE=cryptv0.dat
function uncompress_pool
{
log_note "Creating pool from $POOL_FILE"
- log_must bzcat \
+ log_must eval bzcat \
$STF_SUITE/tests/functional/cli_root/zpool_import/blockfiles/$POOL_FILE.bz2 \
- > /$TESTPOOL/$POOL_FILE
- return 0
+ "> /$TESTPOOL/$POOL_FILE"
}
function cleanup
{
poolexists $POOL_NAME && log_must zpool destroy $POOL_NAME
- [[ -e /$TESTPOOL/$POOL_FILE ]] && rm /$TESTPOOL/$POOL_FILE
- return 0
+ log_must rm -f /$TESTPOOL/$POOL_FILE
}
log_onexit cleanup
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_import/zpool_import_errata4.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_import/zpool_import_errata4.ksh
index a199c2a7fb9d..e450d9a6222c 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_import/zpool_import_errata4.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_import/zpool_import_errata4.ksh
@@ -43,18 +43,16 @@ POOL_FILE=missing_ivset.dat
function uncompress_pool
{
log_note "Creating pool from $POOL_FILE"
- log_must bzcat \
+ log_must eval bzcat \
$STF_SUITE/tests/functional/cli_root/zpool_import/blockfiles/$POOL_FILE.bz2 \
- > /$TESTPOOL/$POOL_FILE
- return 0
+ "> /$TESTPOOL/$POOL_FILE"
}
function cleanup
{
log_must set_tunable32 DISABLE_IVSET_GUID_CHECK 0
poolexists $POOL_NAME && log_must zpool destroy $POOL_NAME
- [[ -e /$TESTPOOL/$POOL_FILE ]] && rm /$TESTPOOL/$POOL_FILE
- return 0
+ log_must rm -rf /$TESTPOOL/$POOL_FILE
}
log_onexit cleanup
@@ -65,11 +63,7 @@ function has_ivset_guid # dataset
ds="$1"
ivset_guid=$(get_prop ivsetguid $ds)
- if [ "$ivset_guid" == "-" ]; then
- return 1
- else
- return 0
- fi
+ [ "$ivset_guid" != "-" ]
}
# 1. Import a pre-packaged pool with Errata #4 and verify its state
@@ -78,9 +72,7 @@ log_must zpool import -d /$TESTPOOL/ $POOL_NAME
log_must eval "zpool status $POOL_NAME | grep -q 'Errata #4'"
log_must eval "zpool status $POOL_NAME | grep -q ZFS-8000-ER"
bm2_value=$(zpool get -H -o value feature@bookmark_v2 $POOL_NAME)
-if [ "$bm2_value" != "disabled" ]; then
- log_fail "initial pool's bookmark_v2 feature is not disabled"
-fi
+log_must [ "$bm2_value" = "disabled" ]
log_mustnot has_ivset_guid $POOL_NAME/testfs@snap1
log_mustnot has_ivset_guid $POOL_NAME/testfs@snap2
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_import/zpool_import_features_002_neg.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_import/zpool_import_features_002_neg.ksh
index d16ef217a444..88fde66adf04 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_import/zpool_import_features_002_neg.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_import/zpool_import_features_002_neg.ksh
@@ -69,18 +69,18 @@ done
log_mustnot zpool import -d $DEVICE_DIR $TESTPOOL1
# error message should not mention "readonly"
-log_mustnot eval "zpool import -d $DEVICE_DIR $TESTPOOL1 | grep readonly"
+log_mustnot eval "zpool import -d $DEVICE_DIR $TESTPOOL1 | grep -q readonly"
log_mustnot poolexists $TESTPOOL1
for feature in $active_features; do
log_must eval "zpool import -d $DEVICE_DIR $TESTPOOL1 \
- | grep $feature"
+ | grep -q $feature"
log_mustnot poolexists $TESTPOOL1
done
for feature in $enabled_features; do
log_mustnot eval "zpool import -d $DEVICE_DIR $TESTPOOL1 \
- | grep $feature"
+ | grep -q $feature"
log_mustnot poolexists $TESTPOOL1
done
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_import/zpool_import_missing_001_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_import/zpool_import_missing_001_pos.ksh
index 3b5167ff0374..22cec24ff457 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_import/zpool_import_missing_001_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_import/zpool_import_missing_001_pos.ksh
@@ -111,7 +111,7 @@ log_assert "Verify that import could handle damaged or missing device."
CWD=$PWD
cd $DEVICE_DIR || log_fail "Unable change directory to $DEVICE_DIR"
-checksum1=$(sum $MYTESTFILE | awk '{print $1}')
+read -r checksum1 _ < <(cksum $MYTESTFILE)
typeset -i i=0
typeset -i j=0
@@ -199,10 +199,8 @@ while (( i < ${#vdevs[*]} )); do
[[ ! -e $basedir/$TESTFILE0 ]] && \
log_fail "$basedir/$TESTFILE0 missing after import."
- checksum2=$(sum $basedir/$TESTFILE0 | awk '{print $1}')
- [[ "$checksum1" != "$checksum2" ]] && \
- log_fail "Checksums differ ($checksum1 != $checksum2)"
-
+ read -r checksum2 _ < <(cksum $basedir/$TESTFILE0)
+ log_must [ "$checksum1" = "$checksum2" ]
done
((j = j + 1))
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_import/zpool_import_missing_003_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_import/zpool_import_missing_003_pos.ksh
index 9d4629a77912..ac76f879c2e8 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_import/zpool_import_missing_003_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_import/zpool_import_missing_003_pos.ksh
@@ -97,9 +97,8 @@ function verify
[[ ! -e $mtpt/$file ]] && \
log_fail "$mtpt/$file missing after import."
- checksum2=$(sum $mymtpt/$file | awk '{print $1}')
- [[ "$checksum1" != "$checksum2" ]] && \
- log_fail "Checksums differ ($checksum1 != $checksum2)"
+ read -r checksum2 _ < <(cksum $mymtpt/$file)
+ log_must [ "$checksum1" = "$checksum2" ]
return 0
@@ -107,7 +106,7 @@ function verify
function cleanup
{
- cd $DEVICE_DIR || log_fail "Unable change directory to $DEVICE_DIR"
+ log_must cd $DEVICE_DIR
for pool in $TESTPOOL1 $TESTPOOL2; do
if poolexists "$pool" ; then
@@ -136,7 +135,7 @@ function cleanup_all
done
log_must rm -f $DEVICE_DIR/$DEVICE_ARCHIVE
- cd $CWD || log_fail "Unable change directory to $CWD"
+ log_must cd $CWD
}
@@ -146,10 +145,10 @@ log_assert "Verify that import could handle device overlapped."
CWD=$PWD
-cd $DEVICE_DIR || log_fail "Unable change directory to $DEVICE_DIR"
+log_must cd $DEVICE_DIR
log_must tar cf $DEVICE_DIR/$DEVICE_ARCHIVE ${DEVICE_FILE}*
-checksum1=$(sum $MYTESTFILE | awk '{print $1}')
+read -r checksum1 < <(cksum $MYTESTFILE)
typeset -i i=0
typeset -i j=0
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_import/zpool_import_rename_001_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_import/zpool_import_rename_001_pos.ksh
index bb6bf86d7881..4e49e8d01d88 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_import/zpool_import_rename_001_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_import/zpool_import_rename_001_pos.ksh
@@ -101,7 +101,7 @@ log_onexit cleanup
log_assert "Verify that an imported pool can be renamed."
setup_filesystem "$DEVICE_FILES" $TESTPOOL1 $TESTFS $TESTDIR1
-checksum1=$(sum $MYTESTFILE | awk '{print $1}')
+read -r checksum1 _ < <(cksum $MYTESTFILE)
typeset -i i=0
typeset -i j=0
@@ -140,9 +140,8 @@ while (( i < ${#pools[*]} )); do
[[ ! -e $basedir/$TESTFILE0 ]] && \
log_fail "$basedir/$TESTFILE0 missing after import."
- checksum2=$(sum $basedir/$TESTFILE0 | awk '{print $1}')
- [[ "$checksum1" != "$checksum2" ]] && \
- log_fail "Checksums differ ($checksum1 != $checksum2)"
+ read -r checksum2 _ < <(cksum $basedir/$TESTFILE0)
+ log_must [ "$checksum1" = "$checksum2" ]
log_must zpool export "${pools[i]}-new"
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_initialize/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_initialize/Makefile.am
deleted file mode 100644
index 3968902ec36d..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_initialize/Makefile.am
+++ /dev/null
@@ -1,18 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zpool_initialize
-dist_pkgdata_SCRIPTS = \
- cleanup.ksh \
- zpool_initialize_attach_detach_add_remove.ksh \
- zpool_initialize_fault_export_import_online.ksh \
- zpool_initialize_import_export.ksh \
- zpool_initialize_offline_export_import_online.ksh \
- zpool_initialize_online_offline.ksh \
- zpool_initialize_split.ksh \
- zpool_initialize_start_and_cancel_neg.ksh \
- zpool_initialize_start_and_cancel_pos.ksh \
- zpool_initialize_suspend_resume.ksh \
- zpool_initialize_unsupported_vdevs.ksh \
- zpool_initialize_verify_checksums.ksh \
- zpool_initialize_verify_initialized.ksh
-
-dist_pkgdata_DATA = \
- zpool_initialize.kshlib
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_initialize/zpool_initialize_verify_initialized.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_initialize/zpool_initialize_verify_initialized.ksh
index f774970a71be..5e40eee4b83e 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_initialize/zpool_initialize_verify_initialized.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_initialize/zpool_initialize_verify_initialized.ksh
@@ -65,10 +65,7 @@ log_must zpool export $TESTPOOL
metaslabs=0
bs=512
zdb -p $TESTDIR -Pme $TESTPOOL | awk '/metaslab[ ]+[0-9]+/ { print $4, $8 }' |
-while read -r offset_size; do
- typeset offset=$(echo $offset_size | cut -d ' ' -f1)
- typeset size=$(echo $offset_size | cut -d ' ' -f2)
-
+while read -r offset size; do
log_note "offset: '$offset'"
log_note "size: '$size'"
@@ -79,7 +76,7 @@ while read -r offset_size; do
# Note we use '-t x4' instead of '-t x8' here because x8 is not
# a supported format on FreeBSD.
dd if=$SMALLFILE skip=$((offset / bs)) count=$((size / bs)) bs=$bs |
- od -t x4 -Ad | egrep -q "deadbeef +deadbeef +deadbeef +deadbeef" ||
+ od -t x4 -Ad | grep -qE "deadbeef +deadbeef +deadbeef +deadbeef" ||
log_fail "Pattern not found in metaslab free space"
done
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_labelclear/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_labelclear/Makefile.am
deleted file mode 100644
index c258f0c929d4..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_labelclear/Makefile.am
+++ /dev/null
@@ -1,9 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zpool_labelclear
-dist_pkgdata_SCRIPTS = \
- zpool_labelclear_active.ksh \
- zpool_labelclear_exported.ksh \
- zpool_labelclear_removed.ksh \
- zpool_labelclear_valid.ksh
-
-dist_pkgdata_DATA = \
- labelclear.cfg
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_offline/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_offline/Makefile.am
deleted file mode 100644
index 33fbb18d66f3..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_offline/Makefile.am
+++ /dev/null
@@ -1,7 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zpool_offline
-dist_pkgdata_SCRIPTS = \
- setup.ksh \
- cleanup.ksh \
- zpool_offline_001_pos.ksh \
- zpool_offline_002_neg.ksh \
- zpool_offline_003_pos.ksh
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_offline/zpool_offline_001_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_offline/zpool_offline_001_pos.ksh
index 6f4c2e3182d1..4f3c187b91d5 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_offline/zpool_offline_001_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_offline/zpool_offline_001_pos.ksh
@@ -55,10 +55,7 @@ function cleanup
#
for disk in $DISKLIST; do
log_must zpool online $TESTPOOL $disk
- check_state $TESTPOOL $disk "online"
- if [[ $? != 0 ]]; then
- log_fail "Unable to online $disk"
- fi
+ log_must check_state $TESTPOOL $disk "online"
done
}
@@ -79,16 +76,10 @@ for disk in $DISKLIST; do
while [[ $i -lt ${#args[*]} ]]; do
if (( j < num )) ; then
log_must zpool offline ${args[$i]} $TESTPOOL $disk
- check_state $TESTPOOL $disk "offline"
- if [[ $? != 0 ]]; then
- log_fail "$disk of $TESTPOOL did not match offline state"
- fi
+ log_must check_state $TESTPOOL $disk "offline"
else
log_mustnot zpool offline ${args[$i]} $TESTPOOL $disk
- check_state $TESTPOOL $disk "online"
- if [[ $? != 0 ]]; then
- log_fail "$disk of $TESTPOOL did not match online state"
- fi
+ log_must check_state $TESTPOOL $disk "online"
fi
(( i = i + 1 ))
@@ -106,19 +97,13 @@ for disk in $DISKLIST; do
while [[ $i -lt $iters ]]; do
index=`expr $RANDOM % ${#args[*]}`
log_must zpool offline ${args[$index]} $TESTPOOL $disk
- check_state $TESTPOOL $disk "offline"
- if [[ $? != 0 ]]; then
- log_fail "$disk of $TESTPOOL is not offline."
- fi
+ log_must check_state $TESTPOOL $disk "offline"
(( i = i + 1 ))
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
+ log_must check_state $TESTPOOL $disk "online"
done
log_pass "'zpool offline -f' succeeded"
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_offline/zpool_offline_003_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_offline/zpool_offline_003_pos.ksh
index 7b5d21cba208..ceef4cc3161d 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_offline/zpool_offline_003_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_offline/zpool_offline_003_pos.ksh
@@ -54,10 +54,7 @@ function cleanup
# Ensure we don't leave disks in the offline state
for disk in $DISKLIST; do
log_must zpool online $TESTPOOL $disk
- check_state $TESTPOOL $disk "online"
- if [[ $? != 0 ]]; then
- log_fail "Unable to online $disk"
- fi
+ log_must check_state $TESTPOOL $disk "online"
done
}
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_online/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_online/Makefile.am
deleted file mode 100644
index 12681e3c4141..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_online/Makefile.am
+++ /dev/null
@@ -1,6 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zpool_online
-dist_pkgdata_SCRIPTS = \
- setup.ksh \
- cleanup.ksh \
- zpool_online_001_pos.ksh \
- zpool_online_002_neg.ksh
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_online/zpool_online_001_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_online/zpool_online_001_pos.ksh
index 8489fddb4109..e104a9323f27 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_online/zpool_online_001_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_online/zpool_online_001_pos.ksh
@@ -54,10 +54,7 @@ function cleanup
#
for disk in $DISKLIST; do
log_must zpool online $TESTPOOL $disk
- check_state $TESTPOOL $disk "online"
- if [[ $? != 0 ]]; then
- log_fail "Unable to online $disk"
- fi
+ log_must check_state $TESTPOOL $disk "online"
done
}
@@ -79,16 +76,10 @@ for disk in $DISKLIST; do
sync_pool $TESTPOOL
log_must zpool offline $TESTPOOL $disk
- check_state $TESTPOOL $disk "offline"
- if [[ $? != 0 ]]; then
- log_fail "$disk of $TESTPOOL did not match offline state"
- fi
+ log_must check_state $TESTPOOL $disk "offline"
log_must zpool online ${args[$i]} $TESTPOOL $disk
- check_state $TESTPOOL $disk "online"
- if [[ $? != 0 ]]; then
- log_fail "$disk of $TESTPOOL did not match online state"
- fi
+ log_must check_state $TESTPOOL $disk "online"
while [[ $j -lt 20 ]]; do
is_pool_resilvered $TESTPOOL && break
@@ -112,10 +103,7 @@ for disk in $DISKLIST; do
while [[ $i -lt $iters ]]; do
index=`expr $RANDOM % ${#args[*]}`
log_must zpool online ${args[$index]} $TESTPOOL $disk
- check_state $TESTPOOL $disk "online"
- if [[ $? != 0 ]]; then
- log_fail "$disk of $TESTPOOL did not match online state"
- fi
+ log_must check_state $TESTPOOL $disk "online"
(( i = i + 1 ))
done
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_remove/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_remove/Makefile.am
deleted file mode 100644
index e30e3f60c2d6..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_remove/Makefile.am
+++ /dev/null
@@ -1,10 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zpool_remove
-dist_pkgdata_SCRIPTS = \
- setup.ksh \
- cleanup.ksh \
- zpool_remove_001_neg.ksh \
- zpool_remove_002_pos.ksh \
- zpool_remove_003_pos.ksh
-
-dist_pkgdata_DATA = \
- zpool_remove.cfg
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_reopen/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_reopen/Makefile.am
deleted file mode 100644
index 01ad68c817f2..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_reopen/Makefile.am
+++ /dev/null
@@ -1,15 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zpool_reopen
-dist_pkgdata_SCRIPTS = \
- setup.ksh \
- cleanup.ksh \
- zpool_reopen_001_pos.ksh \
- zpool_reopen_002_pos.ksh \
- zpool_reopen_003_pos.ksh \
- zpool_reopen_004_pos.ksh \
- zpool_reopen_005_pos.ksh \
- zpool_reopen_006_neg.ksh \
- zpool_reopen_007_pos.ksh
-
-dist_pkgdata_DATA = \
- zpool_reopen.cfg \
- zpool_reopen.shlib
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_reopen/zpool_reopen.cfg b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_reopen/zpool_reopen.cfg
index 7451ffd8c53f..35beb568cb40 100644
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_reopen/zpool_reopen.cfg
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_reopen/zpool_reopen.cfg
@@ -18,7 +18,7 @@
verify_runnable "global"
-export DISK_ARRAY_NUM=$(echo ${DISKS} | nawk '{print NF}')
+export DISK_ARRAY_NUM=$(echo ${DISKS} | awk '{print NF}')
export DISKSARRAY=$DISKS
export SMALL_FILE_SIZE=10
export LARGE_FILE_SIZE=80
@@ -29,9 +29,8 @@ export SDHOSTS=1
export SDTGTS=1
export SDLUNS=1
-export DISK1=$(echo $DISKS | nawk '{print $1}')
-export DISK2=$(echo $DISKS | nawk '{print $2}')
-export DISK3=$(echo $DISKS | nawk '{print $3}')
+read -r DISK1 DISK2 DISK3 _ <<<"$DISKS"
+export DISK1 DISK2 DISK3
if is_linux; then
set_slice_prefix
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_reopen/zpool_reopen.shlib b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_reopen/zpool_reopen.shlib
index 3d142fdf70ca..9b3bc1432270 100644
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_reopen/zpool_reopen.shlib
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_reopen/zpool_reopen.shlib
@@ -20,7 +20,7 @@
function clear_labels #disks
{
for disk in $@; do
- if ( is_loop_device $disk ) || ( is_mpath_device $disk ); then
+ if is_loop_device $disk || is_mpath_device $disk; then
zpool labelclear -f /dev/$disk
else
zpool labelclear -f /dev/${disk}1
@@ -90,19 +90,16 @@ function wait_for_action #pool timeout function
function wait_for_resilver_start #pool timeout
{
wait_for_action $1 $2 is_pool_resilvering
- return $?
}
function wait_for_resilver_end #pool timeout
{
wait_for_action $1 $2 is_pool_resilvered
- return $?
}
function wait_for_scrub_end #pool timeout
{
wait_for_action $1 $2 is_pool_scrubbed
- return $?
}
#
@@ -111,14 +108,10 @@ function wait_for_scrub_end #pool timeout
function is_scan_restarted #pool
{
- typeset pool=$1
- zpool history -i $pool | grep -q "scan aborted, restarting"
- return $?
+ zpool history -i $1 | grep -q "scan aborted, restarting"
}
function is_deferred_scan_started #pool
{
- typeset pool=$1
- zpool history -i $pool | grep -q "starting deferred resilver"
- return $?
+ zpool history -i $1 | grep -q "starting deferred resilver"
}
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_replace/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_replace/Makefile.am
deleted file mode 100644
index 2e3ea69f2ca9..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_replace/Makefile.am
+++ /dev/null
@@ -1,7 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zpool_replace
-dist_pkgdata_SCRIPTS = \
- setup.ksh \
- cleanup.ksh \
- zpool_replace_001_neg.ksh \
- replace-o_ashift.ksh \
- replace_prop_ashift.ksh
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_replace/replace-o_ashift.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_replace/replace-o_ashift.ksh
index 1b18b1297a78..f1b957e620c9 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_replace/replace-o_ashift.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_replace/replace-o_ashift.ksh
@@ -69,23 +69,13 @@ do
for cmdval in ${ashifts[@]}
do
log_must zpool create -o ashift=$ashift $TESTPOOL1 $disk1
- verify_ashift $disk1 $ashift
- if [[ $? -ne 0 ]]
- then
- log_fail "Pool was created without setting ashift " \
- "value to $ashift"
- fi
+ log_must verify_ashift $disk1 $ashift
# ashift_of(replacing_disk) <= ashift_of(existing_vdev)
if [[ $cmdval -le $ashift ]]
then
log_must zpool replace -o ashift=$cmdval $TESTPOOL1 \
$disk1 $disk2
- verify_ashift $disk2 $ashift
- if [[ $? -ne 0 ]]
- then
- log_fail "Device was replaced without " \
- "setting ashift value to $ashift"
- fi
+ log_must verify_ashift $disk2 $ashift
wait_replacing $TESTPOOL1
else
log_mustnot zpool replace -o ashift=$cmdval $TESTPOOL1 \
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_replace/replace_prop_ashift.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_replace/replace_prop_ashift.ksh
index f076f26818eb..a524c4b17ae5 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_replace/replace_prop_ashift.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_replace/replace_prop_ashift.ksh
@@ -77,12 +77,7 @@ do
then
log_must zpool replace $TESTPOOL1 $disk1 $disk2
wait_replacing $TESTPOOL1
- verify_ashift $disk2 $ashift
- if [[ $? -ne 0 ]]
- then
- log_fail "Device was replaced without " \
- "setting ashift value to $ashift"
- fi
+ log_must verify_ashift $disk2 $ashift
else
# cannot replace if pool prop ashift > vdev ashift
log_mustnot zpool replace $TESTPOOL1 $disk1 $disk2
@@ -90,12 +85,7 @@ do
log_must zpool replace -o ashift=$ashift $TESTPOOL1 \
$disk1 $disk2
wait_replacing $TESTPOOL1
- verify_ashift $disk2 $ashift
- if [[ $? -ne 0 ]]
- then
- log_fail "Device was replaced without " \
- "setting ashift value to $ashift"
- fi
+ log_must verify_ashift $disk2 $ashift
fi
# clean things for the next run
log_must zpool destroy $TESTPOOL1
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_resilver/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_resilver/Makefile.am
deleted file mode 100644
index 2cec5335fbae..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_resilver/Makefile.am
+++ /dev/null
@@ -1,9 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zpool_resilver
-dist_pkgdata_SCRIPTS = \
- setup.ksh \
- cleanup.ksh \
- zpool_resilver_bad_args.ksh \
- zpool_resilver_restart.ksh
-
-dist_pkgdata_DATA = \
- zpool_resilver.cfg
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_resilver/zpool_resilver.cfg b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_resilver/zpool_resilver.cfg
index 2a942d69f6d0..2b8c9e954ad7 100644
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_resilver/zpool_resilver.cfg
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_resilver/zpool_resilver.cfg
@@ -23,8 +23,7 @@
# Copyright (c) 2018 by Datto. All rights reserved.
#
-export DISK1=$(echo $DISKS | nawk '{print $1}')
-export DISK2=$(echo $DISKS | nawk '{print $2}')
-export DISK3=$(echo $DISKS | nawk '{print $3}')
+read -r DISK1 DISK2 DISK3 _ <<<"$DISKS"
+export DISK1 DISK2 DISK3
export MAXTIMEOUT=300
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_scrub/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_scrub/Makefile.am
deleted file mode 100644
index e2dfd9d64c40..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_scrub/Makefile.am
+++ /dev/null
@@ -1,16 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zpool_scrub
-dist_pkgdata_SCRIPTS = \
- setup.ksh \
- cleanup.ksh \
- zpool_scrub_001_neg.ksh \
- zpool_scrub_002_pos.ksh \
- zpool_scrub_003_pos.ksh \
- zpool_scrub_004_pos.ksh \
- zpool_scrub_005_pos.ksh \
- zpool_scrub_encrypted_unloaded.ksh \
- zpool_scrub_offline_device.ksh \
- zpool_scrub_print_repairing.ksh \
- zpool_scrub_multiple_copies.ksh
-
-dist_pkgdata_DATA = \
- zpool_scrub.cfg
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_scrub/zpool_scrub.cfg b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_scrub/zpool_scrub.cfg
index fdf2f428477f..f98b1c0613f6 100644
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_scrub/zpool_scrub.cfg
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_scrub/zpool_scrub.cfg
@@ -28,8 +28,8 @@
# Copyright (c) 2012, 2016 by Delphix. All rights reserved.
#
-export DISK1=${DISKS%% *}
-export DISK2=$(echo $DISKS | awk '{print $2}')
+read -r DISK1 DISK2 _ <<<"$DISKS"
+export DISK1 DISK2
export ZFS_SCAN_VDEV_LIMIT_SLOW=$((128*1024))
export ZFS_SCAN_VDEV_LIMIT_DEFAULT=$((4*1024*1024))
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_set/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_set/Makefile.am
deleted file mode 100644
index 916e8bb8d20e..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_set/Makefile.am
+++ /dev/null
@@ -1,9 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zpool_set
-dist_pkgdata_SCRIPTS = \
- setup.ksh \
- cleanup.ksh \
- zpool_set_001_pos.ksh \
- zpool_set_002_neg.ksh \
- zpool_set_003_neg.ksh \
- zpool_set_ashift.ksh \
- zpool_set_features.ksh
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_set/zpool_set_001_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_set/zpool_set_001_pos.ksh
index f08fdfab7fd6..6e4e6be6a18e 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_set/zpool_set_001_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_set/zpool_set_001_pos.ksh
@@ -51,7 +51,7 @@ then
log_fail "\"zpool set\" exit status $RET should be equal to 2."
fi
-OUTPUT=$(zpool set 2>&1 | grep -i usage)
+zpool set 2>&1 | grep -qi usage
if [ $? != 0 ]
then
log_fail "Usage message for zpool set did not contain the word 'usage'."
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_split/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_split/Makefile.am
deleted file mode 100644
index aac5e0d6e7b1..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_split/Makefile.am
+++ /dev/null
@@ -1,19 +0,0 @@
-include $(top_srcdir)/config/Rules.am
-
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zpool_split
-
-dist_pkgdata_SCRIPTS = \
- cleanup.ksh \
- setup.ksh \
- zpool_split_cliargs.ksh \
- zpool_split_devices.ksh \
- zpool_split_encryption.ksh \
- zpool_split_props.ksh \
- zpool_split_vdevs.ksh \
- zpool_split_resilver.ksh \
- zpool_split_wholedisk.ksh \
- zpool_split_indirect.ksh \
- zpool_split_dryrun_output.ksh
-
-dist_pkgdata_DATA = \
- zpool_split.cfg
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_split/zpool_split.cfg b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_split/zpool_split.cfg
index 5833a420c87c..a441a7dff0d6 100644
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_split/zpool_split.cfg
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_split/zpool_split.cfg
@@ -14,5 +14,5 @@
#
export DISKSARRAY=$DISKS
-export DISK_ARRAY_NUM=$(echo ${DISKS} | nawk '{print NF}')
+export DISK_ARRAY_NUM=$(echo ${DISKS} | awk '{print NF}')
set_device_dir
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_split/zpool_split_devices.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_split/zpool_split_devices.ksh
index d64c30d5c561..83b12ab784cd 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_split/zpool_split_devices.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_split/zpool_split_devices.ksh
@@ -33,7 +33,7 @@ function cleanup
{
destroy_pool $TESTPOOL
destroy_pool $TESTPOOL2
- rm -f $FILEDEV_PREFIX*
+ rm -fd $FILEDEV_PREFIX* $altroot
}
function setup_mirror # <conf>
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_split/zpool_split_indirect.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_split/zpool_split_indirect.ksh
index 13f0d08b7f20..e6e5d245793f 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_split/zpool_split_indirect.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_split/zpool_split_indirect.ksh
@@ -43,7 +43,7 @@ function cleanup
if poolexists $TESTPOOL2 ; then
destroy_pool $TESTPOOL2
fi
- rm -f $VDEV_TEMP $VDEV_M1 $VDEV_M2
+ rm -fd $VDEV_TEMP $VDEV_M1 $VDEV_M2 $altroot
}
log_onexit cleanup
@@ -64,6 +64,6 @@ log_must zpool remove $TESTPOOL $VDEV_TEMP
log_must wait_for_removal $TESTPOOL
log_must zpool split -R $altroot $TESTPOOL $TESTPOOL2
log_must poolexists $TESTPOOL2
-log_must test "$(get_pool_prop 'altroot' $TESTPOOL2)" == "$altroot"
+log_must test "$(get_pool_prop 'altroot' $TESTPOOL2)" = "$altroot"
log_pass "'zpool split' works on pools with indirect VDEVs."
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_split/zpool_split_props.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_split/zpool_split_props.ksh
index 1aff8d31d91c..39ae1c9d56f9 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_split/zpool_split_props.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_split/zpool_split_props.ksh
@@ -71,12 +71,11 @@ fi
# Verify we can set a combination of valid property values on the new pool
for prop in "${good_props[@]}"
do
- propname="$(awk -F= '{print $1}' <<< $prop)"
- propval="$(awk -F= '{print $2}' <<< $prop)"
+ IFS='=' read -r propname propval <<<"$prop"
setup_mirror
log_must zpool split -o $prop $TESTPOOL $TESTPOOL2
log_must zpool import -N -d $TEST_BASE_DIR $TESTPOOL2
- log_must test "$(get_pool_prop $propname $TESTPOOL2)" == "$propval"
+ log_must test "$(get_pool_prop $propname $TESTPOOL2)" = "$propval"
destroy_pool $TESTPOOL
destroy_pool $TESTPOOL2
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_split/zpool_split_vdevs.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_split/zpool_split_vdevs.ksh
index 9866cf7a5a58..fff98cf83e84 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_split/zpool_split_vdevs.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_split/zpool_split_vdevs.ksh
@@ -33,7 +33,7 @@ function cleanup
{
destroy_pool $TESTPOOL
destroy_pool $TESTPOOL2
- rm -f $FILEDEV_PREFIX*
+ rm -fd $FILEDEV_PREFIX* $altroot
}
#
@@ -122,7 +122,7 @@ typeset altroot="$TESTDIR/altroot-$TESTPOOL2"
for config in "${goodconfs[@]}"
do
create_config="${config%% *}"
- add_config="$(awk '{$1= "";print $0}' <<< $config)"
+ add_config="$(awk '{$1=""; print $0}' <<< $config)"
log_must zpool create $TESTPOOL $(pool_config $create_config)
for vdev in $add_config; do
log_must zpool add -f $TESTPOOL $(pool_config $vdev)
@@ -137,7 +137,7 @@ done
for config in "${badconfs[@]}"
do
create_config="${config%% *}"
- add_config="$(awk '{$1= "";print $0}' <<< $config)"
+ add_config="$(awk '{$1=""; print $0}' <<< $config)"
log_must zpool create $TESTPOOL $(pool_config $create_config)
for vdev in $add_config; do
log_must zpool add -f $TESTPOOL $(pool_config $vdev)
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_split/zpool_split_wholedisk.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_split/zpool_split_wholedisk.ksh
index 085856c428ad..0725b77a3db2 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_split/zpool_split_wholedisk.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_split/zpool_split_wholedisk.ksh
@@ -44,7 +44,7 @@ function cleanup
destroy_pool $TESTPOOL
destroy_pool $TESTPOOL2
unload_scsi_debug
- rm -f "$FILE_DEVICE"
+ rm -fd "$FILE_DEVICE" "$ALTROOT"
}
function setup_mirror
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_status/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_status/Makefile.am
deleted file mode 100644
index 5553061c67b3..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_status/Makefile.am
+++ /dev/null
@@ -1,7 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zpool_status
-dist_pkgdata_SCRIPTS = \
- setup.ksh \
- cleanup.ksh \
- zpool_status_001_pos.ksh \
- zpool_status_002_pos.ksh \
- zpool_status_features_001_pos.ksh
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_status/zpool_status_003_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_status/zpool_status_003_pos.ksh
new file mode 100755
index 000000000000..e0c2ed669e32
--- /dev/null
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_status/zpool_status_003_pos.ksh
@@ -0,0 +1,70 @@
+#!/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 (c) 2019, Delphix. All rights reserved.
+# Copyright (c) 2021, George Amanakis. All rights reserved.
+#
+
+. $STF_SUITE/include/libtest.shlib
+
+#
+# DESCRIPTION:
+# Verify correct output with 'zpool status -v' after corrupting a file
+#
+# STRATEGY:
+# 1. Create a pool and a file
+# 2. zinject checksum errors
+# 3. Read the file
+# 4. Take a snapshot and make a clone
+# 5. Verify we see "snapshot, clone and filesystem" output in 'zpool status -v'
+
+function cleanup
+{
+ log_must zinject -c all
+ datasetexists $TESTPOOL2 && log_must zpool destroy $TESTPOOL2
+ rm -f $TESTDIR/vdev_a
+}
+
+verify_runnable "both"
+
+log_assert "Verify correct 'zpool status -v' output with a corrupted file"
+log_onexit cleanup
+
+truncate -s $MINVDEVSIZE $TESTDIR/vdev_a
+log_must zpool create -f $TESTPOOL2 $TESTDIR/vdev_a
+
+log_must fio --rw=write --name=job --size=10M --filename=/$TESTPOOL2/10m_file
+log_must zinject -t data -e checksum -f 100 -am /$TESTPOOL2/10m_file
+
+# Try to read the 2nd megabyte of 10m_file
+dd if=/$TESTPOOL2/10m_file bs=1M || true
+
+log_must zfs snapshot $TESTPOOL2@snap
+log_must zfs clone $TESTPOOL2@snap $TESTPOOL2/clone
+
+# Look to see that snapshot, clone and filesystem our files report errors
+log_must eval "zpool status -v | grep '$TESTPOOL2@snap:/10m_file'"
+log_must eval "zpool status -v | grep '$TESTPOOL2/clone/10m_file'"
+log_must eval "zpool status -v | grep '$TESTPOOL2/10m_file'"
+
+log_pass "'zpool status -v' outputs affected filesystem, snapshot & clone"
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_status/zpool_status_004_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_status/zpool_status_004_pos.ksh
new file mode 100755
index 000000000000..6d8571950eec
--- /dev/null
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_status/zpool_status_004_pos.ksh
@@ -0,0 +1,81 @@
+#!/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 (c) 2019, by Delphix. All rights reserved.
+# Copyright (c) 2021, George Amanakis. All rights reserved.
+#
+
+. $STF_SUITE/include/libtest.shlib
+
+#
+# DESCRIPTION:
+# Verify feature@head_errlog=disabled works.
+#
+# STRATEGY:
+# 1. Create a pool with feature@head_errlog=disabled and a file
+# 2. zinject checksum errors
+# 3. Read the file
+# 4. Take a snapshot and make a clone
+# 5. Verify that zpool status displays the old behaviour.
+
+function cleanup
+{
+ log_must zinject -c all
+ datasetexists $TESTPOOL2 && log_must zpool destroy $TESTPOOL2
+ rm -f $TESTDIR/vdev_a
+}
+
+verify_runnable "both"
+
+log_assert "Verify 'zpool status -v' with feature@head_errlog=disabled works"
+log_onexit cleanup
+
+truncate -s $MINVDEVSIZE $TESTDIR/vdev_a
+log_must zpool create -f -o feature@head_errlog=disabled $TESTPOOL2 $TESTDIR/vdev_a
+
+state=$(zpool list -Ho feature@head_errlog $TESTPOOL2)
+if [[ "$state" != "disabled" ]]; then
+ log_fail "head_errlog has state $state"
+fi
+
+log_must fio --rw=write --name=job --size=10M --filename=/$TESTPOOL2/10m_file
+log_must zinject -t data -e checksum -f 100 -am /$TESTPOOL2/10m_file
+
+# Try to read the file
+dd if=/$TESTPOOL2/10m_file bs=1M || true
+
+log_must zfs snapshot $TESTPOOL2@snap
+log_must zfs clone $TESTPOOL2@snap $TESTPOOL2/clone
+
+# Check that snapshot and clone do not report the error.
+log_mustnot eval "zpool status -v | grep '$TESTPOOL2@snap:/10m_file'"
+log_mustnot eval "zpool status -v | grep '$TESTPOOL2/clone/10m_file'"
+log_must eval "zpool status -v | grep '$TESTPOOL2/10m_file'"
+
+# Check that enabling the feature reports the error properly.
+log_must zpool set feature@head_errlog=enabled $TESTPOOL2
+log_must eval "zpool status -v | grep '$TESTPOOL2@snap:/10m_file'"
+log_must eval "zpool status -v | grep '$TESTPOOL2/clone/10m_file'"
+log_must eval "zpool status -v | grep '$TESTPOOL2/10m_file'"
+
+log_pass "'zpool status -v' with feature@head_errlog=disabled works"
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_sync/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_sync/Makefile.am
deleted file mode 100644
index 7f5f67d1f343..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_sync/Makefile.am
+++ /dev/null
@@ -1,6 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zpool_sync
-dist_pkgdata_SCRIPTS = \
- cleanup.ksh \
- setup.ksh \
- zpool_sync_001_pos.ksh \
- zpool_sync_002_neg.ksh
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_trim/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_trim/Makefile.am
deleted file mode 100644
index 0411ab4e0070..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_trim/Makefile.am
+++ /dev/null
@@ -1,25 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zpool_trim
-dist_pkgdata_SCRIPTS = \
- setup.ksh \
- cleanup.ksh \
- zpool_trim_attach_detach_add_remove.ksh \
- zpool_trim_fault_export_import_online.ksh \
- zpool_trim_import_export.ksh \
- zpool_trim_multiple.ksh \
- zpool_trim_neg.ksh \
- zpool_trim_offline_export_import_online.ksh \
- zpool_trim_online_offline.ksh \
- zpool_trim_partial.ksh \
- zpool_trim_rate.ksh \
- zpool_trim_rate_neg.ksh \
- zpool_trim_secure.ksh \
- zpool_trim_split.ksh \
- zpool_trim_start_and_cancel_neg.ksh \
- zpool_trim_start_and_cancel_pos.ksh \
- zpool_trim_suspend_resume.ksh \
- zpool_trim_unsupported_vdevs.ksh \
- zpool_trim_verify_checksums.ksh \
- zpool_trim_verify_trimmed.ksh
-
-dist_pkgdata_DATA = \
- zpool_trim.kshlib
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_upgrade/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_upgrade/Makefile.am
deleted file mode 100644
index c7f321a2f61d..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_upgrade/Makefile.am
+++ /dev/null
@@ -1,20 +0,0 @@
-SUBDIRS = blockfiles
-
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zpool_upgrade
-dist_pkgdata_SCRIPTS = \
- setup.ksh \
- cleanup.ksh \
- zpool_upgrade_001_pos.ksh \
- zpool_upgrade_002_pos.ksh \
- zpool_upgrade_003_pos.ksh \
- zpool_upgrade_004_pos.ksh \
- zpool_upgrade_005_neg.ksh \
- zpool_upgrade_006_neg.ksh \
- zpool_upgrade_007_pos.ksh \
- zpool_upgrade_008_pos.ksh \
- zpool_upgrade_009_neg.ksh \
- zpool_upgrade_features_001_pos.ksh
-
-dist_pkgdata_DATA = \
- zpool_upgrade.cfg \
- zpool_upgrade.kshlib
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_upgrade/blockfiles/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_upgrade/blockfiles/Makefile.am
deleted file mode 100644
index ce8da278e9f0..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_upgrade/blockfiles/Makefile.am
+++ /dev/null
@@ -1,54 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zpool_upgrade/blockfiles
-dist_pkgdata_DATA = \
- zfs-broken-mirror1.dat.bz2 \
- zfs-broken-mirror2.dat.bz2 \
- zfs-pool-v1.dat.bz2 \
- zfs-pool-v10.dat.bz2 \
- zfs-pool-v11.dat.bz2 \
- zfs-pool-v12.dat.bz2 \
- zfs-pool-v13.dat.bz2 \
- zfs-pool-v14.dat.bz2 \
- zfs-pool-v15.dat.bz2 \
- zfs-pool-v1mirror1.dat.bz2 \
- zfs-pool-v1mirror2.dat.bz2 \
- zfs-pool-v1mirror3.dat.bz2 \
- zfs-pool-v1raidz1.dat.bz2 \
- zfs-pool-v1raidz2.dat.bz2 \
- zfs-pool-v1raidz3.dat.bz2 \
- zfs-pool-v1stripe1.dat.bz2 \
- zfs-pool-v1stripe2.dat.bz2 \
- zfs-pool-v1stripe3.dat.bz2 \
- zfs-pool-v2.dat.bz2 \
- zfs-pool-v2mirror1.dat.bz2 \
- zfs-pool-v2mirror2.dat.bz2 \
- zfs-pool-v2mirror3.dat.bz2 \
- zfs-pool-v2raidz1.dat.bz2 \
- zfs-pool-v2raidz2.dat.bz2 \
- zfs-pool-v2raidz3.dat.bz2 \
- zfs-pool-v2stripe1.dat.bz2 \
- zfs-pool-v2stripe2.dat.bz2 \
- zfs-pool-v2stripe3.dat.bz2 \
- zfs-pool-v3.dat.bz2 \
- zfs-pool-v3hotspare1.dat.bz2 \
- zfs-pool-v3hotspare2.dat.bz2 \
- zfs-pool-v3hotspare3.dat.bz2 \
- zfs-pool-v3mirror1.dat.bz2 \
- zfs-pool-v3mirror2.dat.bz2 \
- zfs-pool-v3mirror3.dat.bz2 \
- zfs-pool-v3raidz1.dat.bz2 \
- zfs-pool-v3raidz2.dat.bz2 \
- zfs-pool-v3raidz21.dat.bz2 \
- zfs-pool-v3raidz22.dat.bz2 \
- zfs-pool-v3raidz23.dat.bz2 \
- zfs-pool-v3raidz3.dat.bz2 \
- zfs-pool-v3stripe1.dat.bz2 \
- zfs-pool-v3stripe2.dat.bz2 \
- zfs-pool-v3stripe3.dat.bz2 \
- zfs-pool-v4.dat.bz2 \
- zfs-pool-v5.dat.bz2 \
- zfs-pool-v6.dat.bz2 \
- zfs-pool-v7.dat.bz2 \
- zfs-pool-v8.dat.bz2 \
- zfs-pool-v9.dat.bz2 \
- zfs-pool-v999.dat.bz2 \
- zfs-pool-vBROKEN.dat.bz2
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_upgrade/zpool_upgrade.kshlib b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_upgrade/zpool_upgrade.kshlib
index 783ae54e717b..0bc2cfab0470 100644
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_upgrade/zpool_upgrade.kshlib
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_upgrade/zpool_upgrade.kshlib
@@ -132,8 +132,7 @@ function check_poolversion
fi
# check version using zpool upgrade
- actual=$(zpool upgrade | grep $pool$ | \
- awk '{print $1}' | sed -e 's/ //g')
+ actual=$(zpool upgrade | awk -v p="$pool$" '$0 ~ p {gsub(/ /, "", $1); print $1}')
if [[ $actual != $vers ]] ; then
log_fail "$pool: zpool reported version $actual, expected $vers"
fi
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_upgrade/zpool_upgrade_008_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_upgrade/zpool_upgrade_008_pos.ksh
index d930919652bf..71d59b93a4ca 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_upgrade/zpool_upgrade_008_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_upgrade/zpool_upgrade_008_pos.ksh
@@ -71,7 +71,7 @@ for ver_old in $VERSIONS; do
typeset -i ver_new=$(random_int_between $ver_old $MAX_VER)
create_old_pool $ver_old
- log_must zpool upgrade -V $ver_new $pool_name > /dev/null
+ log_must eval 'zpool upgrade -V $ver_new $pool_name > /dev/null'
check_poolversion $pool_name $ver_new
destroy_upgraded_pool $ver_old
done
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_wait/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_wait/Makefile.am
deleted file mode 100644
index 45ab8e3d4f18..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_wait/Makefile.am
+++ /dev/null
@@ -1,22 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zpool_wait
-dist_pkgdata_SCRIPTS = \
- setup.ksh \
- cleanup.ksh \
- zpool_wait_discard.ksh \
- zpool_wait_freeing.ksh \
- zpool_wait_initialize_basic.ksh \
- zpool_wait_initialize_cancel.ksh \
- zpool_wait_initialize_flag.ksh \
- zpool_wait_multiple.ksh \
- zpool_wait_no_activity.ksh \
- zpool_wait_remove.ksh \
- zpool_wait_remove_cancel.ksh \
- zpool_wait_trim_basic.ksh \
- zpool_wait_trim_cancel.ksh \
- zpool_wait_trim_flag.ksh \
- zpool_wait_usage.ksh
-
-dist_pkgdata_DATA = \
- zpool_wait.kshlib
-
-SUBDIRS = scan
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_wait/scan/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_wait/scan/Makefile.am
deleted file mode 100644
index 451d83a79aa6..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_wait/scan/Makefile.am
+++ /dev/null
@@ -1,11 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zpool_wait/scan
-dist_pkgdata_SCRIPTS = \
- setup.ksh \
- cleanup.ksh \
- zpool_wait_replace.ksh \
- zpool_wait_replace_cancel.ksh \
- zpool_wait_rebuild.ksh \
- zpool_wait_resilver.ksh \
- zpool_wait_scrub_basic.ksh \
- zpool_wait_scrub_cancel.ksh \
- zpool_wait_scrub_flag.ksh
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_wait/zpool_wait.kshlib b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_wait/zpool_wait.kshlib
index b413f6e9f98d..ccb97914968a 100644
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_wait/zpool_wait.kshlib
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_wait/zpool_wait.kshlib
@@ -120,5 +120,5 @@ function check_while_waiting
# Whether any vdev in the given pool is initializing
function is_vdev_initializing # pool
{
- zpool status -i "$1" | grep 'initialized, started' >/dev/null
+ zpool status -i "$1" | grep -q 'initialized, started'
}
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_user/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_user/Makefile.am
deleted file mode 100644
index 119f8ee187f6..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_user/Makefile.am
+++ /dev/null
@@ -1,6 +0,0 @@
-SUBDIRS = \
- misc \
- zfs_list \
- zpool_iostat \
- zpool_list \
- zpool_status
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_user/misc/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_user/misc/Makefile.am
deleted file mode 100644
index 2d38e65777f7..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_user/misc/Makefile.am
+++ /dev/null
@@ -1,52 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_user/misc
-dist_pkgdata_SCRIPTS = \
- setup.ksh \
- cleanup.ksh \
- zdb_001_neg.ksh \
- zfs_001_neg.ksh \
- zfs_allow_001_neg.ksh \
- zfs_clone_001_neg.ksh \
- zfs_create_001_neg.ksh \
- zfs_destroy_001_neg.ksh \
- zfs_get_001_neg.ksh \
- zfs_inherit_001_neg.ksh \
- zfs_mount_001_neg.ksh \
- zfs_promote_001_neg.ksh \
- zfs_receive_001_neg.ksh \
- zfs_rename_001_neg.ksh \
- zfs_rollback_001_neg.ksh \
- zfs_send_001_neg.ksh \
- zfs_set_001_neg.ksh \
- zfs_share_001_neg.ksh \
- zfs_snapshot_001_neg.ksh \
- zfs_unallow_001_neg.ksh \
- zfs_unmount_001_neg.ksh \
- zfs_unshare_001_neg.ksh \
- zfs_upgrade_001_neg.ksh \
- zpool_001_neg.ksh \
- zpool_add_001_neg.ksh \
- zpool_attach_001_neg.ksh \
- zpool_clear_001_neg.ksh \
- zpool_create_001_neg.ksh \
- zpool_destroy_001_neg.ksh \
- zpool_detach_001_neg.ksh \
- zpool_export_001_neg.ksh \
- zpool_get_001_neg.ksh \
- zpool_history_001_neg.ksh \
- zpool_import_001_neg.ksh \
- zpool_import_002_neg.ksh \
- zpool_offline_001_neg.ksh \
- zpool_online_001_neg.ksh \
- zpool_remove_001_neg.ksh \
- zpool_replace_001_neg.ksh \
- zpool_scrub_001_neg.ksh \
- zpool_set_001_neg.ksh \
- zpool_status_001_neg.ksh \
- zpool_upgrade_001_neg.ksh \
- arcstat_001_pos.ksh \
- arc_summary_001_pos.ksh \
- arc_summary_002_neg.ksh \
- zpool_wait_privilege.ksh
-
-dist_pkgdata_DATA = \
- misc.cfg
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_user/misc/arc_summary_001_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_user/misc/arc_summary_001_pos.ksh
index befbea986e1b..5c3d06f228ce 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_user/misc/arc_summary_001_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_user/misc/arc_summary_001_pos.ksh
@@ -27,34 +27,15 @@
. $STF_SUITE/include/libtest.shlib
-log_assert "arc_summary generates output and doesn't return an error code"
+is_freebsd && ! python3 -c 'import sysctl' 2>/dev/null && log_unsupported "python3 sysctl module missing"
-# Depending on which version of arc_summary is installed some command
-# line options may not be available. The python3 version includes
-# several additional flags.
-python3 -V 2>&1 > /dev/null
-if (( $? )); then
- # Some systems have Python 3 installed, but only older versions
- # that don't have the subprocess.run() functionality. We catch
- # these with a separate test. Remove this when all systems have
- # reached 3.5 or greater
- VERSIONPYTEST=$(python3 -V)
- if [[ ${VERSIONPYTEST:9:1} -lt 5 ]]; then
- set -A args "" "-a" "-d" "-p 1"
- else
- set -A args "" "-a" "-d" "-p 1" "-g" "-s arc" "-r"
- fi
-else
- set -A args "" "-a" "-d" "-p 1"
-fi
+log_assert "arc_summary generates output and doesn't return an error code"
# Without this, the below checks aren't going to work the way we hope...
set -o pipefail
-typeset -i i=0
-while [[ $i -lt ${#args[*]} ]]; do
- log_must eval "arc_summary ${args[i]} > /dev/null"
- ((i = i + 1))
+for arg in "" "-a" "-d" "-p 1" "-g" "-s arc" "-r"; do
+ log_must eval "arc_summary $arg > /dev/null"
done
log_must eval "arc_summary | head > /dev/null"
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_user/misc/arc_summary_002_neg.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_user/misc/arc_summary_002_neg.ksh
index de747fba89d1..59fe057e8ca6 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_user/misc/arc_summary_002_neg.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_user/misc/arc_summary_002_neg.ksh
@@ -27,11 +27,11 @@
. $STF_SUITE/include/libtest.shlib
-typeset args=("-x" "-5" "-p 7" "--err" "-@")
+is_freebsd && ! python3 -c 'import sysctl' 2>/dev/null && log_unsupported "python3 sysctl module missing"
log_assert "arc_summary generates an error code with invalid options"
-for arg in "${args[@]}"; do
+for arg in "-x" "-5" "-p 7" "--err" "-@"; do
log_mustnot eval "arc_summary $arg > /dev/null"
done
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_user/misc/arcstat_001_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_user/misc/arcstat_001_pos.ksh
index ab574731fed9..af301829c196 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_user/misc/arcstat_001_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_user/misc/arcstat_001_pos.ksh
@@ -1,4 +1,4 @@
-#! /bin/ksh -p
+#!/bin/ksh -p
#
# CDDL HEADER START
#
@@ -27,6 +27,8 @@
. $STF_SUITE/include/libtest.shlib
+is_freebsd && ! python3 -c 'import sysctl' 2>/dev/null && log_unsupported "python3 sysctl module missing"
+
set -A args "" "-s \",\"" "-x" "-v" \
"-f time,hit%,dh%,ph%,mh%"
@@ -38,4 +40,3 @@ while [[ $i -lt ${#args[*]} ]]; do
((i = i + 1))
done
log_pass "arcstat generates output and doesn't return an error code"
-
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_user/misc/zdb_001_neg.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_user/misc/zdb_001_neg.ksh
index 3adfc59f51ce..490da6c8caa7 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_user/misc/zdb_001_neg.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_user/misc/zdb_001_neg.ksh
@@ -44,19 +44,13 @@
function check_zdb
{
- $@ > $TEST_BASE_DIR/zdb.$$
- grep "Dataset mos" $TEST_BASE_DIR/zdb.$$
- if [ $? -eq 0 ]
- then
- log_fail "$@ exited 0 when run as a non root user!"
- fi
- rm $TEST_BASE_DIR/zdb.$$
+ log_mustnot eval "$* | grep -q 'Dataset mos'"
}
function cleanup
{
- rm -f $TEST_BASE_DIR/zdb_001_neg.$$.txt $TEST_BASE_DIR/zdb.$$
+ rm -f $TEST_BASE_DIR/zdb_001_neg.$$.txt
}
verify_runnable "global"
@@ -66,7 +60,7 @@ log_onexit cleanup
log_must eval "zdb > $TEST_BASE_DIR/zdb_001_neg.$$.txt"
# verify the output looks okay
-log_must grep pool_guid $TEST_BASE_DIR/zdb_001_neg.$$.txt
+log_must grep -q pool_guid $TEST_BASE_DIR/zdb_001_neg.$$.txt
log_must rm $TEST_BASE_DIR/zdb_001_neg.$$.txt
# we shouldn't able to run it on any dataset
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_user/misc/zfs_001_neg.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_user/misc/zfs_001_neg.ksh
index bfe8cf4bb29a..ec91ded976ff 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_user/misc/zfs_001_neg.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_user/misc/zfs_001_neg.ksh
@@ -55,6 +55,6 @@ TEMPFILE="$TEST_BASE_DIR/zfs_001_neg.$$.txt"
zfs > $TEMPFILE 2>&1
log_must grep "usage: zfs command args" "$TEMPFILE"
-log_must eval "awk '{if (length(\$0) > 80) exit 1}' < $TEMPFILE"
+log_must awk 'length($0) > 80 {print; ++err} END {exit err}' $TEMPFILE
log_pass "zfs shows a usage message when run as a user"
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_user/misc/zfs_allow_001_neg.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_user/misc/zfs_allow_001_neg.ksh
index 56a74e4ae427..ce474657b42c 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_user/misc/zfs_allow_001_neg.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_user/misc/zfs_allow_001_neg.ksh
@@ -44,22 +44,15 @@
#
#
-# check to see if we have zfs allow
-zfs 2>&1 | grep "allow" > /dev/null
-if (($? != 0)) then
- log_unsupported "ZFS allow not supported on this machine."
-fi
-
log_assert "zfs allow returns an error when run as a user"
log_must zfs allow $TESTPOOL/$TESTFS
-log_mustnot zfs allow $(logname) create $TESTPOOL/$TESTFS
+log_mustnot zfs allow $(id -un) create $TESTPOOL/$TESTFS
# now verify that the above command actually did nothing by
# checking for any allow output. ( if no allows are granted,
# nothing should be output )
-OUTPUT=$(zfs allow $TESTPOOL/$TESTFS | grep "Local+Descendent" )
-if [ -n "$OUTPUT" ]
+if zfs allow $TESTPOOL/$TESTFS | grep -q "Local+Descendent"
then
log_fail "zfs allow permissions were granted on $TESTPOOL/$TESTFS"
fi
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_user/misc/zfs_share_001_neg.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_user/misc/zfs_share_001_neg.ksh
index 14c35b3da664..0d15c0c8e5ae 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_user/misc/zfs_share_001_neg.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_user/misc/zfs_share_001_neg.ksh
@@ -41,7 +41,6 @@
# 1. Attempt to share a dataset
# 2. Verify the dataset was not shared.
#
-#
verify_runnable "global"
@@ -51,17 +50,11 @@ fi
log_assert "zfs share returns an error when run as a user"
-if is_shared $TESTDIR/unshared
-then
- log_fail "$TESTPOOL/$TESTFS/unshared was incorrectly shared initially!"
-fi
+log_mustnot is_shared $TESTDIR/unshared
log_mustnot zfs share $TESTPOOL/$TESTFS/unshared
# Now verify that the above command didn't actually do anything
-if is_shared $TESTDIR/unshared
-then
- log_fail "$TESTPOOL/$TESTFS/unshared was actually shared!"
-fi
+log_mustnot is_shared $TESTDIR/unshared
log_pass "zfs share returns an error when run as a user"
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_user/misc/zfs_unallow_001_neg.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_user/misc/zfs_unallow_001_neg.ksh
index 98383a08762e..604887f6a2d8 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_user/misc/zfs_unallow_001_neg.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_user/misc/zfs_unallow_001_neg.ksh
@@ -43,19 +43,12 @@
#
#
-# check to see if we have zfs unallow
-zfs 2>&1 | grep "unallow" > /dev/null
-if (($? != 0)) then
- log_unsupported "ZFS unallow not supported on this machine."
-fi
-
log_assert "zfs unallow returns an error when run as a user"
log_mustnot zfs unallow everyone $TESTPOOL/$TESTFS/allowed
# now check with zfs allow to see if the permissions are still there
-OUTPUT=$(zfs allow $TESTPOOL/$TESTFS/allowed | grep "Local+Descendent" )
-if [ -z "$OUTPUT" ]
+if ! zfs allow $TESTPOOL/$TESTFS/allowed | grep -q "Local+Descendent"
then
log_fail "Error - create permissions were unallowed on \
$TESTPOOL/$TESTFS/allowed"
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_user/misc/zfs_unshare_001_neg.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_user/misc/zfs_unshare_001_neg.ksh
index 7ae86fc4ec76..62b5bf39f43c 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_user/misc/zfs_unshare_001_neg.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_user/misc/zfs_unshare_001_neg.ksh
@@ -52,17 +52,13 @@ fi
log_assert "zfs unshare returns an error when run as a user"
# verify that the filesystem was shared initially
-if not_shared $TESTDIR/shared
-then
- log_fail "$TESTPOOL/$TESTFS/shared was not shared initially at all!"
-fi
+log_mustnot not_shared $TESTDIR/shared
+log_fail "$TESTPOOL/$TESTFS/shared was not shared initially at all!"
log_mustnot zfs unshare $TESTPOOL/$TESTFS/shared
# now verify that the above command didn't do anything
-if not_shared $TESTDIR/shared
-then
- log_fail "$TESTPOOL/$TESTFS/shared was actually unshared!"
-fi
+log_mustnot not_shared $TESTDIR/shared
+log_fail "$TESTPOOL/$TESTFS/shared was actually unshared!"
log_pass "zfs unshare returns an error when run as a user"
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_user/misc/zpool_001_neg.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_user/misc/zpool_001_neg.ksh
index 0fddc08b25db..00a86eebafe6 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_user/misc/zpool_001_neg.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_user/misc/zpool_001_neg.ksh
@@ -59,6 +59,6 @@ log_assert "zpool shows a usage message when run as a user"
eval "zpool > $TEMPFILE 2>&1"
log_must grep "usage: zpool command args" "$TEMPFILE"
-log_must eval "awk '{if (length(\$0) > 80) exit 1}' < $TEMPFILE"
+log_must awk '{if (length($0) > 80) exit 1}' $TEMPFILE
log_pass "zpool shows a usage message when run as a user"
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_user/misc/zpool_get_001_neg.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_user/misc/zpool_get_001_neg.ksh
index 7415cebf236b..c8abf4da58e6 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_user/misc/zpool_get_001_neg.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_user/misc/zpool_get_001_neg.ksh
@@ -54,12 +54,12 @@ while [[ $i -lt ${#args[*]} ]]
do
PROP=${props[$i]}
EXPECTED=${prop_vals[$i]}
- ACTUAL=$( zpool get $PROP $TESTPOOL | grep $PROP | awk '{print $1}' )
+ ACTUAL=$( zpool get $PROP $TESTPOOL | awk -v p=$PROP '$0 ~ p {print $1}' )
if [ "$ACTUAL" != "$EXPECTED" ]
then
log_fail "Property $PROP value was $ACTUAL, expected $EXPECTED"
fi
- i=$(( $i + 1 ))
+ i=$(( $i + 1 ))
done
log_must zpool get all $TESTPOOL
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_user/misc/zpool_set_001_neg.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_user/misc/zpool_set_001_neg.ksh
index 941e20c0010e..03d01f20e959 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_user/misc/zpool_set_001_neg.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_user/misc/zpool_set_001_neg.ksh
@@ -59,7 +59,7 @@ do
log_mustnot $POOL set $PROP=$NEW $TESTPOOL
# Now verify that the above command did nothing
- ACTUAL=$( zpool get $PROP $TESTPOOL | grep $PROP | awk '{print $1}' )
+ ACTUAL=$( zpool get $PROP $TESTPOOL | awk -v p=$PROP '$0 ~ p {print $1}' )
if [ "$ACTUAL" != "$EXPECTED" ]
then
log_fail "Property $PROP was set to $ACTUAL, expected $EXPECTED"
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_user/zfs_list/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_user/zfs_list/Makefile.am
deleted file mode 100644
index 81754f401595..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_user/zfs_list/Makefile.am
+++ /dev/null
@@ -1,15 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_user/zfs_list
-dist_pkgdata_SCRIPTS = \
- setup.ksh \
- cleanup.ksh \
- zfs_list_001_pos.ksh \
- zfs_list_002_pos.ksh \
- zfs_list_003_pos.ksh \
- zfs_list_004_neg.ksh \
- zfs_list_005_neg.ksh \
- zfs_list_007_pos.ksh \
- zfs_list_008_neg.ksh
-
-dist_pkgdata_DATA = \
- zfs_list.cfg \
- zfs_list.kshlib
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_user/zfs_list/zfs_list.kshlib b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_user/zfs_list/zfs_list.kshlib
index 889ae46fb932..d993c3037444 100644
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_user/zfs_list/zfs_list.kshlib
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_user/zfs_list/zfs_list.kshlib
@@ -120,7 +120,7 @@ function verify_reverse_sort { # command list name
function is_fs_type_zfs {
typeset dirname=$1
- typeset fs="$(df $dirname | tail -1 | awk '{print $NF}')"
+ typeset fs="$(df $dirname | awk 'END {print $NF}')"
if is_freebsd; then
fs_type=$(mount | awk -v fs=$fs '{if ($3 == fs) print $4}' \
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_user/zfs_list/zfs_list_003_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_user/zfs_list/zfs_list_003_pos.ksh
index 43cfd0cf2101..8e3a5680d34d 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_user/zfs_list/zfs_list_003_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_user/zfs_list/zfs_list_003_pos.ksh
@@ -66,10 +66,7 @@ cd /tmp
for path in $TESTPOOL/$TESTFS $TESTDIR ./../$TESTDIR ; do
zfs list -rH -o name $path > $tmpfile
for fs in $children ; do
- grep "^${fs}$" $tmpfile > /dev/null 2>&1
- if (( $? != 0 )); then
- log_fail "$fs not shown in the output list."
- fi
+ log_must grep -qxF "$fs" $tmpfile
done
done
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_user/zfs_list/zfs_list_007_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_user/zfs_list/zfs_list_007_pos.ksh
index 8e9009bd5500..0f60113b76fe 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_user/zfs_list/zfs_list_007_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_user/zfs_list/zfs_list_007_pos.ksh
@@ -37,7 +37,7 @@
#
# STRATEGY:
# 1. 'zfs list -d <n>' to get the output.
-# 2. 'zfs list -r|egrep' to get the expected output.
+# 2. 'zfs list -r|grep' to get the expected output.
# 3. Compare the two outputs, they should be same.
#
@@ -50,8 +50,7 @@ fi
function cleanup
{
- log_must rm -f $DEPTH_OUTPUT
- log_must rm -f $EXPECT_OUTPUT
+ log_must rm -f $DEPTH_OUTPUT $EXPECT_OUTPUT
}
log_onexit cleanup
@@ -76,10 +75,10 @@ for dp in ${depth_array[@]}; do
log_must eval "zfs list -H -d $dp -o name -t ${fs_type[$fs]} $DEPTH_FS > $DEPTH_OUTPUT"
[[ -s "$DEPTH_OUTPUT" ]] && \
log_fail "$DEPTH_OUTPUT should be null."
- log_mustnot zfs list -rH -o name -t ${fs_type[$fs]} $DEPTH_FS | egrep -e '$eg_opt'
+ log_mustnot zfs list -rH -o name -t ${fs_type[$fs]} $DEPTH_FS | grep -E "$eg_opt"
else
log_must eval "zfs list -H -d $dp -o name -t ${fs_type[$fs]} $DEPTH_FS > $DEPTH_OUTPUT"
- log_must eval "zfs list -rH -o name -t ${fs_type[$fs]} $DEPTH_FS | egrep -e '$eg_opt' > $EXPECT_OUTPUT"
+ log_must eval "zfs list -rH -o name -t ${fs_type[$fs]} $DEPTH_FS | grep -E '$eg_opt' > $EXPECT_OUTPUT"
log_must diff $DEPTH_OUTPUT $EXPECT_OUTPUT
fi
(( fs+=1 ))
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_user/zpool_iostat/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_user/zpool_iostat/Makefile.am
deleted file mode 100644
index 5ee30eafc358..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_user/zpool_iostat/Makefile.am
+++ /dev/null
@@ -1,12 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_user/zpool_iostat
-dist_pkgdata_SCRIPTS = \
- setup.ksh \
- cleanup.ksh \
- zpool_iostat_001_neg.ksh \
- zpool_iostat_002_pos.ksh \
- zpool_iostat_003_neg.ksh \
- zpool_iostat_004_pos.ksh \
- zpool_iostat_005_pos.ksh \
- zpool_iostat_-c_disable.ksh \
- zpool_iostat_-c_searchpath.ksh \
- zpool_iostat_-c_homedir.ksh
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_user/zpool_iostat/zpool_iostat_002_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_user/zpool_iostat/zpool_iostat_002_pos.ksh
index 49be7d0701c2..333177accbe5 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_user/zpool_iostat/zpool_iostat_002_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_user/zpool_iostat/zpool_iostat_002_pos.ksh
@@ -62,7 +62,7 @@ fi
zpool iostat $TESTPOOL 1 4 > $tmpfile 2>&1 &
sleep 4
-stat_count=$(grep $TESTPOOL $tmpfile | wc -l)
+stat_count=$(grep -c $TESTPOOL $tmpfile)
if [[ $stat_count -ne 4 ]]; then
log_fail "zpool iostat [pool_name] [interval] [count] failed"
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_user/zpool_list/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_user/zpool_list/Makefile.am
deleted file mode 100644
index de8cb366924d..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_user/zpool_list/Makefile.am
+++ /dev/null
@@ -1,6 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_user/zpool_list
-dist_pkgdata_SCRIPTS = \
- setup.ksh \
- cleanup.ksh \
- zpool_list_001_pos.ksh \
- zpool_list_002_neg.ksh
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_user/zpool_status/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_user/zpool_status/Makefile.am
deleted file mode 100644
index e1b339657749..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_user/zpool_status/Makefile.am
+++ /dev/null
@@ -1,8 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_user/zpool_status
-dist_pkgdata_SCRIPTS = \
- setup.ksh \
- cleanup.ksh \
- zpool_status_003_pos.ksh \
- zpool_status_-c_disable.ksh \
- zpool_status_-c_homedir.ksh \
- zpool_status_-c_searchpath.ksh
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/compression/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/compression/Makefile.am
deleted file mode 100644
index 817bd41e8075..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/compression/Makefile.am
+++ /dev/null
@@ -1,17 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/compression
-dist_pkgdata_SCRIPTS = \
- cleanup.ksh \
- setup.ksh \
- compress_001_pos.ksh \
- compress_002_pos.ksh \
- compress_003_pos.ksh \
- compress_004_pos.ksh \
- compress_zstd_bswap.ksh \
- l2arc_compressed_arc.ksh \
- l2arc_compressed_arc_disabled.ksh \
- l2arc_encrypted.ksh \
- l2arc_encrypted_no_compressed_arc.ksh
-
-dist_pkgdata_DATA = \
- compress.cfg \
- testpool_zstd.tar.gz
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/compression/compress_001_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/compression/compress_001_pos.ksh
index fe3a3acacc04..fb3bae3b6725 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/compression/compress_001_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/compression/compress_001_pos.ksh
@@ -60,8 +60,8 @@ log_must file_write -o $OP -f $TESTDIR/$TESTFILE1 -b $BLOCKSZ \
sleep 60
-FILE0_BLKS=`du -k $TESTDIR/$TESTFILE0 | awk '{ print $1}'`
-FILE1_BLKS=`du -k $TESTDIR/$TESTFILE1 | awk '{ print $1}'`
+FILE0_BLKS=`du -k $TESTDIR/$TESTFILE0 | awk '{print $1}'`
+FILE1_BLKS=`du -k $TESTDIR/$TESTFILE1 | awk '{print $1}'`
if [[ $FILE0_BLKS -le $FILE1_BLKS ]]; then
log_fail "$TESTFILE0 is smaller than $TESTFILE1" \
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/compression/compress_002_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/compression/compress_002_pos.ksh
index a07d70824042..e7c6d6c6e57e 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/compression/compress_002_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/compression/compress_002_pos.ksh
@@ -65,8 +65,8 @@ log_must file_write -o $OP -f $TESTDIR1/$TESTFILE1 -b $BLOCKSZ \
sleep 60
-FILE0_BLKS=`du -k $TESTDIR1/$TESTFILE0 | awk '{ print $1}'`
-FILE1_BLKS=`du -k $TESTDIR1/$TESTFILE1 | awk '{ print $1}'`
+FILE0_BLKS=`du -k $TESTDIR1/$TESTFILE0 | awk '{print $1}'`
+FILE1_BLKS=`du -k $TESTDIR1/$TESTFILE1 | awk '{print $1}'`
if [[ $FILE0_BLKS -le $FILE1_BLKS ]]; then
log_fail "$TESTFILE0 is smaller than $TESTFILE1" \
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/compression/l2arc_compressed_arc.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/compression/l2arc_compressed_arc.ksh
index 5980ce156934..57f6b6a0242b 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/compression/l2arc_compressed_arc.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/compression/l2arc_compressed_arc.ksh
@@ -52,6 +52,8 @@ export DIRECT=1
verify_runnable "global"
+command -v fio > /dev/null || log_unsupported "fio missing"
+
log_assert "L2ARC with compressed_arc enabled succeeds."
origin_carc_setting=$(get_tunable COMPRESSED_ARC_ENABLED)
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/compression/l2arc_compressed_arc_disabled.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/compression/l2arc_compressed_arc_disabled.ksh
index 4c3b6a61c25f..c8f4111744eb 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/compression/l2arc_compressed_arc_disabled.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/compression/l2arc_compressed_arc_disabled.ksh
@@ -52,6 +52,8 @@ export DIRECT=1
verify_runnable "global"
+command -v fio > /dev/null || log_unsupported "fio missing"
+
log_assert "L2ARC with compressed_arc disabled succeeds."
origin_carc_setting=$(get_tunable COMPRESSED_ARC_ENABLED)
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/compression/l2arc_encrypted.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/compression/l2arc_encrypted.ksh
index fb460daf6837..f7b8a4b950d5 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/compression/l2arc_encrypted.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/compression/l2arc_encrypted.ksh
@@ -53,6 +53,8 @@ export DIRECT=1
verify_runnable "global"
+command -v fio > /dev/null || log_unsupported "fio missing"
+
log_assert "L2ARC with encryption enabled succeeds."
origin_carc_setting=$(get_tunable COMPRESSED_ARC_ENABLED)
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/compression/l2arc_encrypted_no_compressed_arc.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/compression/l2arc_encrypted_no_compressed_arc.ksh
index 45ef489c3145..0838b2c93e68 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/compression/l2arc_encrypted_no_compressed_arc.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/compression/l2arc_encrypted_no_compressed_arc.ksh
@@ -53,6 +53,8 @@ export DIRECT=1
verify_runnable "global"
+command -v fio > /dev/null || log_unsupported "fio missing"
+
log_assert "L2ARC with compressed_arc disabled succeeds."
origin_carc_setting=$(get_tunable COMPRESSED_ARC_ENABLED)
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cp_files/.gitignore b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cp_files/.gitignore
deleted file mode 100644
index eac05e155378..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cp_files/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/cp_files
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cp_files/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cp_files/Makefile.am
deleted file mode 100644
index 06c31f5f3f92..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cp_files/Makefile.am
+++ /dev/null
@@ -1,13 +0,0 @@
-include $(top_srcdir)/config/Rules.am
-
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cp_files
-
-dist_pkgdata_SCRIPTS = \
- cp_files_001_pos.ksh \
- cleanup.ksh \
- setup.ksh
-
-pkgexecdir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cp_files
-
-pkgexec_PROGRAMS = cp_files
-cp_files_SOURCES= cp_files.c
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cp_files/cp_files.c b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cp_files/cp_files.c
deleted file mode 100644
index 9af64a112631..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cp_files/cp_files.c
+++ /dev/null
@@ -1,58 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <dirent.h>
-#include <errno.h>
-#include <string.h>
-
-int
-main(int argc, char *argv[])
-{
- int tfd;
- DIR *sdir;
- struct dirent *dirent;
-
- if (argc != 3) {
- fprintf(stderr, "Usage: %s SRC DST\n", argv[0]);
- exit(1);
- }
-
- sdir = opendir(argv[1]);
- if (sdir == NULL) {
- fprintf(stderr, "Failed to open %s: %s\n",
- argv[1], strerror(errno));
- exit(2);
- }
-
- tfd = open(argv[2], O_DIRECTORY);
- if (tfd < 0) {
- fprintf(stderr, "Failed to open %s: %s\n",
- argv[2], strerror(errno));
- closedir(sdir);
- exit(3);
- }
-
- while ((dirent = readdir(sdir)) != NULL) {
- if (dirent->d_name[0] == '.' &&
- (dirent->d_name[1] == '.' || dirent->d_name[1] == '\0'))
- continue;
-
- int fd = openat(tfd, dirent->d_name, O_CREAT|O_WRONLY, 0666);
- if (fd < 0) {
- fprintf(stderr, "Failed to create %s/%s: %s\n",
- argv[2], dirent->d_name, strerror(errno));
- closedir(sdir);
- close(tfd);
- exit(4);
- }
- close(fd);
- }
-
- closedir(sdir);
- close(tfd);
-
- return (0);
-}
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cp_files/cp_files_001_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cp_files/cp_files_001_pos.ksh
index 3e138cfc9f72..3a814ca3621f 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cp_files/cp_files_001_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cp_files/cp_files_001_pos.ksh
@@ -55,10 +55,9 @@ log_onexit cleanup
NR_FILES=60000
BATCH=1000
-log_must mkdir $TESTDIR/src
-log_must mkdir $TESTDIR/dst
+log_must mkdir $TESTDIR/src $TESTDIR/dst
-WD=$(pwd)
+WD=$PWD
cd $TESTDIR/src
# create NR_FILES in BATCH at a time to prevent overflowing argument buffer
for i in $(seq $(($NR_FILES/$BATCH))); do touch $(seq $((($i-1)*$BATCH+1)) $(($i*$BATCH))); done
@@ -67,7 +66,7 @@ cd $WD
log_must test $NR_FILES -eq $(ls -U $TESTDIR/src | wc -l)
# copy files from src to dst, use cp_files to make sure we copy in readdir order
-log_must $STF_SUITE/tests/functional/cp_files/cp_files $TESTDIR/src $TESTDIR/dst
+log_must cp_files $TESTDIR/src $TESTDIR/dst
log_must test $NR_FILES -eq $(ls -U $TESTDIR/dst | wc -l)
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/crtime/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/crtime/Makefile.am
deleted file mode 100644
index 13e1c2dde31b..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/crtime/Makefile.am
+++ /dev/null
@@ -1,5 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/crtime
-dist_pkgdata_SCRIPTS = \
- cleanup.ksh \
- setup.ksh \
- crtime_001_pos.ksh
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/ctime/.gitignore b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/ctime/.gitignore
deleted file mode 100644
index 9e4539d5fee0..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/ctime/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/ctime
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/ctime/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/ctime/Makefile.am
deleted file mode 100644
index e7479ae81056..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/ctime/Makefile.am
+++ /dev/null
@@ -1,13 +0,0 @@
-include $(top_srcdir)/config/Rules.am
-
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/ctime
-
-dist_pkgdata_SCRIPTS = \
- ctime_001_pos.ksh \
- cleanup.ksh \
- setup.ksh
-
-pkgexecdir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/ctime
-
-pkgexec_PROGRAMS = ctime
-ctime_SOURCES = ctime.c
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/ctime/ctime.c b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/ctime/ctime.c
deleted file mode 100644
index cb2be72eedb9..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/ctime/ctime.c
+++ /dev/null
@@ -1,377 +0,0 @@
-/*
- * 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.
- */
-
-/*
- * Copyright (c) 2013 by Delphix. All rights reserved.
- */
-
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#ifndef __FreeBSD__
-#include <sys/xattr.h>
-#endif
-#include <utime.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <libgen.h>
-#include <string.h>
-
-#define ST_ATIME 0
-#define ST_CTIME 1
-#define ST_MTIME 2
-
-#define ALL_MODE (mode_t)(S_IRWXU|S_IRWXG|S_IRWXO)
-
-typedef struct timetest {
- int type;
- char *name;
- int (*func)(const char *pfile);
-} timetest_t;
-
-static char tfile[BUFSIZ] = { 0 };
-
-/*
- * DESCRIPTION:
- * Verify time will be changed correctly after each operation.
- *
- * STRATEGY:
- * 1. Define time test array.
- * 2. Loop through each item in this array.
- * 3. Verify the time is changed after each operation.
- *
- */
-
-static int
-get_file_time(const char *pfile, int what, time_t *ptr)
-{
- struct stat stat_buf;
-
- if (pfile == NULL || ptr == NULL) {
- return (-1);
- }
-
- if (stat(pfile, &stat_buf) == -1) {
- return (-1);
- }
-
- switch (what) {
- case ST_ATIME:
- *ptr = stat_buf.st_atime;
- return (0);
- case ST_CTIME:
- *ptr = stat_buf.st_ctime;
- return (0);
- case ST_MTIME:
- *ptr = stat_buf.st_mtime;
- return (0);
- default:
- return (-1);
- }
-}
-
-static ssize_t
-get_dirnamelen(const char *path)
-{
- const char *end = strrchr(path, '/');
- return (end ? end - path : -1);
-}
-
-static int
-do_read(const char *pfile)
-{
- int fd, ret = 0;
- char buf[BUFSIZ] = { 0 };
-
- if (pfile == NULL) {
- return (-1);
- }
-
- if ((fd = open(pfile, O_RDONLY, ALL_MODE)) == -1) {
- return (-1);
- }
- if (read(fd, buf, sizeof (buf)) == -1) {
- (void) fprintf(stderr, "read(%d, buf, %zd) failed with errno "
- "%d\n", fd, sizeof (buf), errno);
- (void) close(fd);
- return (1);
- }
- (void) close(fd);
-
- return (ret);
-}
-
-static int
-do_write(const char *pfile)
-{
- int fd, ret = 0;
- char buf[BUFSIZ] = "call function do_write()";
-
- if (pfile == NULL) {
- return (-1);
- }
-
- if ((fd = open(pfile, O_WRONLY, ALL_MODE)) == -1) {
- return (-1);
- }
- if (write(fd, buf, strlen(buf)) == -1) {
- (void) fprintf(stderr, "write(%d, buf, %d) failed with errno "
- "%d\n", fd, (int)strlen(buf), errno);
- (void) close(fd);
- return (1);
- }
- (void) close(fd);
-
- return (ret);
-}
-
-static int
-do_link(const char *pfile)
-{
- int ret = 0;
- char link_file[BUFSIZ + 16] = { 0 };
-
- if (pfile == NULL) {
- return (-1);
- }
-
- /*
- * Figure out source file directory name, and create
- * the link file in the same directory.
- */
- (void) snprintf(link_file, sizeof (link_file),
- "%.*s/%s", (int)get_dirnamelen(pfile), pfile, "link_file");
-
- if (link(pfile, link_file) == -1) {
- (void) fprintf(stderr, "link(%s, %s) failed with errno %d\n",
- pfile, link_file, errno);
- return (1);
- }
-
- (void) unlink(link_file);
-
- return (ret);
-}
-
-static int
-do_creat(const char *pfile)
-{
- int fd, ret = 0;
-
- if (pfile == NULL) {
- return (-1);
- }
-
- if ((fd = creat(pfile, ALL_MODE)) == -1) {
- (void) fprintf(stderr, "creat(%s, ALL_MODE) failed with errno "
- "%d\n", pfile, errno);
- return (1);
- }
- (void) close(fd);
-
- return (ret);
-}
-
-static int
-do_utime(const char *pfile)
-{
- int ret = 0;
-
- if (pfile == NULL) {
- return (-1);
- }
-
- /*
- * Times of the file are set to the current time
- */
- if (utime(pfile, NULL) == -1) {
- (void) fprintf(stderr, "utime(%s, NULL) failed with errno "
- "%d\n", pfile, errno);
- return (1);
- }
-
- return (ret);
-}
-
-static int
-do_chmod(const char *pfile)
-{
- int ret = 0;
-
- if (pfile == NULL) {
- return (-1);
- }
-
- if (chmod(pfile, ALL_MODE) == -1) {
- (void) fprintf(stderr, "chmod(%s, ALL_MODE) failed with "
- "errno %d\n", pfile, errno);
- return (1);
- }
-
- return (ret);
-}
-
-static int
-do_chown(const char *pfile)
-{
- int ret = 0;
-
- if (pfile == NULL) {
- return (-1);
- }
-
- if (chown(pfile, getuid(), getgid()) == -1) {
- (void) fprintf(stderr, "chown(%s, %d, %d) failed with errno "
- "%d\n", pfile, (int)getuid(), (int)getgid(), errno);
- return (1);
- }
-
- return (ret);
-}
-
-#ifndef __FreeBSD__
-static int
-do_xattr(const char *pfile)
-{
- int ret = 0;
- char *value = "user.value";
-
- if (pfile == NULL) {
- return (-1);
- }
-
- if (setxattr(pfile, "user.x", value, strlen(value), 0) == -1) {
- (void) fprintf(stderr, "setxattr(%s, %d, %d) failed with errno "
- "%d\n", pfile, (int)getuid(), (int)getgid(), errno);
- return (1);
- }
- return (ret);
-}
-#endif
-
-static void
-cleanup(void)
-{
- if ((strlen(tfile) != 0) && (access(tfile, F_OK) == 0)) {
- (void) unlink(tfile);
- }
-}
-
-static timetest_t timetest_table[] = {
- { ST_ATIME, "st_atime", do_read },
- { ST_ATIME, "st_atime", do_utime },
- { ST_MTIME, "st_mtime", do_creat },
- { ST_MTIME, "st_mtime", do_write },
- { ST_MTIME, "st_mtime", do_utime },
- { ST_CTIME, "st_ctime", do_creat },
- { ST_CTIME, "st_ctime", do_write },
- { ST_CTIME, "st_ctime", do_chmod },
- { ST_CTIME, "st_ctime", do_chown },
- { ST_CTIME, "st_ctime", do_link },
- { ST_CTIME, "st_ctime", do_utime },
-#ifndef __FreeBSD__
- { ST_CTIME, "st_ctime", do_xattr },
-#endif
-};
-
-#define NCOMMAND (sizeof (timetest_table) / sizeof (timetest_table[0]))
-
-int
-main(void)
-{
- int i, ret, fd;
- char *penv[] = {"TESTDIR", "TESTFILE0"};
-
- (void) atexit(cleanup);
-
- /*
- * Get the environment variable values.
- */
- for (i = 0; i < sizeof (penv) / sizeof (char *); i++) {
- if ((penv[i] = getenv(penv[i])) == NULL) {
- (void) fprintf(stderr, "getenv(penv[%d])\n", i);
- return (1);
- }
- }
- (void) snprintf(tfile, sizeof (tfile), "%s/%s", penv[0], penv[1]);
-
- /*
- * If the test file exists, remove it first.
- */
- if (access(tfile, F_OK) == 0) {
- (void) unlink(tfile);
- }
- ret = 0;
- if ((fd = open(tfile, O_WRONLY | O_CREAT | O_TRUNC, ALL_MODE)) == -1) {
- (void) fprintf(stderr, "open(%s) failed: %d\n", tfile, errno);
- return (1);
- }
- (void) close(fd);
-
- for (i = 0; i < NCOMMAND; i++) {
- time_t t1, t2;
-
- /*
- * Get original time before operating.
- */
- ret = get_file_time(tfile, timetest_table[i].type, &t1);
- if (ret != 0) {
- (void) fprintf(stderr, "get_file_time(%s %d) = %d\n",
- tfile, timetest_table[i].type, ret);
- return (1);
- }
-
- /*
- * Sleep 2 seconds, then invoke command on given file
- */
- (void) sleep(2);
- timetest_table[i].func(tfile);
-
- /*
- * Get time after operating.
- */
- ret = get_file_time(tfile, timetest_table[i].type, &t2);
- if (ret != 0) {
- (void) fprintf(stderr, "get_file_time(%s %d) = %d\n",
- tfile, timetest_table[i].type, ret);
- return (1);
- }
-
- if (t1 == t2) {
- (void) fprintf(stderr, "%s: t1(%ld) == t2(%ld)\n",
- timetest_table[i].name, (long)t1, (long)t2);
- return (1);
- } else {
- (void) fprintf(stderr, "%s: t1(%ld) != t2(%ld)\n",
- timetest_table[i].name, (long)t1, (long)t2);
- }
- }
-
- return (0);
-}
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/ctime/ctime_001_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/ctime/ctime_001_pos.ksh
index de12efe46bc0..035785772db4 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/ctime/ctime_001_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/ctime/ctime_001_pos.ksh
@@ -38,7 +38,7 @@ log_note "Verify [acm]time is modified appropriately."
for arg in ${args[*]}; do
log_note "Testing with xattr set to $arg"
log_must zfs set xattr=$arg $TESTPOOL
- log_must $STF_SUITE/tests/functional/ctime/ctime
+ log_must ctime
done
log_pass "PASS"
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/deadman/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/deadman/Makefile.am
deleted file mode 100644
index 097f23e88404..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/deadman/Makefile.am
+++ /dev/null
@@ -1,8 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/deadman
-dist_pkgdata_SCRIPTS = \
- deadman_ratelimit.ksh \
- deadman_sync.ksh \
- deadman_zio.ksh
-
-dist_pkgdata_DATA = \
- deadman.cfg
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/delegate/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/delegate/Makefile.am
deleted file mode 100644
index c33da3374d88..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/delegate/Makefile.am
+++ /dev/null
@@ -1,28 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/delegate
-dist_pkgdata_SCRIPTS = \
- cleanup.ksh \
- setup.ksh \
- zfs_allow_001_pos.ksh \
- zfs_allow_002_pos.ksh \
- zfs_allow_003_pos.ksh \
- zfs_allow_004_pos.ksh \
- zfs_allow_005_pos.ksh \
- zfs_allow_006_pos.ksh \
- zfs_allow_007_pos.ksh \
- zfs_allow_008_pos.ksh \
- zfs_allow_009_neg.ksh \
- zfs_allow_010_pos.ksh \
- zfs_allow_011_neg.ksh \
- zfs_allow_012_neg.ksh \
- zfs_unallow_001_pos.ksh \
- zfs_unallow_002_pos.ksh \
- zfs_unallow_003_pos.ksh \
- zfs_unallow_004_pos.ksh \
- zfs_unallow_005_pos.ksh \
- zfs_unallow_006_pos.ksh \
- zfs_unallow_007_neg.ksh \
- zfs_unallow_008_neg.ksh
-
-dist_pkgdata_DATA = \
- delegate.cfg \
- delegate_common.kshlib
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/delegate/delegate_common.kshlib b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/delegate/delegate_common.kshlib
index a78b390aa18e..90045f0b3e55 100644
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/delegate/delegate_common.kshlib
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/delegate/delegate_common.kshlib
@@ -161,38 +161,29 @@ function common_perm
typeset perm=$2
typeset dtst=$3
- typeset -i ret=1
case $perm in
send)
verify_send $user $perm $dtst
- ret=$?
;;
allow)
verify_allow $user $perm $dtst
- ret=$?
;;
userprop)
verify_userprop $user $perm $dtst
- ret=$?
;;
compression|checksum|readonly)
verify_ccr $user $perm $dtst
- ret=$?
;;
copies)
verify_copies $user $perm $dtst
- ret=$?
;;
reservation)
verify_reservation $user $perm $dtst
- ret=$?
;;
*)
- ret=1
+ return 1
;;
esac
-
- return $ret
}
function check_fs_perm
@@ -201,99 +192,74 @@ function check_fs_perm
typeset perm=$2
typeset fs=$3
- typeset -i ret=1
case $perm in
create)
verify_fs_create $user $perm $fs
- ret=$?
;;
destroy)
verify_fs_destroy $user $perm $fs
- ret=$?
;;
snapshot)
verify_fs_snapshot $user $perm $fs
- ret=$?
;;
rollback)
verify_fs_rollback $user $perm $fs
- ret=$?
;;
clone)
verify_fs_clone $user $perm $fs
- ret=$?
;;
rename)
verify_fs_rename $user $perm $fs
- ret=$?
;;
mount)
verify_fs_mount $user $perm $fs
- ret=$?
;;
share)
verify_fs_share $user $perm $fs
- ret=$?
;;
mountpoint)
verify_fs_mountpoint $user $perm $fs
- ret=$?
;;
promote)
verify_fs_promote $user $perm $fs
- ret=$?
;;
canmount)
verify_fs_canmount $user $perm $fs
- ret=$?
;;
dnodesize)
verify_fs_dnodesize $user $perm $fs
- ret=$?
;;
recordsize)
verify_fs_recordsize $user $perm $fs
- ret=$?
;;
quota)
verify_fs_quota $user $perm $fs
- ret=$?
;;
aclmode)
verify_fs_aclmode $user $perm $fs
- ret=$?
;;
aclinherit)
verify_fs_aclinherit $user $perm $fs
- ret=$?
;;
snapdir)
verify_fs_snapdir $user $perm $fs
- ret=$?
;;
atime|exec|devices|setuid|xattr)
verify_fs_aedsx $user $perm $fs
- ret=$?
;;
zoned)
verify_fs_zoned $user $perm $fs
- ret=$?
;;
sharenfs)
verify_fs_sharenfs $user $perm $fs
- ret=$?
;;
receive)
verify_fs_receive $user $perm $fs
- ret=$?
;;
*)
common_perm $user $perm $fs
- ret=$?
;;
esac
-
- return $ret
}
function check_vol_perm
@@ -302,43 +268,32 @@ function check_vol_perm
typeset perm=$2
typeset vol=$3
- typeset -i ret=1
case $perm in
destroy)
verify_vol_destroy $user $perm $vol
- ret=$?
;;
snapshot)
verify_vol_snapshot $user $perm $vol
- ret=$?
;;
rollback)
verify_vol_rollback $user $perm $vol
- ret=$?
;;
clone)
verify_vol_clone $user $perm $vol
- ret=$?
;;
rename)
verify_vol_rename $user $perm $vol
- ret=$?
;;
promote)
verify_vol_promote $user $perm $vol
- ret=$?
;;
volsize)
verify_vol_volsize $user $perm $vol
- ret=$?
;;
*)
common_perm $user $perm $vol
- ret=$?
;;
esac
-
- return $ret
}
function setup_unallow_testenv
@@ -362,8 +317,6 @@ function setup_unallow_testenv
log_must verify_perm $SUBFS $LOCAL_DESC_SET $OTHER2
fi
done
-
- return 0
}
#
@@ -391,12 +344,11 @@ function verify_send
user_run $user eval "zfs send $snap > $bak_user"
log_must eval "zfs send $snap > $bak_root"
- if [[ $(checksum $bak_user) == $(checksum $bak_root) ]]; then
+ if [ "$(cksum < $bak_user)" = "$(cksum < $bak_root)" ]; then
ret=0
fi
- rm -rf $bak_user > /dev/null
- rm -rf $bak_root > /dev/null
+ rm -rf $bak_user $bak_root
return $ret
}
@@ -462,12 +414,11 @@ function verify_fs_receive
log_must eval "zfs receive $dtst < $bak_root"
log_must eval "zfs send $dtstsnap > $bak_root"
log_must_busy zfs destroy -rf $dtst
- if [[ $(checksum $bak_user) != $(checksum $bak_root) ]]; then
+ if [ "$(cksum < $bak_user)" != "$(cksum < $bak_root)" ]; then
return 1
fi
- rm -rf $bak_user > /dev/null
- rm -rf $bak_root > /dev/null
+ rm -rf $bak_user $bak_root
done
@@ -1694,20 +1645,12 @@ function verify_allow
typeset -i ret
- user_run $user zfs allow $user allow $dtst
- ret=$?
- if [[ $ret -eq 0 ]]; then
- return 1
- fi
+ user_run $user zfs allow $user allow $dtst && return 1
log_must zfs allow $user copies $dtst
user_run $user zfs allow $user copies $dtst
ret=$?
log_must zfs unallow $user copies $dtst
- if [[ $ret -eq 1 ]]; then
- return 1
- fi
-
- return 0
+ [ $ret -ne 1 ]
}
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/delegate/setup.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/delegate/setup.ksh
index 2f13da750436..d783b417346a 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/delegate/setup.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/delegate/setup.ksh
@@ -68,10 +68,8 @@ log_must add_user $OTHER_GROUP $OTHER2
#
# chmod 0750 $HOME
#
-user_run $STAFF1 zfs list
-if [ $? -ne 0 ]; then
+user_run $STAFF1 zfs list ||
log_unsupported "Test user $STAFF1 cannot execute zfs utilities"
-fi
DISK=${DISKS%% *}
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/delegate/zfs_allow_001_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/delegate/zfs_allow_001_pos.ksh
index 1e0ed80d3203..22e52ccc90b7 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/delegate/zfs_allow_001_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/delegate/zfs_allow_001_pos.ksh
@@ -57,7 +57,7 @@ function cleanup
restore_root_datasets
}
-log_assert "everyone' is interpreted as a keyword even if a user " \
+log_assert "'everyone' is interpreted as a keyword even if a user " \
"or group named 'everyone' exists."
log_onexit cleanup
@@ -79,9 +79,7 @@ if [[ $user_added == "TRUE" ]]; then
fi
log_note "Created a group called 'everyone'."
-if ! cat /etc/group | awk -F: '{print $1}' | \
- grep -w 'everyone' > /dev/null 2>&1
-then
+if ! grep -q '^everyone:' /etc/group; then
group_added="TRUE"
log_must add_group everyone
fi
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/devices/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/devices/Makefile.am
deleted file mode 100644
index 42f59428d4ca..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/devices/Makefile.am
+++ /dev/null
@@ -1,11 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/devices
-dist_pkgdata_SCRIPTS = \
- cleanup.ksh \
- setup.ksh \
- devices_001_pos.ksh \
- devices_002_neg.ksh \
- devices_003_pos.ksh
-
-dist_pkgdata_DATA = \
- devices.cfg \
- devices_common.kshlib
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/dos_attributes/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/dos_attributes/Makefile.am
deleted file mode 100644
index 436bcdb1f31e..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/dos_attributes/Makefile.am
+++ /dev/null
@@ -1,8 +0,0 @@
-include $(top_srcdir)/config/Rules.am
-
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/dos_attributes
-dist_pkgdata_SCRIPTS = \
- cleanup.ksh \
- read_dos_attrs_001.ksh \
- write_dos_attrs_001.ksh \
- setup.ksh
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/events/.gitignore b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/events/.gitignore
deleted file mode 100644
index ed5af03a1095..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/events/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/zed_fd_spill-zedlet
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/events/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/events/Makefile.am
deleted file mode 100644
index 92ce5dbc3825..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/events/Makefile.am
+++ /dev/null
@@ -1,18 +0,0 @@
-include $(top_srcdir)/config/Rules.am
-
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/events
-dist_pkgdata_SCRIPTS = \
- setup.ksh \
- cleanup.ksh \
- events_001_pos.ksh \
- events_002_pos.ksh \
- zed_rc_filter.ksh \
- zed_fd_spill.ksh
-
-dist_pkgdata_DATA = \
- events.cfg \
- events_common.kshlib
-
-pkgexecdir = $(pkgdatadir)
-pkgexec_PROGRAMS = zed_fd_spill-zedlet
-zed_fd_spill_zedlet_SOURCES = zed_fd_spill-zedlet.c
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/events/events.cfg b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/events/events.cfg
index 1405dab6f989..27046c1b0c6b 100644
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/events/events.cfg
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/events/events.cfg
@@ -33,6 +33,4 @@ VDEV4=$TEST_BASE_DIR/vdev4
export TMP_EVENTS=$TEST_BASE_DIR/tmp_events.$$
export TMP_EVENTS_FULL=$TEST_BASE_DIR/tmp_events_full.$$
-export TMP_EVENT_FULL=$TEST_BASE_DIR/tmp_event_full.$$
export TMP_EVENTS_ZED=$TEST_BASE_DIR/tmp_events_zed.$$
-export TMP_EVENT_ZED=$TEST_BASE_DIR/tmp_event_zed.$$
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/events/events_002_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/events/events_002_pos.ksh
index 9407656b6e6b..42088fc0905f 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/events/events_002_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/events/events_002_pos.ksh
@@ -42,15 +42,8 @@ verify_runnable "both"
function cleanup
{
- if poolexists $MPOOL; then
- destroy_pool $MPOOL
- fi
-
- for file in $VDEV1 $VDEV2; do
- [[ -f $file ]] && rm -f $file
- done
-
- log_must rm -f $TMP_EVENTS_ZED
+ poolexists $MPOOL && log_must destroy_pool $MPOOL
+ log_must rm -f $VDEV1 $VDEV2 $TMP_EVENTS_ZED
log_must zed_stop
}
@@ -69,10 +62,9 @@ log_must zed_start
log_must file_wait_event $ZED_DEBUG_LOG 'sysevent\.fs\.zfs\.config_sync' 150
log_must cp $ZED_DEBUG_LOG $TMP_EVENTS_ZED
-awk -v event="sysevent.fs.zfs.pool_create" \
- 'BEGIN{FS="\n"; RS=""} $0 ~ event { print $0 }' \
- $TMP_EVENTS_ZED >$TMP_EVENT_ZED
-log_must grep -q "^ZEVENT_POOL=$MPOOL" $TMP_EVENT_ZED
+log_mustnot awk -v event="sysevent.fs.zfs.pool_create" -v crit="\\nZEVENT_POOL=$MPOOL" \
+ 'BEGIN{FS="\n"; RS=""} $0 ~ event && $0 ~ crit { exit 1 }' \
+ $TMP_EVENTS_ZED
# 3. Stop the ZED
zed_stop
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/events/events_common.kshlib b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/events/events_common.kshlib
index cc600c4ed510..73bf4cf357b5 100644
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/events/events_common.kshlib
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/events/events_common.kshlib
@@ -94,7 +94,7 @@ function run_and_verify
pool=${pool:-$TESTPOOL}
fullcmd="$1"
- cmd=$(echo $fullcmd | awk '{print $1}')
+ read -r cmd _ <<<"$fullcmd"
# If we aren't running zpool or zfs, something is wrong
[[ $cmd == "zpool" || $cmd == "zfs" ]] || \
@@ -147,23 +147,20 @@ function run_and_verify
log_must grep -q "$event" $TMP_EVENTS
# Verify the event is in the verbose output with pool name.
- awk -v event="$event" \
- 'BEGIN{FS="\n"; RS=""} $0 ~ event { print $0 }' \
- $TMP_EVENTS_FULL >$TMP_EVENT_FULL
- log_must grep -q "pool = \"$pool\"" $TMP_EVENT_FULL
+ log_mustnot awk -v event="$event" -v crit="pool = \"$pool\"" \
+ 'BEGIN{FS="\n"; RS=""} $0 ~ event && $0 ~ crit { exit 1 }' \
+ $TMP_EVENTS_FULL
# all-debug.sh filters history events (seen in ZED_DEBUG_LOG)
- if [[ "$event" == "sysevent.fs.zfs.history_event" ]]; then
+ if [ "$event" = "sysevent.fs.zfs.history_event" ]; then
continue
fi
# Verify the event was received by the ZED and logged.
- awk -v event="$event" \
- 'BEGIN{FS="\n"; RS=""} $0 ~ event { print $0 }' \
- $TMP_EVENTS_ZED >$TMP_EVENT_ZED
- log_must grep -q "^ZEVENT_POOL=$pool" $TMP_EVENT_ZED
+ log_mustnot awk -v event="$event" -v crit="\\nZEVENT_POOL=$pool" \
+ 'BEGIN{FS="\n"; RS=""} $0 ~ event && $0 ~ crit { exit 1 }' \
+ $TMP_EVENTS_ZED
done
- rm -f $TMP_EVENTS $TMP_EVENTS_FULL $TMP_EVENT_FULL \
- $TMP_EVENTS_ZED $TMP_EVENT_ZED
+ rm -f $TMP_EVENTS $TMP_EVENTS_FULL $TMP_EVENTS_ZED
}
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/events/zed_fd_spill-zedlet.c b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/events/zed_fd_spill-zedlet.c
deleted file mode 100644
index c072f906d23e..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/events/zed_fd_spill-zedlet.c
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Permission to use, copy, modify, and/or distribute this software for
- * any purpose with or without fee is hereby granted.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
- * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
- * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-#include <sys/types.h>
-#include <sys/wait.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <string.h>
-#include <stdio.h>
-
-int main(void) {
- if (fork()) {
- int err;
- wait(&err);
- return (err);
- }
-
- char buf[64];
- sprintf(buf, "/tmp/zts-zed_fd_spill-logdir/%d", getppid());
- dup2(creat(buf, 0644), STDOUT_FILENO);
-
- snprintf(buf, sizeof (buf), "/proc/%d/fd", getppid());
- execlp("ls", "ls", buf, NULL);
- _exit(127);
-}
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/events/zed_fd_spill.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/events/zed_fd_spill.ksh
index 4ae136d0f36c..d70dd0c7b445 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/events/zed_fd_spill.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/events/zed_fd_spill.ksh
@@ -48,13 +48,12 @@ logdir="$(mktemp -d)"
log_must ln -s "$logdir" /tmp/zts-zed_fd_spill-logdir
-self="$(readlink -f "$0")"
-zedlet="${self%/*}/zed_fd_spill-zedlet"
-log_must ln -s $zedlet "${ZEDLET_DIR}/all-dumpfds"
+zedlet="$(command -v zed_fd_spill-zedlet)"
+log_must ln -s "$zedlet" "${ZEDLET_DIR}/all-dumpfds"
# zed will cry foul and refuse to run it if this isn't true
-sudo chown root $zedlet
-sudo chmod 700 $zedlet
+sudo chown root "$zedlet"
+sudo chmod 700 "$zedlet"
log_must zpool events -c
log_must zed_stop
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/exec/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/exec/Makefile.am
deleted file mode 100644
index 524bf2734f73..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/exec/Makefile.am
+++ /dev/null
@@ -1,9 +0,0 @@
-include $(top_srcdir)/config/Rules.am
-
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/exec
-
-dist_pkgdata_SCRIPTS = \
- cleanup.ksh \
- setup.ksh \
- exec_001_pos.ksh \
- exec_002_neg.ksh
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/exec/exec_002_neg.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/exec/exec_002_neg.ksh
index c11bf8442bcd..2082659a3010 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/exec/exec_002_neg.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/exec/exec_002_neg.ksh
@@ -60,18 +60,12 @@ function cleanup
function exec_n_check
{
typeset expect_value=$1
-
shift
- $@
- ret=$?
- if [[ $ret != $expect_value ]]; then
- log_fail "Unexpected return code: '$ret'"
- fi
-
- return 0
+ "$@"
+ log_must [ $? = $expect_value ]
}
-log_assert "Setting exec=off on a filesystem, processes can not be executed " \
+log_assert "Setting exec=off on a filesystem, processes can not be executed" \
"from this file system."
log_onexit cleanup
@@ -79,11 +73,11 @@ log_must cp $STF_PATH/ls $TESTDIR/myls
log_must zfs set exec=off $TESTPOOL/$TESTFS
if is_linux; then
- log_must exec_n_check 126 $TESTDIR/myls
- log_must exec_n_check 1 mmap_exec $TESTDIR/myls # EPERM
+ exp=1 # EPERM
else
- log_must exec_n_check 126 $TESTDIR/myls
- log_must exec_n_check 13 mmap_exec $TESTDIR/myls # EACCES
+ exp=13 # EACCES
fi
+log_must exec_n_check 126 $TESTDIR/myls
+log_must exec_n_check $exp mmap_exec $TESTDIR/myls
log_pass "Setting exec=off on filesystem testing passed."
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/fallocate/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/fallocate/Makefile.am
deleted file mode 100644
index 5ff366d2482c..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/fallocate/Makefile.am
+++ /dev/null
@@ -1,6 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/fallocate
-dist_pkgdata_SCRIPTS = \
- setup.ksh \
- cleanup.ksh \
- fallocate_prealloc.ksh \
- fallocate_punch-hole.ksh
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/fallocate/fallocate_punch-hole.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/fallocate/fallocate_punch-hole.ksh
index ed83561bd556..92f4552f5bd7 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/fallocate/fallocate_punch-hole.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/fallocate/fallocate_punch-hole.ksh
@@ -60,13 +60,17 @@ function cleanup
[[ -e $TESTDIR ]] && log_must rm -f $FILE
}
-function check_disk_size
+function check_reported_size
{
typeset expected_size=$1
- disk_size=$(du $TESTDIR/file | awk '{print $1}')
- if [ $disk_size -ne $expected_size ]; then
- log_fail "Incorrect size: $disk_size != $expected_size"
+ if ! [ -e "${FILE}" ]; then
+ log_fail "$FILE does not exist"
+ fi
+
+ reported_size=$(du "${FILE}" | awk '{print $1}')
+ if [ "$reported_size" != "$expected_size" ]; then
+ log_fail "Incorrect reported size: $reported_size != $expected_size"
fi
}
@@ -74,9 +78,9 @@ function check_apparent_size
{
typeset expected_size=$1
- apparent_size=$(stat_size)
- if [ $apparent_size -ne $expected_size ]; then
- log_fail "Incorrect size: $apparent_size != $expected_size"
+ apparent_size=$(stat_size "${FILE}")
+ if [ "$apparent_size" != "$expected_size" ]; then
+ log_fail "Incorrect apparent size: $apparent_size != $expected_size"
fi
}
@@ -86,25 +90,30 @@ log_onexit cleanup
# Create a dense file and check it is the correct size.
log_must file_write -o create -f $FILE -b $BLKSZ -c 8
-log_must check_disk_size $((131072 * 8))
+sync_pool $TESTPOOL
+log_must check_reported_size 1027
# Punch a hole for the first full block.
log_must punch_hole 0 $BLKSZ $FILE
-log_must check_disk_size $((131072 * 7))
+sync_pool $TESTPOOL
+log_must check_reported_size 899
# Partially punch a hole in the second block.
log_must punch_hole $BLKSZ $((BLKSZ / 2)) $FILE
-log_must check_disk_size $((131072 * 7))
+sync_pool $TESTPOOL
+log_must check_reported_size 899
-# Punch a hole which overlaps the third and forth block.
+# Punch a hole which overlaps the third and fourth block.
log_must punch_hole $(((BLKSZ * 2) + (BLKSZ / 2))) $((BLKSZ)) $FILE
-log_must check_disk_size $((131072 * 7))
+sync_pool $TESTPOOL
+log_must check_reported_size 899
# Punch a hole from the fifth block past the end of file. The apparent
# file size should not change since --keep-size is implied.
apparent_size=$(stat_size $FILE)
log_must punch_hole $((BLKSZ * 4)) $((BLKSZ * 10)) $FILE
-log_must check_disk_size $((131072 * 4))
+sync_pool $TESTPOOL
+log_must check_reported_size 387
log_must check_apparent_size $apparent_size
log_pass "Ensure holes can be punched in files making them sparse"
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/fallocate/fallocate_zero-range.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/fallocate/fallocate_zero-range.ksh
new file mode 100755
index 000000000000..e907b0f5d4c4
--- /dev/null
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/fallocate/fallocate_zero-range.ksh
@@ -0,0 +1,119 @@
+#!/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 (c) 2020 by Lawrence Livermore National Security, LLC.
+# Copyright (c) 2021 by The FreeBSD Foundation.
+#
+
+. $STF_SUITE/include/libtest.shlib
+
+#
+# DESCRIPTION:
+# Test FALLOC_FL_ZERO_RANGE functionality
+#
+# STRATEGY:
+# 1. Create a dense file
+# 2. Zero various ranges in the file and verify the result.
+#
+
+verify_runnable "global"
+
+if is_freebsd; then
+ log_unsupported "FreeBSD does not implement an analogue to ZERO_RANGE."
+fi
+
+FILE=$TESTDIR/$TESTFILE0
+BLKSZ=$(get_prop recordsize $TESTPOOL)
+
+function cleanup
+{
+ [[ -e $TESTDIR ]] && log_must rm -f $FILE
+}
+
+# Helpfully, this function expects kilobytes, and check_apparent_size expects bytes.
+function check_reported_size
+{
+ typeset expected_size=$1
+
+ if ! [ -e "${FILE}" ]; then
+ log_fail "$FILE does not exist"
+ fi
+
+ reported_size=$(du "${FILE}" | awk '{print $1}')
+ if [ "$reported_size" != "$expected_size" ]; then
+ log_fail "Incorrect reported size: $reported_size != $expected_size"
+ fi
+}
+
+function check_apparent_size
+{
+ typeset expected_size=$1
+
+ apparent_size=$(stat_size "${FILE}")
+ if [ "$apparent_size" != "$expected_size" ]; then
+ log_fail "Incorrect apparent size: $apparent_size != $expected_size"
+ fi
+}
+
+log_assert "Ensure ranges can be zeroed in files"
+
+log_onexit cleanup
+
+# Create a dense file and check it is the correct size.
+log_must file_write -o create -f $FILE -b $BLKSZ -c 8
+sync_pool $TESTPOOL
+log_must check_reported_size 1027
+
+# Zero a range covering the first full block.
+log_must zero_range 0 $BLKSZ $FILE
+sync_pool $TESTPOOL
+log_must check_reported_size 899
+
+# Partially zero a range in the second block.
+log_must zero_range $BLKSZ $((BLKSZ / 2)) $FILE
+sync_pool $TESTPOOL
+log_must check_reported_size 899
+
+# Zero range which overlaps the third and fourth block.
+log_must zero_range $(((BLKSZ * 2) + (BLKSZ / 2))) $((BLKSZ)) $FILE
+sync_pool $TESTPOOL
+log_must check_reported_size 899
+
+# Zero range from the fifth block past the end of file, with --keep-size.
+# The apparent file size must not change, since we did specify --keep-size.
+apparent_size=$(stat_size $FILE)
+log_must fallocate --keep-size --zero-range --offset $((BLKSZ * 4)) --length $((BLKSZ * 10)) "$FILE"
+sync_pool $TESTPOOL
+log_must check_reported_size 387
+log_must check_apparent_size $apparent_size
+
+# Zero range from the fifth block past the end of file. The apparent
+# file size should change since --keep-size is not implied, unlike
+# with PUNCH_HOLE.
+apparent_size=$(stat_size $FILE)
+log_must zero_range $((BLKSZ * 4)) $((BLKSZ * 10)) $FILE
+sync_pool $TESTPOOL
+log_must check_reported_size 387
+log_must check_apparent_size $((BLKSZ * 14))
+
+log_pass "Ensure ranges can be zeroed in files"
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/fallocate/setup.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/fallocate/setup.ksh
index 32334d396865..586ac026aa43 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/fallocate/setup.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/fallocate/setup.ksh
@@ -26,4 +26,7 @@
. $STF_SUITE/include/libtest.shlib
DISK=${DISKS%% *}
-default_setup $DISK
+default_setup_noexit $DISK
+log_must zfs set compression=off $TESTPOOL
+log_pass
+
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/fault/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/fault/Makefile.am
deleted file mode 100644
index ba0d7d6992c6..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/fault/Makefile.am
+++ /dev/null
@@ -1,20 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/fault
-dist_pkgdata_SCRIPTS = \
- setup.ksh \
- cleanup.ksh \
- auto_offline_001_pos.ksh \
- auto_online_001_pos.ksh \
- auto_online_002_pos.ksh \
- auto_replace_001_pos.ksh \
- auto_spare_001_pos.ksh \
- auto_spare_002_pos.ksh \
- auto_spare_ashift.ksh \
- auto_spare_multiple.ksh \
- auto_spare_shared.ksh \
- decrypt_fault.ksh \
- decompress_fault.ksh \
- scrub_after_resilver.ksh \
- zpool_status_-s.ksh
-
-dist_pkgdata_DATA = \
- fault.cfg
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/fault/auto_offline_001_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/fault/auto_offline_001_pos.ksh
index ef2ce24e097b..17bde9a70636 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/fault/auto_offline_001_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/fault/auto_offline_001_pos.ksh
@@ -96,8 +96,7 @@ do
log_must zpool create -f $TESTPOOL $conf
block_device_wait ${DEV_DSKDIR}/${removedev}
- mntpnt=$(get_prop mountpoint /$TESTPOOL) ||
- log_fail "get_prop mountpoint /$TESTPOOL"
+ mntpnt=$(get_prop mountpoint /$TESTPOOL)
# 2. Simulate physical removal of one device
remove_disk $removedev
@@ -128,8 +127,7 @@ do
block_device_wait ${DEV_DSKDIR}/${removedev}
log_must zpool add $TESTPOOL spare $sparedev
- mntpnt=$(get_prop mountpoint /$TESTPOOL) ||
- log_fail "get_prop mountpoint /$TESTPOOL"
+ mntpnt=$(get_prop mountpoint /$TESTPOOL)
# 2. Simulate physical removal of one device
remove_disk $removedev
@@ -161,8 +159,7 @@ do
block_device_wait ${DEV_DSKDIR}/${removedev}
log_must zpool add $TESTPOOL spare $sparedev
- mntpnt=$(get_prop mountpoint /$TESTPOOL) ||
- log_fail "get_prop mountpoint /$TESTPOOL"
+ mntpnt=$(get_prop mountpoint /$TESTPOOL)
# 2. Fault the spare device making it unavailable
log_must zpool offline -f $TESTPOOL $sparedev
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/fault/auto_online_001_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/fault/auto_online_001_pos.ksh
index 03fc15a8a7cb..3a1a610b8daf 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/fault/auto_online_001_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/fault/auto_online_001_pos.ksh
@@ -114,10 +114,7 @@ do
# Reimport pool with drive missing
log_must zpool import $TESTPOOL
- check_state $TESTPOOL "" "degraded"
- if (($? != 0)); then
- log_fail "$TESTPOOL is not degraded"
- fi
+ log_must check_state $TESTPOOL "" "degraded"
# Clear zpool events
log_must zpool events -c
@@ -134,9 +131,8 @@ do
((timeout++))
sleep 1
- zpool events $TESTPOOL \
- | egrep sysevent.fs.zfs.resilver_finish > /dev/null
- if (($? == 0)); then
+ if zpool events $TESTPOOL \
+ | grep -qF sysevent.fs.zfs.resilver_finish; then
log_note "Auto-online of $offline_disk is complete"
sleep 1
break
@@ -144,10 +140,7 @@ do
done
# Validate auto-online was successful
- check_state $TESTPOOL "" "online"
- if (($? != 0)); then
- log_fail "$TESTPOOL is not back online"
- fi
+ log_must check_state $TESTPOOL "" "online"
sleep 2
done
log_must zpool destroy $TESTPOOL
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/fault/auto_replace_001_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/fault/auto_replace_001_pos.ksh
index 0302c45373fa..57180cdc1860 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/fault/auto_replace_001_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/fault/auto_replace_001_pos.ksh
@@ -72,8 +72,8 @@ echo "alias scsidebug /dev/disk/by-id/$SD_DEVICE_ID" >>$VDEVID_CONF
block_device_wait
SD_DEVICE=$(udevadm info -q all -n $DEV_DSKDIR/$SD | \
- awk -F'=' '/ID_VDEV=/{print $2; exit}')
-[[ -z $SD_DEVICE ]] && log_fail "vdev rule was not registered properly"
+ awk -F'=' '/ID_VDEV=/ {print $2; exit}')
+[ -z $SD_DEVICE ] && log_fail "vdev rule was not registered properly"
log_must zpool events -c
log_must zpool create -f $TESTPOOL raidz1 $SD_DEVICE $DISK1 $DISK2 $DISK3
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/fault/auto_spare_shared.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/fault/auto_spare_shared.ksh
index 4229537b3953..1cfa84a930bc 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/fault/auto_spare_shared.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/fault/auto_spare_shared.ksh
@@ -70,10 +70,7 @@ FAIL_FILEDEVPOOL2="$TEST_BASE_DIR/file-fail-dev2"
SPARE_FILEDEV="$TEST_BASE_DIR/file-spare-dev"
SPARE_DISKDEV="$(get_debug_device)"
-for vdev in $SAFE_FILEDEVPOOL1 $SAFE_FILEDEVPOOL2 $FAIL_FILEDEVPOOL1 \
- $FAIL_FILEDEVPOOL2 $SPARE_FILEDEV; do
- log_must truncate -s $MINVDEVSIZE $vdev
-done
+log_must truncate -s $MINVDEVSIZE $SAFE_FILEDEVPOOL1 $SAFE_FILEDEVPOOL2 $FAIL_FILEDEVPOOL1 $FAIL_FILEDEVPOOL2 $SPARE_FILEDEV
for spare in $SPARE_FILEDEV $SPARE_DISKDEV; do
# 1. Create two pools
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/fault/fault.cfg b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/fault/fault.cfg
index 839330ed47dd..108406e3e171 100644
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/fault/fault.cfg
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/fault/fault.cfg
@@ -26,7 +26,7 @@
verify_runnable "global"
-export DISK_ARRAY_NUM=$(echo ${DISKS} | nawk '{print NF}')
+export DISK_ARRAY_NUM=$(echo ${DISKS} | awk '{print NF}')
export DISKSARRAY=$DISKS
export FSIZE=10M
export MAXTIMEOUT=30
@@ -36,9 +36,8 @@ export SDHOSTS=1
export SDTGTS=1
export SDLUNS=1
-export DISK1=$(echo $DISKS | nawk '{print $1}')
-export DISK2=$(echo $DISKS | nawk '{print $2}')
-export DISK3=$(echo $DISKS | nawk '{print $3}')
+read -r DISK1 DISK2 DISK3 _ <<<"$DISKS"
+export DISK1 DISK2 DISK3
if is_linux; then
set_slice_prefix
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/fault/zpool_status_-s.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/fault/zpool_status_-s.ksh
index a290053fd269..4fe00e2c7195 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/fault/zpool_status_-s.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/fault/zpool_status_-s.ksh
@@ -67,11 +67,10 @@ log_must mkfile 1048576 /$TESTPOOL/testfile
sync_pool $TESTPOOL
log_must zinject -c all
-SLOW_IOS=$(zpool status -sp | grep "$DISK" | awk '{print $6}')
-DELAY_EVENTS=$(zpool events | grep delay | wc -l)
+SLOW_IOS=$(zpool status -sp | awk -v d="$DISK" '$0 ~ d {print $6}')
+DELAY_EVENTS=$(zpool events | grep -c delay)
-if [ $SLOW_IOS -gt 0 ] && [ $DELAY_EVENTS -gt 0 ] ; then
- log_pass "Correctly saw $SLOW_IOS slow IOs and $DELAY_EVENTS delay events"
-else
- log_fail "Only saw $SLOW_IOS slow IOs and $DELAY_EVENTS delay events"
-fi
+log_must [ $SLOW_IOS -gt 0 ]
+log_must [ $DELAY_EVENTS -gt 0 ]
+
+log_pass "Correctly saw $SLOW_IOS slow IOs and $DELAY_EVENTS delay events"
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/features/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/features/Makefile.am
deleted file mode 100644
index 3657461e6604..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/features/Makefile.am
+++ /dev/null
@@ -1,3 +0,0 @@
-SUBDIRS = \
- async_destroy \
- large_dnode
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/features/async_destroy/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/features/async_destroy/Makefile.am
deleted file mode 100644
index 4c777878d689..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/features/async_destroy/Makefile.am
+++ /dev/null
@@ -1,5 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/features/async_destroy
-dist_pkgdata_SCRIPTS = \
- cleanup.ksh \
- setup.ksh \
- async_destroy_001_pos.ksh
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/features/large_dnode/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/features/large_dnode/Makefile.am
deleted file mode 100644
index 13ba3ab33d9e..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/features/large_dnode/Makefile.am
+++ /dev/null
@@ -1,13 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/features/large_dnode
-dist_pkgdata_SCRIPTS = \
- cleanup.ksh \
- setup.ksh \
- large_dnode_001_pos.ksh \
- large_dnode_002_pos.ksh \
- large_dnode_003_pos.ksh \
- large_dnode_004_neg.ksh \
- large_dnode_005_pos.ksh \
- large_dnode_006_pos.ksh \
- large_dnode_007_neg.ksh \
- large_dnode_008_pos.ksh \
- large_dnode_009_pos.ksh
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/features/large_dnode/large_dnode_001_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/features/large_dnode/large_dnode_001_pos.ksh
index cb1e940a7d73..c00b3b6c719a 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/features/large_dnode/large_dnode_001_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/features/large_dnode/large_dnode_001_pos.ksh
@@ -73,7 +73,7 @@ log_must zfs umount $TEST_FS
for ((i=0; i < ${#dnsizes[*]}; i++)) ; do
dnsize=$(zdb -dddd $TEST_FS ${inodes[$i]} |
- awk '/ZFS plain file/ {print $6}' | tr K k)
+ awk '/ZFS plain file/ {gsub(/K/, "k", $6); print $6}')
if [[ "$dnsize" != "${dnsizes[$i]}" ]]; then
log_fail "dnode size is $dnsize (expected ${dnsizes[$i]})"
fi
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/features/large_dnode/large_dnode_005_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/features/large_dnode/large_dnode_005_pos.ksh
index 03e2db4b8082..1d167e3ae59f 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/features/large_dnode/large_dnode_005_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/features/large_dnode/large_dnode_005_pos.ksh
@@ -54,11 +54,11 @@ log_assert "zfs send stream with large dnodes accepted by new pool"
log_must zfs create -o dnodesize=1k $TEST_SEND_FS
log_must touch /$TEST_SEND_FS/$TEST_FILE
log_must zfs snap $TEST_SNAP
-log_must zfs send $TEST_SNAP > $TEST_STREAM
+log_must eval "zfs send $TEST_SNAP > $TEST_STREAM"
log_must rm -f /$TEST_SEND_FS/$TEST_FILE
log_must touch /$TEST_SEND_FS/$TEST_FILEINCR
log_must zfs snap $TEST_SNAPINCR
-log_must zfs send -i $TEST_SNAP $TEST_SNAPINCR > $TEST_STREAMINCR
+log_must eval "zfs send -i $TEST_SNAP $TEST_SNAPINCR > $TEST_STREAMINCR"
log_must eval "zfs recv $TEST_RECV_FS < $TEST_STREAM"
inode=$(ls -li /$TEST_RECV_FS/$TEST_FILE | awk '{print $1}')
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/features/large_dnode/large_dnode_009_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/features/large_dnode/large_dnode_009_pos.ksh
index 1e42202069eb..0b61e1df2226 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/features/large_dnode/large_dnode_009_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/features/large_dnode/large_dnode_009_pos.ksh
@@ -66,6 +66,6 @@ log_must wait
log_must_busy zpool export $TESTPOOL
log_must zpool import $TESTPOOL
-log_must ls -lR "/$TEST_FS/" >/dev/null 2>&1
+log_must eval "ls -lR /$TEST_FS/ >/dev/null 2>&1"
log_must zdb -d $TESTPOOL
log_pass
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/grow/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/grow/Makefile.am
deleted file mode 100644
index 807610a067d8..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/grow/Makefile.am
+++ /dev/null
@@ -1,7 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/grow
-dist_pkgdata_SCRIPTS = \
- grow_pool_001_pos.ksh \
- grow_replicas_001_pos.ksh
-
-dist_pkgdata_DATA = \
- grow.cfg
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/history/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/history/Makefile.am
deleted file mode 100644
index b865a319a430..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/history/Makefile.am
+++ /dev/null
@@ -1,23 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/history
-dist_pkgdata_SCRIPTS = \
- cleanup.ksh \
- setup.ksh \
- history_001_pos.ksh \
- history_002_pos.ksh \
- history_003_pos.ksh \
- history_004_pos.ksh \
- history_005_neg.ksh \
- history_006_neg.ksh \
- history_007_pos.ksh \
- history_008_pos.ksh \
- history_009_pos.ksh \
- history_010_pos.ksh
-
-dist_pkgdata_DATA = \
- history.cfg \
- history_common.kshlib \
- i386.migratedpool.DAT.Z \
- i386.orig_history.txt \
- sparc.migratedpool.DAT.Z \
- sparc.orig_history.txt \
- zfs-pool-v4.dat.Z
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/history/history_001_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/history/history_001_pos.ksh
index f33265185d5c..5b576b8a12aa 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/history/history_001_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/history/history_001_pos.ksh
@@ -59,7 +59,6 @@ log_assert "Verify zpool sub-commands which modify state are logged."
log_onexit cleanup
mntpnt=$(get_prop mountpoint $TESTPOOL)
-(( $? != 0)) && log_fail "get_prop($TESTPOOL mountpoint)"
VDEV1=$mntpnt/vdev1; VDEV2=$mntpnt/vdev2;
VDEV3=$mntpnt/vdev3; VDEV4=$mntpnt/vdev4;
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/history/history_003_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/history/history_003_pos.ksh
index 46af53f8af90..1bebd4039746 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/history/history_003_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/history/history_003_pos.ksh
@@ -55,7 +55,6 @@ log_assert "zpool history limitation test."
log_onexit cleanup
mntpnt=$(get_prop mountpoint $TESTPOOL)
-(( $? != 0 )) && log_fail "get_prop mountpoint $TESTPOOL"
VDEV0=$mntpnt/vdev0
log_must mkfile $MINVDEVSIZE $VDEV0
@@ -79,16 +78,16 @@ done
TMPFILE=$TEST_BASE_DIR/spool.$$
zpool history $spool >$TMPFILE
-typeset -i entry_count=$(wc -l $TMPFILE | awk '{print $1}')
+typeset -i entry_count=$(wc -l < $TMPFILE)
typeset final_md5=$(head -2 $TMPFILE | md5digest)
-grep 'zpool create' $TMPFILE >/dev/null 2>&1 ||
+grep -q 'zpool create' $TMPFILE ||
log_fail "'zpool create' was not found in pool history"
-grep 'zfs create' $TMPFILE >/dev/null 2>&1 &&
+grep -q 'zfs create' $TMPFILE &&
log_fail "'zfs create' was found in pool history"
-grep 'zfs set compress' $TMPFILE >/dev/null 2>&1 ||
+grep -q 'zfs set compress' $TMPFILE ||
log_fail "'zfs set compress' was found in pool history"
# Verify that the creation of the pool was preserved in the history.
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/history/history_004_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/history/history_004_pos.ksh
index 1b8e7dfe02ec..8bdc38f26d67 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/history/history_004_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/history/history_004_pos.ksh
@@ -46,7 +46,7 @@ verify_runnable "global"
log_assert "'zpool history' can cope with simultaneous commands."
-typeset -i orig_count=$(zpool history $spool | wc -l | awk '{print $1}')
+typeset -i orig_count=$(zpool history $spool | wc -l)
typeset -i i=0
while ((i < 10)); do
@@ -90,7 +90,7 @@ while ((i < 10)); do
((i += 1))
done
-typeset -i entry_count=$(zpool history $spool | wc -l | awk '{print $1}')
+typeset -i entry_count=$(zpool history $spool | wc -l)
if ((entry_count - orig_count != 200)); then
log_fail "The entries count error: entry_count=$entry_count " \
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/history/history_005_neg.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/history/history_005_neg.ksh
index 297a701cc567..5038af4a7c79 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/history/history_005_neg.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/history/history_005_neg.ksh
@@ -54,10 +54,10 @@ log_assert "Verify 'zpool get|history|list|status|iostat' will not be logged."
# Save initial TESTPOOL history
log_must eval "zpool history $TESTPOOL >$OLD_HISTORY"
-log_must zpool get all $TESTPOOL >/dev/null
-log_must zpool list $TESTPOOL >/dev/null
-log_must zpool status $TESTPOOL >/dev/null
-log_must zpool iostat $TESTPOOL >/dev/null
+log_must eval "zpool get all $TESTPOOL >/dev/null"
+log_must eval "zpool list $TESTPOOL >/dev/null"
+log_must eval "zpool status $TESTPOOL >/dev/null"
+log_must eval "zpool iostat $TESTPOOL >/dev/null"
log_must eval "zpool history $TESTPOOL >$NEW_HISTORY"
log_must diff $OLD_HISTORY $NEW_HISTORY
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/history/history_006_neg.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/history/history_006_neg.ksh
index 19b7114faf5b..a1e76e68b802 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/history/history_006_neg.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/history/history_006_neg.ksh
@@ -67,15 +67,15 @@ log_must zfs snapshot $snap2
# Save initial TESTPOOL history
log_must eval "zpool history $TESTPOOL > $OLD_HISTORY"
-log_must zfs list $fs > /dev/null
-log_must zfs get mountpoint $fs > /dev/null
+log_must eval "zfs list $fs > /dev/null"
+log_must eval "zfs get mountpoint $fs > /dev/null"
log_must zfs unmount $fs
log_must zfs mount $fs
if ! is_linux; then
log_must zfs share $fs
log_must zfs unshare $fs
fi
-log_must zfs send -i $snap1 $snap2 > /dev/null
+log_must eval "zfs send -i $snap1 $snap2 > /dev/null"
log_must zfs holds $snap1
log_must eval "zpool history $TESTPOOL > $NEW_HISTORY"
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/history/history_007_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/history/history_007_pos.ksh
index f187b88f056e..3d785183d094 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/history/history_007_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/history/history_007_pos.ksh
@@ -70,7 +70,7 @@ for arch in "i386" "sparc"; do
orig_cmds_f=$import_dir/${arch}.orig_history.txt
# remove blank line
orig_cmds_f1=$import_dir/${arch}.orig_history_1.txt
- cat $orig_cmds_f | grep -v "^$" > $orig_cmds_f1
+ grep -v "^$" $orig_cmds_f > $orig_cmds_f1
log_must cp $tst_dir/${arch}.migratedpool.DAT.Z $import_dir
log_must uncompress -f $import_dir/${arch}.migratedpool.DAT.Z
@@ -80,7 +80,7 @@ for arch in "i386" "sparc"; do
log_must zpool destroy -f $migratedpoolname
log_must zpool import -d $import_dir $migratedpoolname
- log_must eval "TZ=$TIMEZONE zpool history $migratedpoolname | grep -v "^\$" >$migrated_cmds_f"
+ log_must eval "TZ=$TIMEZONE zpool history $migratedpoolname | grep -v \"^\$\" >$migrated_cmds_f"
# The migrated history file should differ with original history file on
# two commands -- 'export' and 'import', which are included in migrated
@@ -89,20 +89,20 @@ for arch in "i386" "sparc"; do
# then compare this filtered file with the original history file. They
# should be identical at this time.
for subcmd in "export" "import"; do
- grep -q "$subcmd" $migrated_cmds_f || \
- log_fail "zpool $subcmd is not logged for" \
- "the imported pool $migratedpoolname."
+ grep -q "$subcmd" $migrated_cmds_f ||
+ log_fail "zpool $subcmd is not logged for" \
+ "the imported pool $migratedpoolname."
done
tmpfile=$import_dir/cmds_tmp.$$
- linenum=`wc -l < $migrated_cmds_f`
+ linenum=$(wc -l < $migrated_cmds_f)
(( linenum = linenum - 2 ))
head -n $linenum $migrated_cmds_f > $tmpfile
log_must diff $tmpfile $orig_cmds_f1
# cleanup for next loop testing
log_must zpool destroy -f $migratedpoolname
- log_must rm -f `ls $import_dir`
+ log_must rm -f $(ls $import_dir)
done
log_pass "Verify command history moves with migrated pool."
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/history/history_008_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/history/history_008_pos.ksh
index 8e174dcb7ebf..26f728bb1779 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/history/history_008_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/history/history_008_pos.ksh
@@ -55,8 +55,7 @@ log_assert "Pool history records all recursive operations."
log_onexit cleanup
root_testfs=$TESTPOOL/$TESTFS
-fs1=$root_testfs/fs1; fs2=$root_testfs/fs2; fs3=$root_testfs/fs3
-for fs in $fs1 $fs2 $fs3; do
+for fs in $root_testfs/fs{1..3}; do
log_must zfs create $fs
done
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/history/history_010_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/history/history_010_pos.ksh
index 2c32b1b6cefa..57a7cb4466d0 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/history/history_010_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/history/history_010_pos.ksh
@@ -66,10 +66,8 @@ add_user $HIST_GROUP $HIST_USER
#
# chmod 0750 $HOME
#
-user_run $HIST_USER zfs list
-if [ $? -ne 0 ]; then
- log_unsupported "Test user $HIST_USER cannot execute zfs utilities"
-fi
+user_run $HIST_USER zfs list ||
+ log_unsupported "Test user $HIST_USER cannot execute zfs utilities"
run_and_verify "zfs create $root_testfs" "-l"
run_and_verify "zfs allow $HIST_GROUP snapshot,mount $root_testfs" "-l"
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/history/history_common.kshlib b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/history/history_common.kshlib
index ff3260f3c0f2..95f9441bf692 100644
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/history/history_common.kshlib
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/history/history_common.kshlib
@@ -52,14 +52,12 @@ function run_and_verify
flags="$2"
if is_illumos; then
- histcmd=$(echo $fullcmd | sed 's/\/usr\/sbin\///g')
+ histcmd=$(echo $fullcmd | sed 's=/usr/sbin/==g')
else
- histcmd=$(echo $fullcmd | sed 's/^.*\/\(zpool .*\).*$/\1/')
- histcmd=$(echo $histcmd | sed 's/^.*\/\(zfs .*\).*$/\1/')
+ histcmd=$(echo $fullcmd | sed -E 's=^.*/(zpool|zfs)$=\1=')
fi
- cmd=$(echo $histcmd | awk '{print $1}')
- subcmd=$(echo $histcmd | awk '{print $2}')
+ read -r cmd subcmd _ <<<"$histcmd"
# If we aren't running zpool or zfs, something is wrong
[[ $cmd == "zpool" || $cmd == "zfs" ]] || \
@@ -77,11 +75,10 @@ function run_and_verify
log_must_busy user_run $user "$fullcmd"
fi
zpool history $flags $pool > $TMP_HISTORY 2>/dev/null
- diff $OLD_HISTORY $TMP_HISTORY | grep "^> " | sed 's/^> //g' \
- > $NEW_HISTORY
+ diff $OLD_HISTORY $TMP_HISTORY | sed -n 's/^> //gp' > $NEW_HISTORY
# Verify what's common to every case, regardless of zpool history flags.
- grep "$histcmd" $NEW_HISTORY >/dev/null 2>&1 || \
+ grep -q "$histcmd" $NEW_HISTORY || \
log_fail "Didn't find \"$histcmd\" in pool history"
# If 'zpool history' was called without any flags, then we're done.
@@ -116,8 +113,7 @@ function verify_long
suffix=":freebsd"
fi
- grep -q "$cmd \[user $uid ($user) on $hname$suffix\]" $NEW_HISTORY
- if [[ $? != 0 ]]; then
+ if ! grep -q "$cmd \[user $uid ($user) on $hname$suffix\]" $NEW_HISTORY; then
log_note "Couldn't find long information for \"$cmd\""
return 1
fi
@@ -133,7 +129,8 @@ function verify_hold
[[ $flags =~ "i" ]] || return 1
- typeset tag=$(echo $cmd | awk '{print $4}')
+ typeset tag _
+ read -r _ _ _ tag _ <<<"$cmd"
typeset fullname=${cmd##* }
typeset dsname=${fullname%%@*}
typeset snapname=${fullname##*@}
@@ -141,9 +138,7 @@ function verify_hold
# This works whether or not the hold was recursive
for ds in $(zfs list -r -Ho name -t snapshot $dsname | \
grep "@$snapname"); do
- grep "$subcmd $ds ([0-9]*) tag=$tag" $NEW_HISTORY \
- >/dev/null 2>&1
- if [[ $? != 0 ]]; then
+ if ! grep -q "$subcmd $ds ([0-9]*) tag=$tag" $NEW_HISTORY; then
log_note "Didn't find hold on $ds with $tag"
return 1
fi
@@ -172,15 +167,12 @@ function verify_rollback
typeset rb_fs=${dsname}/%rollback
typeset snapname=${fullname##*@}
- grep "clone swap $rb_fs ([0-9]*) parent=$parent_fs" $NEW_HISTORY \
- >/dev/null 2>&1
- if [[ $? != 0 ]]; then
+ if ! grep -q "clone swap $rb_fs ([0-9]*) parent=$parent_fs" $NEW_HISTORY ; then
log_note "Didn't find rollback clone swap in pool history"
return 1
fi
- grep "destroy $rb_fs" $NEW_HISTORY >/dev/null 2>&1
- if [[ $? != 0 ]]; then
+ if ! grep -q "destroy $rb_fs" $NEW_HISTORY; then
log_note "Didn't find rollback destroy in pool history"
return 1
fi
@@ -201,9 +193,7 @@ function verify_inherit
# This works whether or not the inherit was recursive
for ds in $(zfs list -r -Ho name -t filesystem $dsname); do
- grep "$subcmd $ds ([0-9]*) ${prop}=" $NEW_HISTORY >/dev/null \
- 2>&1
- if [[ $? != 0 ]]; then
+ if ! grep -q "$subcmd $ds ([0-9]*) ${prop}=" $NEW_HISTORY; then
log_note "Didn't find inherit history for $ds"
return 1
fi
@@ -231,8 +221,7 @@ function verify_allow
# - Whether the operation applies locally or to descendent datasets (or
# both)
#
- echo $cmd | awk '{i = NF - 1; print $i}' | grep '@' >/dev/null \
- 2>&1 && is_set=1
+ echo $cmd | awk '$(NF - 1) ~ /@/ {exit 1}' || is_set=1
dsname=${cmd##* }
[[ $cmd =~ "-l " ]] && lflag=1
[[ $cmd =~ "-d " ]] && dflag=1
@@ -254,9 +243,7 @@ function verify_allow
[[ -n $is_set ]] && str="S-\$@"
tmp=${cmd#*@}
code="$str${tmp% *}"
- grep "permission $subcmd $dsname ([0-9]*) $code" \
- $NEW_HISTORY >/dev/null 2>&1
- if [[ $? != 0 ]]; then
+ if ! grep -q "permission $subcmd $dsname ([0-9]*) $code" $NEW_HISTORY; then
log_note "Couldn't find $code in $NEW_HISTORY"
return 1
fi
@@ -265,9 +252,7 @@ function verify_allow
[[ -n $is_set ]] && str="C-\$"
tmp=${cmd#*-c}
code="$str${tmp% *}"
- grep "permission $subcmd $dsname ([0-9]*) $code" \
- $NEW_HISTORY >/dev/null 2>&1
- if [ $? != 0 ]]; then
+ if ! grep "permission $subcmd $dsname ([0-9]*) $code" $NEW_HISTORY; then
log_note "Couldn't find $code in $NEW_HISTORY"
return 1
fi
@@ -275,22 +260,18 @@ function verify_allow
str="u"
[[ -n $is_set ]] && str="U"
tmp=${cmd##*-u }
- opt=$(echo $tmp | awk '{print $2}')
+ read -r _ opt _ <<<"$opt"
uid=$(id -u ${tmp%% *})
if [[ -n $lflag ]]; then
code="${str}l\$$uid $opt"
- grep "permission $subcmd $dsname ([0-9]*) $code" \
- $NEW_HISTORY >/dev/null 2>&1
- if [ $? != 0 ]]; then
+ if grep -q "permission $subcmd $dsname ([0-9]*) $code" $NEW_HISTORY]; then
log_note "Couldn't find $code in $NEW_HISTORY"
return 1
fi
fi
if [[ -n $dflag ]]; then
code="${str}d\$$uid $opt"
- grep "permission $subcmd $dsname ([0-9]*) $code" \
- $NEW_HISTORY >/dev/null 2>&1
- if [ $? != 0 ]]; then
+ if grep -q "permission $subcmd $dsname ([0-9]*) $code" $NEW_HISTORY]; then
log_note "Couldn't find $code in $NEW_HISTORY"
return 1
fi
@@ -299,22 +280,18 @@ function verify_allow
str="g"
[[ -n $is_set ]] && str="G"
tmp=${cmd##*-g }
- opt=$(echo $tmp | awk '{print $2}')
+ read -r _ opt _ <<<"$opt"
gid=$(awk -F: "/^${tmp%% *}:/ {print \$3}" /etc/group)
if [[ -n $lflag ]]; then
code="${str}l\$$gid $opt"
- grep "permission $subcmd $dsname ([0-9]*) $code" \
- $NEW_HISTORY >/dev/null 2>&1
- if [ $? != 0 ]]; then
+ if ! grep -q "permission $subcmd $dsname ([0-9]*) $code" $NEW_HISTORY; then
log_note "Couldn't find $code in $NEW_HISTORY"
return 1
fi
fi
if [[ -n $dflag ]]; then
code="${str}d\$$gid $opt"
- grep "permission $subcmd $dsname ([0-9]*) $code" \
- $NEW_HISTORY >/dev/null 2>&1
- if [ $? != 0 ]]; then
+ if ! grep -q "permission $subcmd $dsname ([0-9]*) $code" $NEW_HISTORY; then
log_note "Couldn't find $code in $NEW_HISTORY"
return 1
fi
@@ -326,18 +303,14 @@ function verify_allow
opt=${opt%% *}
if [[ -n $lflag ]]; then
code="${str}l\$ $opt"
- grep "permission $subcmd $dsname ([0-9]*) $code" \
- $NEW_HISTORY >/dev/null 2>&1
- if [ $? != 0 ]]; then
+ if ! grep -q "permission $subcmd $dsname ([0-9]*) $code" $NEW_HISTORY; then
log_note "Couldn't find $code in $NEW_HISTORY"
return 1
fi
fi
if [[ -n $dflag ]]; then
code="${str}d\$ $opt"
- grep "permission $subcmd $dsname ([0-9]*) $code" \
- $NEW_HISTORY >/dev/null 2>&1
- if [ $? != 0 ]]; then
+ if ! grep -q "permission $subcmd $dsname ([0-9]*) $code" $NEW_HISTORY; then
log_note "Couldn't find $code in $NEW_HISTORY"
return 1
fi
@@ -373,16 +346,14 @@ function verify_destroy
[[ $dsname =~ "@" ]] && typeset is_snap=1
if [[ -n $is_snap ]]; then
- grep "ioctl destroy_snaps" $NEW_HISTORY >/dev/null 2>&1
- if [[ $? != 0 ]]; then
+ if ! grep -q "ioctl destroy_snaps" $NEW_HISTORY; then
log_note "Didn't find ioctl while destroying $dsname"
return 1
fi
fi
# This should be present for datasets and snapshots alike
- grep "destroy $dsname" $NEW_HISTORY >/dev/null 2>&1
- if [[ $? != 0 ]]; then
+ if ! grep -q "destroy $dsname" $NEW_HISTORY; then
log_note "Didn't find \"destroy\" for $dsname"
return 1
fi
@@ -401,9 +372,7 @@ function verify_snapshot
typeset dsname=${fullname%%@*}
typeset snapname=${fullname##*@}
- grep "\[txg:[0-9]*\] $subcmd $fullname ([0-9]*)" $NEW_HISTORY \
- >/dev/null 2>&1
- if [[ $? != 0 ]]; then
+ if ! grep -q "\[txg:[0-9]*\] $subcmd $fullname ([0-9]*)" $NEW_HISTORY; then
log_note "Didn't find snapshot command for $fullname"
return 1
fi
@@ -411,8 +380,7 @@ function verify_snapshot
# This works whether or not the snapshot was recursive
for ds in $(zfs list -r -Ho name -t snapshot $dsname | \
grep "@$snapname"); do
- grep "^[ ]* $ds$" $NEW_HISTORY >/dev/null 2>&1
- if [[ $? != 0 ]]; then
+ if ! grep -q "^[ ]* $ds$" $NEW_HISTORY; then
log_note "Didn't find \"ioctl snapshot\" for $ds"
return 1
fi
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/hkdf/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/hkdf/Makefile.am
deleted file mode 100644
index 8ac9053223a4..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/hkdf/Makefile.am
+++ /dev/null
@@ -1,17 +0,0 @@
-include $(top_srcdir)/config/Rules.am
-
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/hkdf
-
-dist_pkgdata_SCRIPTS = \
- setup.ksh \
- cleanup.ksh \
- run_hkdf_test.ksh
-
-pkgexecdir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/hkdf
-
-pkgexec_PROGRAMS = \
- hkdf_test
-
-hkdf_test_SOURCES = hkdf_test.c
-hkdf_test_LDADD = \
- $(abs_top_builddir)/lib/libzpool/libzpool.la
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/hkdf/cleanup.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/hkdf/cleanup.ksh
deleted file mode 100755
index 2bdca1950d37..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/hkdf/cleanup.ksh
+++ /dev/null
@@ -1,22 +0,0 @@
-#!/bin/ksh
-
-#
-# This file and its contents are supplied under the terms of the
-# Common Development and Distribution License ("CDDL"), version 1.0.
-# You may only use this file in accordance with the terms of version
-# 1.0 of the CDDL.
-#
-# A full copy of the text of the CDDL should have accompanied this
-# source. A copy of the CDDL is also available via the Internet at
-# http://www.illumos.org/license/CDDL.
-#
-
-#
-# Copyright (c) 2017 by Datto Inc. All rights reserved.
-#
-
-. $STF_SUITE/include/libtest.shlib
-
-verify_runnable "global"
-
-log_pass
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/hkdf/run_hkdf_test.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/hkdf/run_hkdf_test.ksh
deleted file mode 100755
index 5fde0b837d0f..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/hkdf/run_hkdf_test.ksh
+++ /dev/null
@@ -1,30 +0,0 @@
-#!/bin/ksh
-
-#
-# This file and its contents are supplied under the terms of the
-# Common Development and Distribution License ("CDDL"), version 1.0.
-# You may only use this file in accordance with the terms of version
-# 1.0 of the CDDL.
-#
-# A full copy of the text of the CDDL should have accompanied this
-# source. A copy of the CDDL is also available via the Internet at
-# http://www.illumos.org/license/CDDL.
-#
-
-#
-# Copyright (c) 2017 by Datto Inc. All rights reserved.
-#
-
-. $STF_SUITE/include/libtest.shlib
-
-#
-# DESCRIPTION:
-# Call the hkdf_test tool to test ZFS's HKDF implementation against
-# a few test vectors.
-#
-
-log_assert "Run the tests for the HKDF algorithm."
-
-log_must $STF_SUITE/tests/functional/hkdf/hkdf_test
-
-log_pass "HKDF tests pass."
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/hkdf/setup.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/hkdf/setup.ksh
deleted file mode 100755
index 2bdca1950d37..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/hkdf/setup.ksh
+++ /dev/null
@@ -1,22 +0,0 @@
-#!/bin/ksh
-
-#
-# This file and its contents are supplied under the terms of the
-# Common Development and Distribution License ("CDDL"), version 1.0.
-# You may only use this file in accordance with the terms of version
-# 1.0 of the CDDL.
-#
-# A full copy of the text of the CDDL should have accompanied this
-# source. A copy of the CDDL is also available via the Internet at
-# http://www.illumos.org/license/CDDL.
-#
-
-#
-# Copyright (c) 2017 by Datto Inc. All rights reserved.
-#
-
-. $STF_SUITE/include/libtest.shlib
-
-verify_runnable "global"
-
-log_pass
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/inheritance/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/inheritance/Makefile.am
deleted file mode 100644
index 3c624621f28a..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/inheritance/Makefile.am
+++ /dev/null
@@ -1,57 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/inheritance
-dist_pkgdata_SCRIPTS = \
- cleanup.ksh \
- inherit_001_pos.ksh
-
-dist_pkgdata_DATA = \
- README.config \
- README.state \
- inherit.kshlib \
- config001.cfg \
- config002.cfg \
- config003.cfg \
- config004.cfg \
- config005.cfg \
- config006.cfg \
- config007.cfg \
- config008.cfg \
- config009.cfg \
- config010.cfg \
- config011.cfg \
- config012.cfg \
- config013.cfg \
- config014.cfg \
- config015.cfg \
- config016.cfg \
- config017.cfg \
- config018.cfg \
- config019.cfg \
- config020.cfg \
- config021.cfg \
- config022.cfg \
- config023.cfg \
- config024.cfg \
- state001.cfg \
- state002.cfg \
- state003.cfg \
- state004.cfg \
- state005.cfg \
- state006.cfg \
- state007.cfg \
- state008.cfg \
- state009.cfg \
- state010.cfg \
- state011.cfg \
- state012.cfg \
- state013.cfg \
- state014.cfg \
- state015.cfg \
- state016.cfg \
- state017.cfg \
- state018.cfg \
- state019.cfg \
- state020.cfg \
- state021.cfg \
- state022.cfg \
- state023.cfg \
- state024.cfg
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/inheritance/inherit.kshlib b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/inheritance/inherit.kshlib
index cd6bd5c027ca..a485d0521d1f 100644
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/inheritance/inherit.kshlib
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/inheritance/inherit.kshlib
@@ -34,18 +34,12 @@
#
function get_prop_src # property dataset
{
- typeset prop_val
typeset prop=$1
typeset dataset=$2
- prop_val=`zfs get -H -o source $prop $dataset`
-
- if [[ $? -ne 0 ]]; then
- log_fail "Unable to determine the source of $prop " \
+ zfs get -H -o source $prop $dataset ||
+ log_fail "Unable to determine the source of $prop" \
"property for dataset $dataset"
- else
- echo $prop_val
- fi
}
#
@@ -63,7 +57,7 @@ function verify_prop_src # child_dataset property expected_src
typeset prop=$2
typeset expected=$3
- prop_src=`get_prop_src $prop $target`
+ prop_src=$(get_prop_src $prop $target)
#
# Rather than just checking if $prop_src == $expected
@@ -105,7 +99,7 @@ function set_n_verify_prop #property value dataset
typeset dataset=$3
zfs set $prop=$prop_val $dataset
- check_val=`get_prop $prop $dataset`
+ check_val=$(get_prop $prop $dataset)
if [[ $check_val != $prop_val ]]; then
log_fail "Property $prop of $dataset has value $check_val"\
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/inheritance/inherit_001_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/inheritance/inherit_001_pos.ksh
index 95dc7359f278..4dfc3a8986a3 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/inheritance/inherit_001_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/inheritance/inherit_001_pos.ksh
@@ -337,9 +337,7 @@ function scan_state { #state-file
for p in ${prop[i]} ${prop[((i+1))]}; do
zfs $op $p $target
- ret=$?
- check_failure $ret "zfs $op $p \
- $target"
+ check_failure $? "zfs $op $p $target"
done
fi
for check_obj in $list; do
@@ -349,16 +347,14 @@ function scan_state { #state-file
# check_failure to keep journal small
verify_prop_src $check_obj $p \
$final_src
- ret=$?
- check_failure $ret "verify" \
+ check_failure $? "verify" \
"_prop_src $check_obj $p" \
"$final_src"
# Again, to keep journal size down.
verify_prop_val $p $check_obj \
$final_src $j
- ret=$?
- check_failure $ret "verify" \
+ check_failure $? "verify" \
"_prop_val $check_obj $p" \
"$final_src"
done
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/inuse/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/inuse/Makefile.am
deleted file mode 100644
index c541e57eaa31..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/inuse/Makefile.am
+++ /dev/null
@@ -1,14 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/inuse
-dist_pkgdata_SCRIPTS = \
- setup.ksh \
- inuse_001_pos.ksh \
- inuse_003_pos.ksh \
- inuse_004_pos.ksh \
- inuse_005_pos.ksh \
- inuse_006_pos.ksh \
- inuse_007_pos.ksh \
- inuse_008_pos.ksh \
- inuse_009_pos.ksh
-
-dist_pkgdata_DATA = \
- inuse.cfg
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/inuse/inuse_001_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/inuse/inuse_001_pos.ksh
index f824661c0067..25a807025c87 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/inuse/inuse_001_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/inuse/inuse_001_pos.ksh
@@ -49,7 +49,7 @@ function cleanup
# Remove dump device.
#
if [[ -n $PREVDUMPDEV ]]; then
- log_must dumpadm -u -d $PREVDUMPDEV > /dev/null
+ log_must eval "dumpadm -u -d $PREVDUMPDEV > /dev/null"
fi
destroy_pool $TESTPOOL
@@ -61,16 +61,16 @@ log_onexit cleanup
typeset dumpdev=""
-PREVDUMPDEV=`dumpadm | grep "Dump device" | awk '{print $3}'`
+PREVDUMPDEV=`dumpadm | awk '/Dump device/ {print $3}'`
log_note "Zero $FS_DISK0"
log_must cleanup_devices $FS_DISK0
log_note "Configuring $rawdisk0 as dump device"
-log_must dumpadm -d $rawdisk0 > /dev/null
+log_must eval "dumpadm -d $rawdisk0 > /dev/null"
log_note "Confirm that dump device has been setup"
-dumpdev=`dumpadm | grep "Dump device" | awk '{print $3}'`
+dumpdev=`dumpadm | awk '/Dump device/ {print $3}'`
[[ -z "$dumpdev" ]] && log_untested "No dump device has been configured"
[[ "$dumpdev" != "$rawdisk0" ]] && \
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/inuse/inuse_003_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/inuse/inuse_003_pos.ksh
index 07d6ac17557c..8c984df3089e 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/inuse/inuse_003_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/inuse/inuse_003_pos.ksh
@@ -58,25 +58,21 @@ function cleanup
log_note "Kill off ufsdump process if still running"
kill -0 $PIDUFSDUMP > /dev/null 2>&1 && \
- log_must kill -9 $PIDUFSDUMP > /dev/null 2>&1
+ log_must eval "kill -9 $PIDUFSDUMP"
#
# Note: It would appear that ufsdump spawns a number of processes
# which are not killed when the $PIDUFSDUMP is whacked. So best bet
# is to find the rest of the them and deal with them individually.
#
- for all in `pgrep ufsdump`
- do
- kill -9 $all > /dev/null 2>&1
- done
+ kill -9 `pgrep ufsdump` > /dev/null 2>&1
log_note "Kill off ufsrestore process if still running"
kill -0 $PIDUFSRESTORE > /dev/null 2>&1 && \
- log_must kill -9 $PIDUFSRESTORE > /dev/null 2>&1
+ log_must eval "kill -9 $PIDUFSRESTORE"
ismounted $UFSMP ufs && log_must umount $UFSMP
- rm -rf $UFSMP
- rm -rf $TESTDIR
+ rm -rf $UFSMP $TESTDIR
#
# Tidy up the disks we used.
@@ -96,8 +92,8 @@ typeset -i filenum=0
typeset cwd=""
log_note "Make a ufs filesystem on source $rawdisk1"
-new_fs $rawdisk1 > /dev/null 2>&1
-(($? != 0)) && log_untested "Unable to create ufs filesystem on $rawdisk1"
+new_fs $rawdisk1 > /dev/null 2>&1 ||
+ log_untested "Unable to create ufs filesystem on $rawdisk1"
log_must mkdir -p $UFSMP
@@ -108,9 +104,9 @@ log_note "Now create some directories and files to be ufsdump'ed"
while (($dirnum <= 2)); do
log_must mkdir $bigdir${dirnum}
while (( $filenum <= 2 )); do
- file_write -o create -f $bigdir${dirnum}/file${filenum} \
+ if ! file_write -o create -f $bigdir${dirnum}/file${filenum} \
-b $BLOCK_SIZE -c $BLOCK_COUNT
- if [[ $? -ne 0 ]]; then
+ then
if [[ $dirnum -lt 3 ]]; then
log_fail "file_write only wrote" \
"<(( $dirnum * 3 + $filenum ))>" \
@@ -139,9 +135,7 @@ log_note "Attempt to take the source device in use by ufsdump as spare device"
log_mustnot zpool create $TESTPOOL1 "$FS_DISK2" spare "$disk1"
log_mustnot poolexists $TESTPOOL1
-wait $PIDUFSDUMP
-typeset -i retval=$?
-(($retval != 0)) && log_fail "ufsdump failed with error code $ret_val"
+wait $PIDUFSDUMP || log_fail "ufsdump failed with error code $?"
log_must mount $disk1 $UFSMP
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/inuse/inuse_004_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/inuse/inuse_004_pos.ksh
index a9725e06dcf0..8e051d8b6f73 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/inuse/inuse_004_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/inuse/inuse_004_pos.ksh
@@ -52,10 +52,10 @@ function cleanup
# to work correctly. So its reproduced below. Still need to fully
# understand why default_cleanup does not work correctly from here.
#
- log_must zfs umount $TESTPOOL/$TESTFS
+ log_must zfs umount $TESTPOOL/$TESTFS
- rm -rf $TESTDIR || \
- log_unresolved Could not remove $TESTDIR
+ rm -rf $TESTDIR ||
+ log_unresolved Could not remove $TESTDIR
log_must zfs destroy $TESTPOOL/$TESTFS
destroy_pool $TESTPOOL
@@ -71,21 +71,11 @@ function mini_format
if is_linux; then
parted $disk -s -- mklabel gpt
- typeset -i retval=$?
elif is_freebsd; then
gpart create -s gpt $disk
- typeset -i retval=$?
else
- typeset format_file=$TEST_BASE_DIR/format_in.$$.1
- echo "partition" > $format_file
- echo "modify" >> $format_file
-
- format -e -s -d $disk -f $format_file
- typeset -i retval=$?
-
- rm -rf $format_file
+ format -e -s -d $disk -f <(printf '%s\n' partition modify)
fi
- return $retval
}
log_assert "format will disallow modification of a mounted zfs disk partition"\
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/inuse/inuse_006_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/inuse/inuse_006_pos.ksh
index 9657322526e7..2222721afd8d 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/inuse/inuse_006_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/inuse/inuse_006_pos.ksh
@@ -77,7 +77,7 @@ set -A vdevs "" "mirror" "raidz" "raidz1" "raidz2"
typeset -i i=0
-PREVDUMPDEV=`dumpadm | grep "Dump device" | awk '{print $3}'`
+PREVDUMPDEV=`dumpadm | awk '/Dump device/ {print $3}'`
unset NOINUSE_CHECK
while (( i < ${#vdevs[*]} )); do
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/inuse/inuse_007_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/inuse/inuse_007_pos.ksh
index b96b80890ed8..775f1af63bf1 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/inuse/inuse_007_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/inuse/inuse_007_pos.ksh
@@ -82,7 +82,7 @@ set -A vdevs "" "mirror" "raidz" "raidz1" "raidz2"
typeset -i i=0
-PREVDUMPDEV=`dumpadm | grep "Dump device" | awk '{print $3}'`
+PREVDUMPDEV=`dumpadm | awk '/Dump device/ {print $3}'`
while (( i < ${#vdevs[*]} )); do
typeset spare="spare $sdisks"
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/io/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/io/Makefile.am
deleted file mode 100644
index 44c0d02d6efe..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/io/Makefile.am
+++ /dev/null
@@ -1,13 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/io
-dist_pkgdata_SCRIPTS = \
- setup.ksh \
- cleanup.ksh \
- sync.ksh \
- psync.ksh \
- libaio.ksh \
- io_uring.ksh \
- posixaio.ksh \
- mmap.ksh
-
-dist_pkgdata_DATA = \
- io.cfg
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/io/io_uring.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/io/io_uring.ksh
index 2d2b18f8bb5b..1ee5cee52227 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/io/io_uring.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/io/io_uring.ksh
@@ -44,7 +44,7 @@ if [[ $(linux_version) -lt $(linux_version "5.1") ]]; then
log_unsupported "Requires io_uring support"
fi
-fio --ioengine=io_uring --parse-only || log_unsupported "io_uring support required"
+fio --ioengine=io_uring --parse-only || log_unsupported "fio io_uring support required"
function cleanup
{
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/io/libaio.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/io/libaio.ksh
index c434ad90ddd7..ef100209beac 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/io/libaio.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/io/libaio.ksh
@@ -39,6 +39,8 @@
verify_runnable "global"
+command -v fio > /dev/null || log_unsupported "fio missing"
+
function cleanup
{
log_must rm -f "$mntpnt/rw*"
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/io/mmap.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/io/mmap.ksh
index e9600787a8bc..742c1f08f1c7 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/io/mmap.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/io/mmap.ksh
@@ -37,7 +37,7 @@
# 2. Repeat the test with additional fio(1) options.
#
-if ! compare_version_gte $(fio --version) "fio-2.3"; then
+if ! compare_version_gte "$(fio --version)" "fio-2.3"; then
log_unsupported "Requires fio-2.3 or newer"
fi
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/io/posixaio.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/io/posixaio.ksh
index 0758164c1673..c720aef9535f 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/io/posixaio.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/io/posixaio.ksh
@@ -39,6 +39,8 @@
verify_runnable "global"
+command -v fio > /dev/null || log_unsupported "fio missing"
+
function cleanup
{
log_must rm -f "$mntpnt/rw*"
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/io/psync.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/io/psync.ksh
index efeb1103d8bb..8feb87d93a7c 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/io/psync.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/io/psync.ksh
@@ -39,6 +39,8 @@
verify_runnable "global"
+command -v fio > /dev/null || log_unsupported "fio missing"
+
function cleanup
{
log_must rm -f "/$TESTPOOL/rw*"
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/io/sync.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/io/sync.ksh
index 83f346c6972a..aaaa126efb1f 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/io/sync.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/io/sync.ksh
@@ -39,6 +39,8 @@
verify_runnable "global"
+command -v fio > /dev/null || log_unsupported "fio missing"
+
function cleanup
{
log_must rm -f "$mntpnt/rw*"
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/l2arc/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/l2arc/Makefile.am
deleted file mode 100644
index 09f4c1d0d74f..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/l2arc/Makefile.am
+++ /dev/null
@@ -1,15 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/l2arc
-dist_pkgdata_SCRIPTS = \
- cleanup.ksh \
- setup.ksh \
- l2arc_arcstats_pos.ksh \
- l2arc_l2miss_pos.ksh \
- l2arc_mfuonly_pos.ksh \
- persist_l2arc_001_pos.ksh \
- persist_l2arc_002_pos.ksh \
- persist_l2arc_003_neg.ksh \
- persist_l2arc_004_pos.ksh \
- persist_l2arc_005_pos.ksh
-
-dist_pkgdata_DATA = \
- l2arc.cfg
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/l2arc/l2arc_arcstats_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/l2arc/l2arc_arcstats_pos.ksh
index 3e76347b029a..69d60ab8bb90 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/l2arc/l2arc_arcstats_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/l2arc/l2arc_arcstats_pos.ksh
@@ -40,6 +40,8 @@
verify_runnable "global"
+command -v fio > /dev/null || log_unsupported "fio missing"
+
log_assert "L2ARC MFU/MRU arcstats do not leak."
function cleanup
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/l2arc/l2arc_l2miss_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/l2arc/l2arc_l2miss_pos.ksh
index 783484f52c13..c9d5d7ffe1f1 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/l2arc/l2arc_l2miss_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/l2arc/l2arc_l2miss_pos.ksh
@@ -38,6 +38,8 @@
verify_runnable "global"
+command -v fio > /dev/null || log_unsupported "fio missing"
+
log_assert "l2arc_misses does not increment upon reads from a pool without l2arc."
function cleanup
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/l2arc/l2arc_mfuonly_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/l2arc/l2arc_mfuonly_pos.ksh
index 5d0198c90c16..f2bada0ebbec 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/l2arc/l2arc_mfuonly_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/l2arc/l2arc_mfuonly_pos.ksh
@@ -39,6 +39,8 @@
verify_runnable "global"
+command -v fio > /dev/null || log_unsupported "fio missing"
+
log_assert "l2arc_mfuonly does not cache MRU buffers."
function cleanup
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/l2arc/persist_l2arc_001_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/l2arc/persist_l2arc_001_pos.ksh
index 0a9049490c71..6f7b9aff7c38 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/l2arc/persist_l2arc_001_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/l2arc/persist_l2arc_001_pos.ksh
@@ -49,6 +49,8 @@
verify_runnable "global"
+command -v fio > /dev/null || log_unsupported "fio missing"
+
log_assert "Persistent L2ARC with an unencrypted ZFS file system succeeds."
function cleanup
@@ -87,8 +89,7 @@ arcstat_quiescence_noecho l2_size
log_must zpool export $TESTPOOL
arcstat_quiescence_noecho l2_feeds
-typeset l2_dh_log_blk=$(zdb -l $VDEV_CACHE | grep log_blk_count | \
- awk '{print $2}')
+typeset l2_dh_log_blk=$(zdb -l $VDEV_CACHE | awk '/log_blk_count/ {print $2}')
typeset l2_rebuild_log_blk_start=$(get_arcstat l2_rebuild_log_blks)
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/l2arc/persist_l2arc_002_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/l2arc/persist_l2arc_002_pos.ksh
index 93982e6c605b..3b893d28da6a 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/l2arc/persist_l2arc_002_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/l2arc/persist_l2arc_002_pos.ksh
@@ -52,6 +52,8 @@
verify_runnable "global"
+command -v fio > /dev/null || log_unsupported "fio missing"
+
log_assert "Persistent L2ARC with an encrypted ZFS file system succeeds."
function cleanup
@@ -90,8 +92,7 @@ arcstat_quiescence_noecho l2_size
log_must zpool export $TESTPOOL
arcstat_quiescence_noecho l2_feeds
-typeset l2_dh_log_blk=$(zdb -l $VDEV_CACHE | grep log_blk_count | \
- awk '{print $2}')
+typeset l2_dh_log_blk=$(zdb -l $VDEV_CACHE | awk '/log_blk_count/ {print $2}')
typeset l2_rebuild_log_blk_start=$(get_arcstat l2_rebuild_log_blks)
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/l2arc/persist_l2arc_003_neg.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/l2arc/persist_l2arc_003_neg.ksh
index fe35c8fc4500..f8dc2b108f0d 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/l2arc/persist_l2arc_003_neg.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/l2arc/persist_l2arc_003_neg.ksh
@@ -38,6 +38,8 @@
verify_runnable "global"
+command -v fio > /dev/null || log_unsupported "fio missing"
+
log_assert "Persistent L2ARC fails as expected when L2ARC_REBUILD_ENABLED = 0."
function cleanup
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/l2arc/persist_l2arc_004_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/l2arc/persist_l2arc_004_pos.ksh
index b40703180687..8a572c26469c 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/l2arc/persist_l2arc_004_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/l2arc/persist_l2arc_004_pos.ksh
@@ -40,6 +40,8 @@
verify_runnable "global"
+command -v fio > /dev/null || log_unsupported "fio missing"
+
log_assert "Off/onlining an L2ARC device results in rebuilding L2ARC, vdev not present."
function cleanup
@@ -78,8 +80,7 @@ log_must zpool export $TESTPOOL
arcstat_quiescence_noecho l2_feeds
typeset l2_rebuild_log_blk_start=$(get_arcstat l2_rebuild_log_blks)
-typeset l2_dh_log_blk=$(zdb -l $VDEV_CACHE | grep log_blk_count | \
- awk '{print $2}')
+typeset l2_dh_log_blk=$(zdb -l $VDEV_CACHE | awk '/log_blk_count/ {print $2}')
log_must zpool import -d $VDIR $TESTPOOL
log_must zpool online $TESTPOOL $VDEV_CACHE
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/l2arc/persist_l2arc_005_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/l2arc/persist_l2arc_005_pos.ksh
index 8ad648519f5c..9663437c6597 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/l2arc/persist_l2arc_005_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/l2arc/persist_l2arc_005_pos.ksh
@@ -39,6 +39,8 @@
verify_runnable "global"
+command -v fio > /dev/null || log_unsupported "fio missing"
+
log_assert "Off/onlining an L2ARC device results in rebuilding L2ARC, vdev present."
function cleanup
@@ -75,8 +77,7 @@ log_must zpool offline $TESTPOOL $VDEV_CACHE
arcstat_quiescence_noecho l2_size
typeset l2_rebuild_log_blk_start=$(get_arcstat l2_rebuild_log_blks)
-typeset l2_dh_log_blk=$(zdb -l $VDEV_CACHE | grep log_blk_count | \
- awk '{print $2}')
+typeset l2_dh_log_blk=$(zdb -l $VDEV_CACHE | awk '/log_blk_count/ {print $2}')
log_must zpool online $TESTPOOL $VDEV_CACHE
arcstat_quiescence_noecho l2_size
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/large_files/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/large_files/Makefile.am
deleted file mode 100644
index 0e471533090c..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/large_files/Makefile.am
+++ /dev/null
@@ -1,6 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/large_files
-dist_pkgdata_SCRIPTS = \
- setup.ksh \
- cleanup.ksh \
- large_files_001_pos.ksh \
- large_files_002_pos.ksh
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/largest_pool/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/largest_pool/Makefile.am
deleted file mode 100644
index 5f1473dede70..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/largest_pool/Makefile.am
+++ /dev/null
@@ -1,6 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/largest_pool
-dist_pkgdata_SCRIPTS = \
- largest_pool_001_pos.ksh
-
-dist_pkgdata_DATA = \
- largest_pool.cfg
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/largest_pool/largest_pool_001_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/largest_pool/largest_pool_001_pos.ksh
index 6f6acdafafe5..7955478502d1 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/largest_pool/largest_pool_001_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/largest_pool/largest_pool_001_pos.ksh
@@ -117,15 +117,12 @@ log_onexit cleanup
# units for 'df'. It must be greater than one.
# -----------------------------------------------------------------------
typeset str
-typeset -i ret
for volsize in $VOLSIZES; do
log_note "Create a pool which will contain a volume device"
log_must create_pool $TESTPOOL2 "$DISKS"
log_note "Create a volume device of desired sizes: $volsize"
- str=$(zfs create -sV $volsize $TESTPOOL2/$TESTVOL 2>&1)
- ret=$?
- if (( ret != 0 )); then
+ if ! str=$(zfs create -sV $volsize $TESTPOOL2/$TESTVOL 2>&1); then
if [[ is_32bit && \
$str == *${VOL_LIMIT_KEYWORD1}* || \
$str == *${VOL_LIMIT_KEYWORD2}* || \
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/libzfs/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/libzfs/Makefile.am
deleted file mode 100644
index 53cb635444ab..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/libzfs/Makefile.am
+++ /dev/null
@@ -1,17 +0,0 @@
-include $(top_srcdir)/config/Rules.am
-
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/libzfs
-
-pkgexecdir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/libzfs
-
-dist_pkgdata_SCRIPTS = \
- cleanup.ksh \
- setup.ksh \
- libzfs_input.ksh
-
-many_fds_LDADD = \
- $(abs_top_builddir)/lib/libzfs/libzfs.la
-
-pkgexec_PROGRAMS = many_fds
-many_fds_SOURCES = many_fds.c
-
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/libzfs/many_fds.c b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/libzfs/many_fds.c
index 6def57c5a51a..34029e0e32d0 100644
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/libzfs/many_fds.c
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/libzfs/many_fds.c
@@ -22,15 +22,13 @@
/*
* Copyright (C) 2015 STRATO AG.
*/
-#include <stdlib.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/stat.h>
+#include <err.h>
#include <fcntl.h>
#include <libzfs.h>
#include <sys/resource.h>
-#include <errno.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <unistd.h>
/*
* Check if libzfs works with more than 255 held file handles.
@@ -38,35 +36,23 @@
int
main(void)
{
- int i;
- struct rlimit limit;
- libzfs_handle_t *h;
-
- limit.rlim_cur = 65535;
- limit.rlim_max = 65535;
-
- if (setrlimit(RLIMIT_NOFILE, &limit) != 0) {
- (void) printf("many_fds: setrlimit() failed with errno=%d\n",
- errno);
- exit(1);
- }
+ struct rlimit limit = {
+ .rlim_cur = 64 * 1024,
+ .rlim_max = 64 * 1024,
+ };
+ if (setrlimit(RLIMIT_NOFILE, &limit) != 0)
+ err(1, "setrlimit()");
- for (i = 0; i < 255; ++i) {
- int fd = open("/dev/null", O_RDONLY);
- if (fd == -1) {
- (void) printf("open failed with errno=%d\n", errno);
- return (1);
- }
- }
+ int fd = open("/dev/null", O_RDONLY);
+ if (fd == -1)
+ err(1, "open()");
+ for (int i = 0; i < limit.rlim_cur / 2; ++i)
+ if (dup(fd) == -1)
+ err(1, "dup()");
- h = libzfs_init();
+ libzfs_handle_t *h = libzfs_init();
+ if (h == NULL)
+ err(1, "libzfs_init()");
- if (h != NULL) {
- libzfs_fini(h);
- return (0);
- } else {
- (void) printf("many_fds: libzfs_init() failed with errno=%d\n",
- errno);
- return (1);
- }
+ libzfs_fini(h);
}
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/limits/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/limits/Makefile.am
deleted file mode 100644
index 72455922485d..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/limits/Makefile.am
+++ /dev/null
@@ -1,9 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/limits
-dist_pkgdata_SCRIPTS = \
- setup.ksh \
- cleanup.ksh \
- filesystem_count.ksh \
- filesystem_limit.ksh \
- snapshot_count.ksh \
- snapshot_limit.ksh
-
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/link_count/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/link_count/Makefile.am
deleted file mode 100644
index bfb7154a6518..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/link_count/Makefile.am
+++ /dev/null
@@ -1,6 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/link_count
-dist_pkgdata_SCRIPTS = \
- cleanup.ksh \
- setup.ksh \
- link_count_001.ksh \
- link_count_root_inode.ksh
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/log_spacemap/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/log_spacemap/Makefile.am
deleted file mode 100644
index a1e523426c6a..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/log_spacemap/Makefile.am
+++ /dev/null
@@ -1,2 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/log_spacemap
-dist_pkgdata_SCRIPTS = log_spacemap_import_logs.ksh
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/log_spacemap/log_spacemap_import_logs.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/log_spacemap/log_spacemap_import_logs.ksh
index d1d283376bbb..d16574d3a8f7 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/log_spacemap/log_spacemap_import_logs.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/log_spacemap/log_spacemap_import_logs.ksh
@@ -57,7 +57,7 @@ function cleanup
log_onexit cleanup
LOGSM_POOL="logsm_import"
-TESTDISK="$(echo $DISKS | cut -d' ' -f1)"
+read -r TESTDISK _ <<<"$DISKS"
log_must zpool create -o cachefile=none -f $LOGSM_POOL $TESTDISK
log_must zfs create $LOGSM_POOL/fs
@@ -70,10 +70,7 @@ sync_all_pools
log_must set_tunable64 KEEP_LOG_SPACEMAPS_AT_EXPORT 1
log_must zpool export $LOGSM_POOL
-LOGSM_COUNT=$(zdb -m -e $LOGSM_POOL | grep "Log Spacemap object" | wc -l)
-if (( LOGSM_COUNT == 0 )); then
- log_fail "Pool does not have any log spacemaps after being exported"
-fi
+log_must eval "zdb -m -e $LOGSM_POOL | grep -q \"Log Spacemap object\""
log_must set_tunable64 METASLAB_DEBUG_LOAD 1
log_must zpool import $LOGSM_POOL
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/migration/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/migration/Makefile.am
deleted file mode 100644
index 9c4f244156ce..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/migration/Makefile.am
+++ /dev/null
@@ -1,20 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/migration
-dist_pkgdata_SCRIPTS = \
- setup.ksh \
- cleanup.ksh \
- migration_001_pos.ksh \
- migration_002_pos.ksh \
- migration_003_pos.ksh \
- migration_004_pos.ksh \
- migration_005_pos.ksh \
- migration_006_pos.ksh \
- migration_007_pos.ksh \
- migration_008_pos.ksh \
- migration_009_pos.ksh \
- migration_010_pos.ksh \
- migration_011_pos.ksh \
- migration_012_pos.ksh
-
-dist_pkgdata_DATA = \
- migration.cfg \
- migration.kshlib
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/migration/cleanup.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/migration/cleanup.ksh
index 1a1f3f42731e..79676d79e6fd 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/migration/cleanup.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/migration/cleanup.ksh
@@ -34,11 +34,9 @@
verify_runnable "global"
-ismounted $NONZFS_TESTDIR $NEWFS_DEFAULT_FS
-(( $? == 0 )) && log_must umount -f $NONZFS_TESTDIR
+ismounted $NONZFS_TESTDIR $NEWFS_DEFAULT_FS && log_must umount -f $NONZFS_TESTDIR
-ismounted $TESTPOOL/$TESTFS
-[[ $? == 0 ]] && log_must zfs umount -f $TESTDIR
+ismounted $TESTPOOL/$TESTFS && log_must zfs umount -f $TESTDIR
destroy_pool $TESTPOOL
DISK=${DISKS%% *}
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/migration/migration.cfg b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/migration/migration.cfg
index 12a5a7799b7a..308891b86d01 100644
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/migration/migration.cfg
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/migration/migration.cfg
@@ -31,7 +31,7 @@
. $STF_SUITE/include/libtest.shlib
export DISKSARRAY=$DISKS
-export DISK_ARRAY_NUM=$(echo ${DISKS} | nawk '{print NF}')
+export DISK_ARRAY_NUM=$(echo ${DISKS} | awk '{print NF}')
set -A disk_array $(find_disks $DISKS)
case "${#disk_array[*]}" in
0)
@@ -102,9 +102,8 @@ export DISK_COUNT ZFS_DISK NONZFS_DISK SINGLE_DISK ZFSSIDE_DISK NONZFSSIDE_DISK
export TESTFILE=/etc/passwd
export NONZFS_TESTDIR=$TESTDIR/nonzfstestdir
-tmp=`sum $TESTFILE`
-export SUMA=`echo $tmp | awk '{print $1}'`
-export SUMB=`echo $tmp | awk '{print $2}'`
+read -r SUMA SUMB _ < <(cksum $TESTFILE)
+export SUMA SUMB
export FS_SIZE=1g
export BNAME=`basename $TESTFILE`
export DNAME=`dirname $TESTFILE`
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/migration/migration.kshlib b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/migration/migration.kshlib
index a2b4ed99b11e..0362f0644f6f 100644
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/migration/migration.kshlib
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/migration/migration.kshlib
@@ -49,19 +49,11 @@ function prepare #srcdir cmd
{
typeset srcdir=$1
typeset cmd=$2
- typeset -i retval=0
cwd=$PWD
- cd $srcdir
- (( $? != 0 )) && return 1
-
- $cmd
- (( $? != 0 )) && return 1
-
- cd $cwd
- (( $? != 0 )) && return 1
-
- return 0
+ cd $srcdir || return 1
+ $cmd || return 1
+ cd $cwd || return 1
}
#
@@ -90,32 +82,22 @@ function migrate #destdir oldsuma oldsumb cmd
typeset oldsuma=$2
typeset oldsumb=$3
typeset cmd=$4
- typeset -i retval=0
cwd=$PWD
- cd $destdir
- (( $? != 0 )) && return 1
-
- $cmd
- (( $? != 0 )) && return 1
-
- sumy=`sum ./$BNAME`
- suma=`echo $sumy | awk '{print $1}'`
- sumb=`echo $sumy | awk '{print $2}'`
+ cd $destdir || return 1
+ $cmd || return 1
+ read -r suma sumb _ < <(cksum ./$BNAME)
+ cd $cwd || return 1
if (( $oldsuma != $suma )); then
log_note "sum values are not the same"
- retval=1
+ return 1
fi
if (( $oldsumb != $sumb )); then
log_note "sum values are not the same"
- retval=1
+ return 1
fi
-
- cd $cwd
- (( $? != 0 )) && return 1
- return $retval
}
function migrate_cpio
@@ -124,30 +106,20 @@ function migrate_cpio
typeset archive=$2
typeset oldsuma=$3
typeset oldsumb=$4
- typeset -i retval=0
cwd=$PWD
- cd $destdir
- (( $? != 0 )) && return 1
-
- cpio -iv < $archive
- (( $? != 0 )) && return 1
-
- sumy=`sum ./$BNAME`
- suma=`echo $sumy | awk '{print $1}'`
- sumb=`echo $sumy | awk '{print $2}'`
+ cd $destdir || return 1
+ cpio -iv < $archive || return 1
+ read -r suma sumb _ < <(cksum ./$BNAME)
+ cd $cwd
if (( $oldsuma != $suma )); then
log_note "sum values are not the same"
- retval=1
+ return 1
fi
if (( $oldsumb != $sumb )); then
log_note "sum values are not the same"
- retval=1
+ return 1
fi
-
- cd $cwd
- (( $? != 0 )) && return 1
- return $retval
}
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/migration/migration_001_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/migration/migration_001_pos.ksh
index 875d2f7c78be..3a4a4b7f8f74 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/migration/migration_001_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/migration/migration_001_pos.ksh
@@ -48,19 +48,14 @@ verify_runnable "both"
function cleanup
{
- rm -rf $TESTDIR/tar$$.tar
- rm -rf $TESTDIR/$BNAME
+ rm -rf $TESTDIR/tar$$.tar $TESTDIR/$BNAME
}
log_assert "Migrating test file from ZFS fs to ZFS fs using tar"
log_onexit cleanup
-prepare $DNAME "tar cf $TESTDIR/tar$$.tar $BNAME"
-(( $? != 0 )) && log_fail "Unable to create src archive"
-
-migrate $TESTDIR $SUMA $SUMB "tar xf $TESTDIR/tar$$.tar"
-(( $? != 0 )) && log_fail "Unable to successfully migrate test file from" \
- "ZFS fs to ZFS fs"
+log_must prepare $DNAME "tar cf $TESTDIR/tar$$.tar $BNAME"
+log_must migrate $TESTDIR $SUMA $SUMB "tar xf $TESTDIR/tar$$.tar"
log_pass "Successfully migrated test file from ZFS fs to ZFS fs".
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/migration/migration_002_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/migration/migration_002_pos.ksh
index 6b97e2a4071b..a522174f11aa 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/migration/migration_002_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/migration/migration_002_pos.ksh
@@ -34,12 +34,12 @@
#
# DESCRIPTION:
-# Migrating test file from ZFS fs to UFS fs using tar.
+# Migrating test file from ZFS fs to platform native fs using tar.
#
# STRATEGY:
# 1. Calculate chksum of testfile
# 2. Tar up test file and place on a ZFS filesystem
-# 3. Extract tar contents to a UFS file system
+# 3. Extract tar contents to a platform native file system
# 4. Calculate chksum of extracted file
# 5. Compare old and new chksums.
#
@@ -48,19 +48,14 @@ verify_runnable "both"
function cleanup
{
- rm -rf $TESTDIR/tar$$.tar
- rm -rf $NONZFS_TESTDIR/$BNAME
+ rm -rf $TESTDIR/tar$$.tar $NONZFS_TESTDIR/$BNAME
}
-log_assert "Migrating test file from ZFS fs to UFS fs using tar"
+log_assert "Migrating test file from ZFS fs to $NEWFS_DEFAULT_FS fs using tar"
log_onexit cleanup
-prepare $DNAME "tar cf $TESTDIR/tar$$.tar $BNAME"
-(( $? != 0 )) && log_fail "Unable to create src archive"
+log_must prepare $DNAME "tar cf $TESTDIR/tar$$.tar $BNAME"
+log_must migrate $NONZFS_TESTDIR $SUMA $SUMB "tar xf $TESTDIR/tar$$.tar"
-migrate $NONZFS_TESTDIR $SUMA $SUMB "tar xf $TESTDIR/tar$$.tar"
-(( $? != 0 )) && log_fail "Unable to successfully migrate test file from" \
- "ZFS fs to UFS fs"
-
-log_pass "Successfully migrated test file from ZFS fs to UFS fs".
+log_pass "Successfully migrated test file from ZFS fs to $NEWFS_DEFAULT_FS fs".
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/migration/migration_003_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/migration/migration_003_pos.ksh
index dd0baeaa9b78..c83883d356c3 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/migration/migration_003_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/migration/migration_003_pos.ksh
@@ -34,11 +34,11 @@
#
# DESCRIPTION:
-# Migrating test file from UFS fs to ZFS fs using tar.
+# Migrating test file from platform native fs to ZFS fs using tar.
#
# STRATEGY:
# 1. Calculate chksum of testfile
-# 2. Tar up test file and place on a UFS filesystem
+# 2. Tar up test file and place on a platform native filesystem
# 3. Extract tar contents to a ZFS file system
# 4. Calculate chksum of extracted file
# 5. Compare old and new chksums.
@@ -48,19 +48,14 @@ verify_runnable "both"
function cleanup
{
- rm -rf $NONZFS_TESTDIR/tar$$.tar
- rm -rf $TESTDIR/$BNAME
+ rm -rf $NONZFS_TESTDIR/tar$$.tar $TESTDIR/$BNAME
}
-log_assert "Migrating test file from UFS fs to ZFS fs using tar"
+log_assert "Migrating test file from $NEWFS_DEFAULT_FS fs to ZFS fs using tar"
log_onexit cleanup
-prepare $DNAME "tar cf $NONZFS_TESTDIR/tar$$.tar $BNAME"
-(( $? != 0 )) && log_fail "Unable to create src archive"
+log_must prepare $DNAME "tar cf $NONZFS_TESTDIR/tar$$.tar $BNAME"
+log_must migrate $TESTDIR $SUMA $SUMB "tar xvf $NONZFS_TESTDIR/tar$$.tar"
-migrate $TESTDIR $SUMA $SUMB "tar xvf $NONZFS_TESTDIR/tar$$.tar"
-(( $? != 0 )) && log_fail "Unable to successfully migrate test file from" \
- "UFS fs to ZFS fs"
-
-log_pass "Successfully migrated test file from UFS fs to ZFS fs".
+log_pass "Successfully migrated test file from $NEWFS_DEFAULT_FS fs to ZFS fs".
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/migration/migration_004_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/migration/migration_004_pos.ksh
index 00a6cc172ab6..5a4375410e65 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/migration/migration_004_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/migration/migration_004_pos.ksh
@@ -48,8 +48,7 @@ verify_runnable "both"
function cleanup
{
- rm -rf $TESTDIR/cpio$$.cpio
- rm -rf $TESTDIR/$BNAME
+ rm -rf $TESTDIR/cpio$$.cpio $TESTDIR/$BNAME
}
log_assert "Migrating test file from ZFS fs to ZFS fs using cpio"
@@ -57,17 +56,9 @@ log_assert "Migrating test file from ZFS fs to ZFS fs using cpio"
log_onexit cleanup
cwd=$PWD
-cd $DNAME
-(( $? != 0 )) && log_untested "Could not change directory to $DNAME"
-
-ls $BNAME | cpio -oc > $TESTDIR/cpio$$.cpio
-(( $? != 0 )) && log_fail "Unable to create cpio archive"
-
-cd $cwd
-(( $? != 0 )) && log_untested "Could not change directory to $cwd"
-
-migrate_cpio $TESTDIR "$TESTDIR/cpio$$.cpio" $SUMA $SUMB
-(( $? != 0 )) && log_fail "Unable to successfully migrate test file from" \
- "ZFS fs to ZFS fs"
+log_must cd $DNAME
+log_must eval "find $BNAME | cpio -oc > $TESTDIR/cpio$$.cpio"
+log_must cd $cwd
+log_must migrate_cpio $TESTDIR "$TESTDIR/cpio$$.cpio" $SUMA $SUMB
log_pass "Successfully migrated test file from ZFS fs to ZFS fs".
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/migration/migration_005_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/migration/migration_005_pos.ksh
index 4386596f777d..f282c37b7a1c 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/migration/migration_005_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/migration/migration_005_pos.ksh
@@ -34,12 +34,12 @@
#
# DESCRIPTION:
-# Migrating test file from ZFS fs to UFS fs using cpio
+# Migrating test file from ZFS fs to platform native fs using cpio
#
# STRATEGY:
# 1. Calculate chksum of testfile
# 2. Cpio up test file and place on a ZFS filesystem
-# 3. Extract cpio contents to a UFS file system
+# 3. Extract cpio contents to a platform native file system
# 4. Calculate chksum of extracted file
# 5. Compare old and new chksums.
#
@@ -48,26 +48,17 @@ verify_runnable "both"
function cleanup
{
- rm -rf $TESTDIR/cpio$$.cpio
- rm -rf $NONZFS_TESTDIR/$BNAME
+ rm -rf $TESTDIR/cpio$$.cpio $NONZFS_TESTDIR/$BNAME
}
-log_assert "Migrating test file from ZFS fs to uFS fs using cpio"
+log_assert "Migrating test file from ZFS fs to $NEWFS_DEFAULT_FS fs using cpio"
log_onexit cleanup
cwd=$PWD
-cd $DNAME
-(( $? != 0 )) && log_untested "Could not change directory to $DNAME"
+log_must cd $DNAME
+log_must eval "find $BNAME | cpio -oc > $TESTDIR/cpio$$.cpio"
+log_must cd $cwd
+log_must migrate_cpio $NONZFS_TESTDIR "$TESTDIR/cpio$$.cpio" $SUMA $SUMB
-ls $BNAME | cpio -oc > $TESTDIR/cpio$$.cpio
-(( $? != 0 )) && log_fail "Unable to create cpio archive"
-
-cd $cwd
-(( $? != 0 )) && log_untested "Could not change directory to $cwd"
-
-migrate_cpio $NONZFS_TESTDIR "$TESTDIR/cpio$$.cpio" $SUMA $SUMB
-(( $? != 0 )) && log_fail "Unable to successfully migrate test file from" \
- "ZFS fs to UFS fs"
-
-log_pass "Successfully migrated test file from ZFS fs to UFS fs".
+log_pass "Successfully migrated test file from ZFS fs to $NEWFS_DEFAULT_FS fs".
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/migration/migration_006_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/migration/migration_006_pos.ksh
index 9b5c9166ed97..a2ebd1f3f2c8 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/migration/migration_006_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/migration/migration_006_pos.ksh
@@ -48,8 +48,7 @@ verify_runnable "both"
function cleanup
{
- rm -rf $NONZFS_TESTDIR/cpio$$.cpio
- rm -rf $TESTDIR/$BNAME
+ rm -rf $NONZFS_TESTDIR/cpio$$.cpio $TESTDIR/$BNAME
}
log_assert "Migrating test file from UFS fs to ZFS fs using cpio"
@@ -57,17 +56,9 @@ log_assert "Migrating test file from UFS fs to ZFS fs using cpio"
log_onexit cleanup
cwd=$PWD
-cd $DNAME
-(( $? != 0 )) && log_untested "Could not change directory to $DNAME"
-
-ls $BNAME | cpio -oc > $NONZFS_TESTDIR/cpio$$.cpio
-(( $? != 0 )) && log_fail "Unable to create cpio archive"
-
-cd $cwd
-(( $? != 0 )) && log_untested "Could not change directory to $cwd"
-
-migrate_cpio $TESTDIR "$NONZFS_TESTDIR/cpio$$.cpio" $SUMA $SUMB
-(( $? != 0 )) && log_fail "Unable to successfully migrate test file from" \
- "ZFS fs to ZFS fs"
+log_must cd $DNAME
+log_must eval "find $BNAME | cpio -oc > $NONZFS_TESTDIR/cpio$$.cpio"
+log_must cd $cwd
+log_must migrate_cpio $TESTDIR "$NONZFS_TESTDIR/cpio$$.cpio" $SUMA $SUMB
log_pass "Successfully migrated test file from UFS fs to ZFS fs".
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/migration/migration_007_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/migration/migration_007_pos.ksh
index 0d136550f740..40839ecc00a5 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/migration/migration_007_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/migration/migration_007_pos.ksh
@@ -48,19 +48,14 @@ verify_runnable "both"
function cleanup
{
- rm -rf $TESTDIR/dd$$.dd
- rm -rf $TESTDIR/$BNAME
+ rm -rf $TESTDIR/dd$$.dd $TESTDIR/$BNAME
}
log_assert "Migrating test file from ZFS fs to ZFS fs using dd"
log_onexit cleanup
-prepare $DNAME "dd if=$BNAME obs=128k of=$TESTDIR/dd$$.dd"
-(( $? != 0 )) && log_fail "Unable to create src archive"
-
-migrate $TESTDIR $SUMA $SUMB "dd if=$TESTDIR/dd$$.dd obs=128k of=$BNAME"
-(( $? != 0 )) && log_fail "Unable to successfully migrate test file from" \
- "ZFS fs to ZFS fs"
+log_must prepare $DNAME "dd if=$BNAME obs=128k of=$TESTDIR/dd$$.dd"
+log_must migrate $TESTDIR $SUMA $SUMB "dd if=$TESTDIR/dd$$.dd obs=128k of=$BNAME"
log_pass "Successfully migrated test file from ZFS fs to ZFS fs".
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/migration/migration_008_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/migration/migration_008_pos.ksh
index f62b1f33a3e5..af60e4bc1f4e 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/migration/migration_008_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/migration/migration_008_pos.ksh
@@ -34,12 +34,12 @@
#
# DESCRIPTION:
-# Migrating test file from ZFS fs to UFS fs using dd.
+# Migrating test file from ZFS fs to platform native fs using dd.
#
# STRATEGY:
# 1. Calculate chksum of testfile
# 2. Dd up test file and place on a ZFS filesystem
-# 3. Extract dd contents to a UFS file system
+# 3. Extract dd contents to a platform native file system
# 4. Calculate chksum of extracted file
# 5. Compare old and new chksums.
#
@@ -48,19 +48,14 @@ verify_runnable "both"
function cleanup
{
- rm -rf $TESTDIR/dd$$.dd
- rm -rf $NONZFS_TESTDIR/$BNAME
+ rm -rf $TESTDIR/dd$$.dd $NONZFS_TESTDIR/$BNAME
}
-log_assert "Migrating test file from ZFS fs to UFS fs using dd"
+log_assert "Migrating test file from ZFS fs to $NEWFS_DEFAULT_FS fs using dd"
log_onexit cleanup
-prepare $DNAME "dd if=$BNAME obs=128k of=$TESTDIR/dd$$.dd"
-(( $? != 0 )) && log_fail "Unable to create src archive"
+log_must prepare $DNAME "dd if=$BNAME obs=128k of=$TESTDIR/dd$$.dd"
+log_must migrate $NONZFS_TESTDIR $SUMA $SUMB "dd if=$TESTDIR/dd$$.dd obs=128k of=$BNAME"
-migrate $NONZFS_TESTDIR $SUMA $SUMB "dd if=$TESTDIR/dd$$.dd obs=128k of=$BNAME"
-(( $? != 0 )) && log_fail "Unable to successfully migrate test file from" \
- "ZFS fs to ZFS fs"
-
-log_pass "Successfully migrated test file from ZFS fs to UFS fs".
+log_pass "Successfully migrated test file from ZFS fs to $NEWFS_DEFAULT_FS fs".
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/migration/migration_009_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/migration/migration_009_pos.ksh
index 907be39eb4dd..e24cfdc96db1 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/migration/migration_009_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/migration/migration_009_pos.ksh
@@ -34,11 +34,11 @@
#
# DESCRIPTION:
-# Migrating test file from UFS fs to ZFS fs using dd.
+# Migrating test file from platform native fs to ZFS fs using dd.
#
# STRATEGY:
# 1. Calculate chksum of testfile
-# 2. Dd up test file and place on a UFS filesystem
+# 2. Dd up test file and place on a platform native filesystem
# 3. Extract dd contents to a ZFS file system
# 4. Calculate chksum of extracted file
# 5. Compare old and new chksums.
@@ -48,19 +48,14 @@ verify_runnable "both"
function cleanup
{
- rm -rf $TESTDIR/dd$$.dd
- rm -rf $NONZFS_TESTDIR/$BNAME
+ rm -rf $TESTDIR/dd$$.dd $NONZFS_TESTDIR/$BNAME
}
-log_assert "Migrating test file from UFS fs to ZFS fs using dd"
+log_assert "Migrating test file from $NEWFS_DEFAULT_FS fs to ZFS fs using dd"
log_onexit cleanup
-prepare $DNAME "dd if=$BNAME obs=128k of=$NONZFS_TESTDIR/dd$$.dd"
-(( $? != 0 )) && log_fail "Unable to create src archive"
+log_must prepare $DNAME "dd if=$BNAME obs=128k of=$NONZFS_TESTDIR/dd$$.dd"
+log_must migrate $TESTDIR $SUMA $SUMB "dd if=$NONZFS_TESTDIR/dd$$.dd obs=128k of=$BNAME"
-migrate $TESTDIR $SUMA $SUMB "dd if=$NONZFS_TESTDIR/dd$$.dd obs=128k of=$BNAME"
-(( $? != 0 )) && log_fail "Unable to successfully migrate test file from" \
- "ZFS fs to ZFS fs"
-
-log_pass "Successfully migrated test file from UFS fs to ZFS fs".
+log_pass "Successfully migrated test file from $NEWFS_DEFAULT_FS fs to ZFS fs".
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/migration/migration_010_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/migration/migration_010_pos.ksh
index e80dd67cdc21..f090fed3d83c 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/migration/migration_010_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/migration/migration_010_pos.ksh
@@ -48,19 +48,14 @@ verify_runnable "both"
function cleanup
{
- rm -rf $TESTDIR/cp$$.cp
- rm -rf $TESTDIR/$BNAME
+ rm -rf $TESTDIR/cp$$.cp $TESTDIR/$BNAME
}
log_assert "Migrating test file from ZFS fs to ZFS fs using cp"
log_onexit cleanup
-prepare $DNAME "cp $BNAME $TESTDIR/cp$$.cp"
-(( $? != 0 )) && log_fail "Unable to create src archive"
-
-migrate $TESTDIR $SUMA $SUMB "cp $TESTDIR/cp$$.cp $BNAME"
-(( $? != 0 )) && log_fail "Unable to successfully migrate test file from" \
- "ZFS fs to ZFS fs"
+log_must prepare $DNAME "cp $BNAME $TESTDIR/cp$$.cp"
+log_must migrate $TESTDIR $SUMA $SUMB "cp $TESTDIR/cp$$.cp $BNAME"
log_pass "Successfully migrated test file from ZFS fs to ZFS fs".
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/migration/migration_011_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/migration/migration_011_pos.ksh
index 2d7ecb45eadb..4293c8d8bdc2 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/migration/migration_011_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/migration/migration_011_pos.ksh
@@ -34,12 +34,12 @@
#
# DESCRIPTION:
-# Migrating test file from ZFS fs to UFS fs using cp
+# Migrating test file from ZFS fs to platform native fs using cp
#
# STRATEGY:
# 1. Calculate chksum of testfile
# 2. CP up test file and place on a ZFS filesystem
-# 3. Extract cp contents to a UFS file system
+# 3. Extract cp contents to a platform native file system
# 4. Calculate chksum of extracted file
# 5. Compare old and new chksums.
#
@@ -48,19 +48,14 @@ verify_runnable "both"
function cleanup
{
- rm -rf $NONZFS_TESTDIR/cp$$.cp
- rm -rf $TESTDIR/$BNAME
+ rm -rf $NONZFS_TESTDIR/cp$$.cp $TESTDIR/$BNAME
}
-log_assert "Migrating test file from ZFS fs to UFS fs using cp"
+log_assert "Migrating test file from ZFS fs to $NEWFS_DEFAULT_FS fs using cp"
log_onexit cleanup
-prepare $DNAME "cp $BNAME $TESTDIR/cp$$.cp"
-(( $? != 0 )) && log_fail "Unable to create src archive"
+log_must prepare $DNAME "cp $BNAME $TESTDIR/cp$$.cp"
+log_must migrate $NONZFS_TESTDIR $SUMA $SUMB "cp $TESTDIR/cp$$.cp $BNAME"
-migrate $NONZFS_TESTDIR $SUMA $SUMB "cp $TESTDIR/cp$$.cp $BNAME"
-(( $? != 0 )) && log_fail "Unable to successfully migrate test file from" \
- "ZFS fs to UFS fs"
-
-log_pass "Successfully migrated test file from ZFS fs to UFS fs".
+log_pass "Successfully migrated test file from ZFS fs to $NEWFS_DEFAULT_FS fs".
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/migration/migration_012_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/migration/migration_012_pos.ksh
index fd9c4549164a..675b4a159b68 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/migration/migration_012_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/migration/migration_012_pos.ksh
@@ -34,11 +34,11 @@
#
# DESCRIPTION:
-# Migrating test file from UFS fs to ZFS fs using cp
+# Migrating test file from platform native fs to ZFS fs using cp
#
# STRATEGY:
# 1. Calculate chksum of testfile
-# 2. CP up test file and place on a UFS filesystem
+# 2. CP up test file and place on a platform native filesystem
# 3. Extract cp contents to a ZFS file system
# 4. Calculate chksum of extracted file
# 5. Compare old and new chksums.
@@ -48,19 +48,14 @@ verify_runnable "both"
function cleanup
{
- rm -rf $TESTDIR/cp$$.cp
- rm -rf $NONZFS_TESTDIR/$BNAME
+ rm -rf $TESTDIR/cp$$.cp $NONZFS_TESTDIR/$BNAME
}
-log_assert "Migrating test file from UFS fs to ZFS fs using cp"
+log_assert "Migrating test file from $NEWFS_DEFAULT_FS fs to ZFS fs using cp"
log_onexit cleanup
-prepare $DNAME "cp $BNAME $NONZFS_TESTDIR/cp$$.cp"
-(( $? != 0 )) && log_fail "Unable to create src archive"
+log_mustprepare $DNAME "cp $BNAME $NONZFS_TESTDIR/cp$$.cp"
+log_mustmigrate $TESTDIR $SUMA $SUMB "cp $NONZFS_TESTDIR/cp$$.cp $BNAME"
-migrate $TESTDIR $SUMA $SUMB "cp $NONZFS_TESTDIR/cp$$.cp $BNAME"
-(( $? != 0 )) && log_fail "Unable to successfully migrate test file from" \
- "UFS fs to ZFS fs"
-
-log_pass "Successfully migrated test file from UFS fs to ZFS fs".
+log_pass "Successfully migrated test file from $NEWFS_DEFAULT_FS fs to ZFS fs".
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/migration/setup.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/migration/setup.ksh
index 58edc0a9291d..4992f954eeee 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/migration/setup.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/migration/setup.ksh
@@ -57,8 +57,7 @@ log_must zfs set mountpoint=$TESTDIR $TESTPOOL/$TESTFS
rm -rf $NONZFS_TESTDIR || log_unresolved Could not remove $NONZFS_TESTDIR
mkdir -p $NONZFS_TESTDIR || log_unresolved Could not create $NONZFS_TESTDIR
-new_fs ${DEV_DSKDIR}/$NONZFS_DISK
-(( $? != 0 )) &&
+new_fs ${DEV_DSKDIR}/$NONZFS_DISK ||
log_untested "Unable to setup a $NEWFS_DEFAULT_FS file system"
log_must mount ${DEV_DSKDIR}/$NONZFS_DISK $NONZFS_TESTDIR
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/mmap/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/mmap/Makefile.am
deleted file mode 100644
index b26791ee7ce0..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/mmap/Makefile.am
+++ /dev/null
@@ -1,11 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/mmap
-dist_pkgdata_SCRIPTS = \
- setup.ksh \
- cleanup.ksh \
- mmap_read_001_pos.ksh \
- mmap_write_001_pos.ksh \
- mmap_libaio_001_pos.ksh \
- mmap_seek_001_pos.ksh
-
-dist_pkgdata_DATA = \
- mmap.cfg
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/mmap/mmap_libaio_001_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/mmap/mmap_libaio_001_pos.ksh
index 36a7e76f9f3d..031d90c3838b 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/mmap/mmap_libaio_001_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/mmap/mmap_libaio_001_pos.ksh
@@ -42,9 +42,7 @@ verify_runnable "global"
log_assert "verify mmap'd pages work with libaio"
# mmap_libaio is built when the libaio-devel package is installed.
-if ! which mmap_libaio; then
- log_unsupported "This test requires mmap_libaio."
-fi
+command -v mmap_libaio > /dev/null || log_unsupported "This test requires mmap_libaio."
log_must chmod 777 $TESTDIR
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/mmap/mmap_sync_001_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/mmap/mmap_sync_001_pos.ksh
new file mode 100755
index 000000000000..b764d6607ba6
--- /dev/null
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/mmap/mmap_sync_001_pos.ksh
@@ -0,0 +1,63 @@
+#!/bin/ksh -p
+
+#
+# This file and its contents are supplied under the terms of the
+# Common Development and Distribution License ("CDDL"), version 1.0.
+# You may only use this file in accordance with the terms of version
+# 1.0 of the CDDL.
+#
+# A full copy of the text of the CDDL should have accompanied this
+# source. A copy of the CDDL is also available via the Internet at
+# http://www.illumos.org/license/CDDL.
+#
+
+#
+# Copyright (c) 2015, 2016 by Delphix. All rights reserved.
+#
+
+. $STF_SUITE/include/libtest.shlib
+
+#
+# DESCRIPTION:
+# msync()s of mmap()'ed file should complete quickly during
+# background dirty page writebacks by the kernel.
+#
+
+function cleanup
+{
+ log_must eval "echo $saved_vm_dirty_expire_centisecs > /proc/sys/vm/dirty_expire_centisecs"
+ log_must eval "echo $saved_vm_dirty_background_ratio > /proc/sys/vm/dirty_background_ratio"
+ log_must eval "echo $saved_vm_dirty_writeback_centisecs > /proc/sys/vm/dirty_writeback_centisecs"
+
+ # revert to some sensible defaults if the values we saved
+ # were incorrect due to a previous run being interrupted
+ if [ $(</proc/sys/vm/dirty_expire_centisecs) -eq 1 ]; then
+ log_must eval "echo 3000 > /proc/sys/vm/dirty_expire_centisecs"
+ fi
+
+ if [ $(</proc/sys/vm/dirty_background_ratio) -eq 0 ]; then
+ log_must eval "echo 10 > /proc/sys/vm/dirty_background_ratio"
+ fi
+
+ if [ $(</proc/sys/vm/dirty_writeback_centisecs) -eq 1 ]; then
+ log_must eval "echo 500 > /proc/sys/vm/dirty_writeback_centisecs"
+ fi
+}
+
+if ! is_linux; then
+ log_unsupported "Only supported on Linux, requires /proc/sys/vm/ tunables"
+fi
+
+log_onexit cleanup
+log_assert "Run the tests for mmap_sync"
+
+read -r saved_vm_dirty_expire_centisecs < /proc/sys/vm/dirty_expire_centisecs
+read -r saved_vm_dirty_background_ratio < /proc/sys/vm/dirty_background_ratio
+read -r saved_vm_dirty_writeback_centisecs < /proc/sys/vm/dirty_writeback_centisecs
+
+log_must eval "echo 1 > /proc/sys/vm/dirty_expire_centisecs"
+log_must eval "echo 1 > /proc/sys/vm/dirty_background_bytes"
+log_must eval "echo 1 > /proc/sys/vm/dirty_writeback_centisecs"
+
+log_must mmap_sync
+log_pass "mmap_sync tests passed."
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/mmp/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/mmp/Makefile.am
deleted file mode 100644
index 2848fd4ce692..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/mmp/Makefile.am
+++ /dev/null
@@ -1,21 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/mmp
-dist_pkgdata_SCRIPTS = \
- multihost_history.ksh \
- mmp_on_thread.ksh \
- mmp_on_uberblocks.ksh \
- mmp_on_off.ksh \
- mmp_interval.ksh \
- mmp_active_import.ksh \
- mmp_inactive_import.ksh \
- mmp_exported_import.ksh \
- mmp_write_uberblocks.ksh \
- mmp_reset_interval.ksh \
- mmp_on_zdb.ksh \
- mmp_write_distribution.ksh \
- mmp_hostid.ksh \
- setup.ksh \
- cleanup.ksh
-
-dist_pkgdata_DATA = \
- mmp.kshlib \
- mmp.cfg
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/mmp/mmp.kshlib b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/mmp/mmp.kshlib
index 661cbf3a52e7..9dd6f4d53f4a 100644
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/mmp/mmp.kshlib
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/mmp/mmp.kshlib
@@ -36,10 +36,8 @@ function check_pool_import # pool opts token keyword
typeset keyword=$4
zpool import $opts 2>&1 | \
- nawk -v token="$token:" '($1==token) {print $0}' | \
- grep -i "$keyword" > /dev/null 2>&1
-
- return $?
+ awk -v token="$token:" '($1==token) {print}' | \
+ grep -iq "$keyword"
}
function is_pool_imported # pool opts
@@ -49,7 +47,6 @@ function is_pool_imported # pool opts
check_pool_import "$pool" "$opts" "status" \
"The pool is currently imported"
- return $?
}
function wait_pool_imported # pool opts
@@ -60,8 +57,6 @@ function wait_pool_imported # pool opts
while is_pool_imported "$pool" "$opts"; do
log_must sleep 5
done
-
- return 0
}
function try_pool_import # pool opts message
@@ -71,8 +66,6 @@ function try_pool_import # pool opts message
typeset msg=$3
zpool import $opts $pool 2>&1 | grep -i "$msg"
-
- return $?
}
function mmp_set_hostid
@@ -81,11 +74,7 @@ function mmp_set_hostid
zgenhostid $1
- if [ $(hostid) != "$hostid" ]; then
- return 1
- fi
-
- return 0
+ [ $(hostid) = "$hostid" ]
}
function mmp_clear_hostid
@@ -162,45 +151,6 @@ function mmp_pool_set_hostid # pool hostid
return 0
}
-# Return the number of seconds the activity check portion of the import process
-# will take. Does not include the time to find devices and assemble a config.
-# Note that the activity check may be skipped, e.g. if the pool and host
-# hostid's match, but this will return non-zero because mmp_* are populated.
-function seconds_mmp_waits_for_activity
-{
- typeset pool=$1
- typeset devpath=$2
-
- typeset seconds=0
- typeset devices=${#DISK[@]}
- typeset import_intervals=$(get_tunable MULTIHOST_IMPORT_INTERVALS)
- typeset import_interval=$(get_tunable MULTIHOST_INTERVAL)
- typeset tmpfile=$(mktemp)
- typeset mmp_fail
- typeset mmp_write
- typeset mmp_delay
-
- log_must zdb -e -p $devpath $pool >$tmpfile 2>/dev/null
- mmp_fail=$(awk '/mmp_fail/ {print $NF}' $tmpfile)
- mmp_write=$(awk '/mmp_write/ {print $NF}' $tmpfile)
- mmp_delay=$(awk '/mmp_delay/ {print $NF}' $tmpfile)
- if [ -f $tmpfile ]; then
- rm $tmpfile
- fi
-
- # In order of preference:
- if [ -n $mmp_fail -a -n $mmp_write ]; then
- seconds=$((2*mmp_fail*mmp_write/1000))
- elif [ -n $mmp_delay ]; then
- # MMP V0: Based on mmp_delay from the best Uberblock
- seconds=$((import_intervals*devices*mmp_delay/1000000000))
- else
- # Non-MMP aware: Based on zfs_multihost_interval and import_intervals
- seconds=$((import_intervals*import_interval/1000))
- fi
-
- echo $seconds
-}
function import_no_activity_check # pool opts
{
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/mmp/mmp_on_off.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/mmp/mmp_on_off.ksh
index 29d771de8f8b..513b7d31f9cd 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/mmp/mmp_on_off.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/mmp/mmp_on_off.ksh
@@ -60,9 +60,9 @@ log_must mmp_set_hostid $HOSTID1
default_setup_noexit $DISK
log_must zpool set multihost=off $TESTPOOL
-log_must zdb -u $TESTPOOL > $PREV_UBER
+log_must eval "zdb -u $TESTPOOL > $PREV_UBER"
log_must sleep 5
-log_must zdb -u $TESTPOOL > $CURR_UBER
+log_must eval "zdb -u $TESTPOOL > $CURR_UBER"
if ! diff "$CURR_UBER" "$PREV_UBER"; then
log_fail "mmp thread has updated an uberblock"
@@ -70,7 +70,7 @@ fi
log_must zpool set multihost=on $TESTPOOL
log_must sleep 5
-log_must zdb -u $TESTPOOL > $CURR_UBER
+log_must eval "zdb -u $TESTPOOL > $CURR_UBER"
if diff "$CURR_UBER" "$PREV_UBER"; then
log_fail "mmp failed to update uberblocks"
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/mmp/mmp_on_thread.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/mmp/mmp_on_thread.ksh
index 01cca61c3c3e..cd82fa47e23f 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/mmp/mmp_on_thread.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/mmp/mmp_on_thread.ksh
@@ -53,9 +53,9 @@ log_must mmp_set_hostid $HOSTID1
default_setup_noexit $DISK
log_must zpool set multihost=on $TESTPOOL
-log_must zdb -u $TESTPOOL > $PREV_UBER
+log_must eval "zdb -u $TESTPOOL > $PREV_UBER"
log_must sleep 5
-log_must zdb -u $TESTPOOL > $CURR_UBER
+log_must eval "zdb -u $TESTPOOL > $CURR_UBER"
if diff -u "$CURR_UBER" "$PREV_UBER"; then
log_fail "mmp failed to update uberblocks"
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/mmp/mmp_write_distribution.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/mmp/mmp_write_distribution.ksh
index b6bdc6811634..1ac254aa1dab 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/mmp/mmp_write_distribution.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/mmp/mmp_write_distribution.ksh
@@ -37,7 +37,7 @@ verify_runnable "both"
function cleanup
{
log_must zpool destroy $MMP_POOL
- log_must rm $MMP_DIR/file.{0,1,2,3,4,5,6,7}
+ log_must rm $MMP_DIR/file.{0..7}
log_must rm $MMP_HISTORY_TMP
log_must rmdir $MMP_DIR
log_must mmp_clear_hostid
@@ -51,8 +51,8 @@ MMP_HISTORY=/proc/spl/kstat/zfs/$MMP_POOL/multihost
# Step 1
log_must mkdir -p $MMP_DIR
-log_must truncate -s 128M $MMP_DIR/file.{0,1,2,3,4,5,6,7}
-log_must zpool create -f $MMP_POOL mirror $MMP_DIR/file.{0,1} mirror $MMP_DIR/file.{2,3,4,5,6,7}
+log_must truncate -s 128M $MMP_DIR/file.{0..7}
+log_must zpool create -f $MMP_POOL mirror $MMP_DIR/file.{0..1} mirror $MMP_DIR/file.{2..7}
# Step 2
log_must mmp_set_hostid $HOSTID1
@@ -69,8 +69,8 @@ typeset -i min_writes=999
typeset -i max_writes=0
typeset -i write_count
# copy to get as close to a consistent view as possible
-cat $MMP_HISTORY > $MMP_HISTORY_TMP
-for x in $(seq 0 7); do
+cp $MMP_HISTORY $MMP_HISTORY_TMP
+for x in {0..7}; do
write_count=$(grep -c file.${x} $MMP_HISTORY_TMP)
if [ $write_count -lt $min_writes ]; then
min_writes=$write_count
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/mount/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/mount/Makefile.am
deleted file mode 100644
index bdafa69badd8..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/mount/Makefile.am
+++ /dev/null
@@ -1,7 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/mount
-dist_pkgdata_SCRIPTS = \
- setup.ksh \
- cleanup.ksh \
- umount_001.ksh \
- umount_unlinked_drain.ksh \
- umountall_001.ksh
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/mount/umount_unlinked_drain.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/mount/umount_unlinked_drain.ksh
index 6130e2c82893..40045a7a96b5 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/mount/umount_unlinked_drain.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/mount/umount_unlinked_drain.ksh
@@ -47,8 +47,8 @@ function unlinked_size_is
last_usize=0
while [[ $iters -le $MAX_ITERS ]]; do
kstat_file=$(grep -nrwl /proc/spl/kstat/zfs/$2/objset-0x* -e $3)
- nunlinks=`cat $kstat_file | grep nunlinks | awk '{print $3}'`
- nunlinked=`cat $kstat_file | grep nunlinked | awk '{print $3}'`
+ nunlinks=$(awk '/nunlinks/ {print $3}' $kstat_file)
+ nunlinked=$(awk '/nunlinked/ {print $3}' $kstat_file)
usize=$(($nunlinks - $nunlinked))
if [[ $iters == $MAX_ITERS && $usize == $1 ]]; then
return 0
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/mount/umountall_001.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/mount/umountall_001.ksh
index 814c831e408c..40c94593ba2d 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/mount/umountall_001.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/mount/umountall_001.ksh
@@ -44,11 +44,11 @@ zfs_list="/ /lib /sbin /tmp /usr /var /var/adm /var/run"
# Append our ZFS filesystems to the list, not worrying about duplicates.
if is_linux; then
- typeset mounts=$(mount | awk '{if ($5 == "zfs") print $3}')
+ typeset mounts=$(mount | awk '$5 == "zfs" {print $3}')
elif is_freebsd; then
- typeset mounts=$(mount -p | awk '{if ($3 == "zfs") print $2}')
+ typeset mounts=$(mount -p | awk '$3 == "zfs" {print $2}')
else
- typeset mounts=$(mount -p | awk '{if ($4 == "zfs") print $3}')
+ typeset mounts=$(mount -p | awk '$4 == "zfs" {print $3}')
fi
for fs in $mounts; do
@@ -56,8 +56,7 @@ for fs in $mounts; do
done
if is_linux; then
- mounts=$(umount --fake -av -t zfs 2>&1 | \
- grep "successfully umounted" | awk '{print $1}')
+ mounts=$(umount --fake -av -t zfs 2>&1 | awk '/successfully umounted/ {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)
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/mv_files/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/mv_files/Makefile.am
deleted file mode 100644
index cec02140e307..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/mv_files/Makefile.am
+++ /dev/null
@@ -1,11 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/mv_files
-dist_pkgdata_SCRIPTS = \
- setup.ksh \
- cleanup.ksh \
- mv_files_001_pos.ksh \
- mv_files_002_pos.ksh \
- random_creation.ksh
-
-dist_pkgdata_DATA = \
- mv_files.cfg \
- mv_files_common.kshlib
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/mv_files/cleanup.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/mv_files/cleanup.ksh
index a664433743af..1c170208b574 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/mv_files/cleanup.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/mv_files/cleanup.ksh
@@ -34,13 +34,12 @@
verify_runnable "global"
-[[ -f $TEST_BASE_DIR/exitsZero.ksh ]] && \
+[[ -f $TEST_BASE_DIR/exitsZero.ksh ]] &&
log_must rm -f $TEST_BASE_DIR/exitsZero.ksh
-[[ -f $TEST_BASE_DIR/testbackgprocs.ksh ]] && \
+[[ -f $TEST_BASE_DIR/testbackgprocs.ksh ]] &&
log_must rm -f $TEST_BASE_DIR/testbackgprocs.ksh
-ismounted $TESTPOOL/$TESTFS_TGT
-(( $? == 0 )) && log_must zfs umount $TESTPOOL/$TESTFS_TGT
+ismounted $TESTPOOL/$TESTFS_TGT ||log_must zfs umount $TESTPOOL/$TESTFS_TGT
log_must zfs destroy $TESTPOOL/$TESTFS_TGT
[[ -d $TESTDIR_TGT ]] && log_must rm -rf $TESTDIR_TGT
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/mv_files/mv_files.cfg b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/mv_files/mv_files.cfg
index ed28ff1efd27..fbab8f6dad7b 100644
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/mv_files/mv_files.cfg
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/mv_files/mv_files.cfg
@@ -30,7 +30,7 @@
export DISK=${DISKS%% *}
export DISKSARRAY=$DISKS
-export DISK_ARRAY_NUM=$(echo ${DISKS} | nawk '{print NF}')
+export DISK_ARRAY_NUM=$(echo ${DISKS} | awk '{print NF}')
set_device_dir
export TESTFILE=testfile
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/mv_files/mv_files_001_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/mv_files/mv_files_001_pos.ksh
index c49b19c6c3a3..209c3509a347 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/mv_files/mv_files_001_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/mv_files/mv_files_001_pos.ksh
@@ -53,8 +53,7 @@ verify_runnable "global"
function cleanup
{
- rm -f $OLDDIR/* >/dev/null 2>&1
- rm -f $NEWDIR_IN_FS/* >/dev/null 2>&1
+ rm -f $OLDDIR/* $NEWDIR_IN_FS/* >/dev/null 2>&1
}
log_assert "Doing a 'mv' of a large amount of files within a zfs filesystem" \
@@ -62,7 +61,6 @@ log_assert "Doing a 'mv' of a large amount of files within a zfs filesystem" \
log_onexit cleanup
-mv_test $OLDDIR $NEWDIR_IN_FS
-(($? != 0 )) && log_fail "'mv' test failed to complete."
+log_must mv_test $OLDDIR $NEWDIR_IN_FS
log_pass
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/mv_files/mv_files_002_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/mv_files/mv_files_002_pos.ksh
index fdadac32d59b..c20831babfab 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/mv_files/mv_files_002_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/mv_files/mv_files_002_pos.ksh
@@ -54,8 +54,7 @@ verify_runnable "global"
function cleanup
{
- rm -f $OLDDIR/* >/dev/null 2>&1
- rm -f $NEWDIR_ACROSS_FS/* >/dev/null 2>&1
+ rm -f $OLDDIR/* $NEWDIR_ACROSS_FS/* >/dev/null 2>&1
}
log_assert "Doing a 'mv' of a large amount of files across two zfs filesystems" \
@@ -63,8 +62,6 @@ log_assert "Doing a 'mv' of a large amount of files across two zfs filesystems"
log_onexit cleanup
-mv_test $OLDDIR $NEWDIR_ACROSS_FS
-(($? != 0 )) && \
- log_fail "'mv' test failed to complete."
+log_must mv_test $OLDDIR $NEWDIR_ACROSS_FS
log_pass
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/mv_files/mv_files_common.kshlib b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/mv_files/mv_files_common.kshlib
index 3ddd8f113a3b..26c2e84ce4ed 100644
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/mv_files/mv_files_common.kshlib
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/mv_files/mv_files_common.kshlib
@@ -114,9 +114,7 @@ function mv_files
#
function count_files
{
- typeset -i file_num
- file_num=$(find $1 -type f -print | wc -l | tr -d ' ')
- (( file_num != $2 )) && \
+ (( $(find $1 -type f -print | wc -l) != $2 )) && \
log_fail "The file number of target directory"\
"$2 is not equal to that of the source "\
"directory $1"
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/nestedfs/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/nestedfs/Makefile.am
deleted file mode 100644
index 6a5ecf2d9a7f..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/nestedfs/Makefile.am
+++ /dev/null
@@ -1,5 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/nestedfs
-dist_pkgdata_SCRIPTS = \
- setup.ksh \
- cleanup.ksh \
- nestedfs_001_pos.ksh
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/no_space/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/no_space/Makefile.am
deleted file mode 100644
index 31584fb17583..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/no_space/Makefile.am
+++ /dev/null
@@ -1,12 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/no_space
-dist_pkgdata_SCRIPTS = \
- setup.ksh \
- cleanup.ksh \
- enospc_001_pos.ksh \
- enospc_002_pos.ksh \
- enospc_003_pos.ksh \
- enospc_df.ksh \
- enospc_rm.ksh
-
-dist_pkgdata_DATA = \
- enospc.cfg
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/no_space/enospc_002_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/no_space/enospc_002_pos.ksh
index 2fb3fb46c44c..0aecbea7eb27 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/no_space/enospc_002_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/no_space/enospc_002_pos.ksh
@@ -62,8 +62,8 @@ done
log_mustnot_expect space zfs create $TESTPOOL/$TESTFS/subfs
log_mustnot_expect space zfs clone $TESTPOOL/$TESTFS@snap $TESTPOOL/clone
-log_must zfs send $TESTPOOL/$TESTFS@snap > $TEST_BASE_DIR/stream.$$
-log_mustnot_expect space zfs receive $TESTPOOL/$TESTFS/recvd < $TEST_BASE_DIR/stream.$$
+log_must eval "zfs send $TESTPOOL/$TESTFS@snap > $TEST_BASE_DIR/stream.$$"
+log_mustnot_expect space eval "zfs receive $TESTPOOL/$TESTFS/recvd < $TEST_BASE_DIR/stream.$$"
log_must rm $TEST_BASE_DIR/stream.$$
log_must zfs rename $TESTPOOL/$TESTFS@snap $TESTPOOL/$TESTFS@snap_newname
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/no_space/enospc_df.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/no_space/enospc_df.ksh
index b1eeaf2cc569..cf788ca7fdf0 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/no_space/enospc_df.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/no_space/enospc_df.ksh
@@ -64,8 +64,8 @@ log_must zfs umount $TESTPOOL/$TESTFS
log_must eval "df -h | grep $TESTPOOL"
# Confirm df size and used are non-zero.
-size=$(df -h /$TESTPOOL | grep $TESTPOOL | awk '{print $2}')
-used=$(df -h /$TESTPOOL | grep $TESTPOOL | awk '{print $3}')
+size=$(df -h /$TESTPOOL | awk -v p=$TESTPOOL '$0 ~ p {print $2}')
+used=$(df -h /$TESTPOOL | awk -v p=$TESTPOOL '$0 ~ p {print $3}')
if [[ "$size" = "0" ]] || [[ "$used" = "0" ]]
then
log_fail "df failed with size $size and used $used."
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/no_space/enospc_rm.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/no_space/enospc_rm.ksh
index 065abc75977e..d0f4ff4a08fe 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/no_space/enospc_rm.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/no_space/enospc_rm.ksh
@@ -30,6 +30,8 @@
verify_runnable "both"
+command -v fio > /dev/null || log_unsupported "fio missing"
+
function cleanup
{
destroy_pool $TESTPOOL
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/nopwrite/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/nopwrite/Makefile.am
deleted file mode 100644
index 3f893c6382e6..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/nopwrite/Makefile.am
+++ /dev/null
@@ -1,15 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/nopwrite
-dist_pkgdata_SCRIPTS = \
- setup.ksh \
- cleanup.ksh \
- nopwrite_copies.ksh \
- nopwrite_mtime.ksh \
- nopwrite_negative.ksh \
- nopwrite_promoted_clone.ksh \
- nopwrite_recsize.ksh \
- nopwrite_sync.ksh \
- nopwrite_varying_compression.ksh \
- nopwrite_volume.ksh
-
-dist_pkgdata_DATA = \
- nopwrite.shlib
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/online_offline/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/online_offline/Makefile.am
deleted file mode 100644
index bd23f89e538a..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/online_offline/Makefile.am
+++ /dev/null
@@ -1,10 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/online_offline
-dist_pkgdata_SCRIPTS = \
- setup.ksh \
- cleanup.ksh \
- online_offline_001_pos.ksh \
- online_offline_002_neg.ksh \
- online_offline_003_neg.ksh
-
-dist_pkgdata_DATA = \
- online_offline.cfg
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/online_offline/online_offline.cfg b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/online_offline/online_offline.cfg
index ae4cb69adcb0..6f1121c5e99e 100644
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/online_offline/online_offline.cfg
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/online_offline/online_offline.cfg
@@ -38,5 +38,5 @@ export HOLES_COUNT=${HOLES_COUNT-"16384"} # FILESIZE/BLKSIZE/8
export STF_TIMEOUT=3600
export DISKSARRAY=$DISKS
-export DISK_ARRAY_NUM=$(echo ${DISKS} | nawk '{print NF}')
+export DISK_ARRAY_NUM=$(echo ${DISKS} | awk '{print NF}')
set_device_dir
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/online_offline/online_offline_001_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/online_offline/online_offline_001_pos.ksh
index 5050447c000a..1d1b1c944cc0 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/online_offline/online_offline_001_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/online_offline/online_offline_001_pos.ksh
@@ -54,10 +54,7 @@ function cleanup
#
for disk in $DISKLIST; do
log_must zpool online $TESTPOOL $disk
- check_state $TESTPOOL $disk "online"
- if [[ $? != 0 ]]; then
- log_fail "Unable to online $disk"
- fi
+ log_must check_state $TESTPOOL $disk "online"
done
@@ -73,17 +70,11 @@ typeset killpid="$! "
for disk in $DISKLIST; 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
+ log_must check_state $TESTPOOL $disk "offline"
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
+ log_must check_state $TESTPOOL $disk "online"
# Delay for resilver to complete
sleep 3
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/online_offline/online_offline_002_neg.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/online_offline/online_offline_002_neg.ksh
index e66e7e10fedc..a2427f2e1822 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/online_offline/online_offline_002_neg.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/online_offline/online_offline_002_neg.ksh
@@ -55,11 +55,7 @@ function cleanup
#
for disk in $DISKLIST; do
log_must zpool online $TESTPOOL $disk
- check_state $TESTPOOL $disk "online"
- if [[ $? != 0 ]]; then
- log_fail "Unable to online $disk"
- fi
-
+ log_must check_state $TESTPOOL $disk "online"
done
kill $killpid >/dev/null 2>&1
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/pam/.gitignore b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/pam/.gitignore
new file mode 100644
index 000000000000..ae55292b08d6
--- /dev/null
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/pam/.gitignore
@@ -0,0 +1 @@
+/utilities.kshlib
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/pam/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/pam/Makefile.am
deleted file mode 100644
index be881faccf3b..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/pam/Makefile.am
+++ /dev/null
@@ -1,8 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/pam
-dist_pkgdata_SCRIPTS = \
- setup.ksh \
- cleanup.ksh \
- pam_basic.ksh \
- pam_nounmount.ksh \
- pam_short_password.ksh \
- utilities.kshlib
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/pam/cleanup.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/pam/cleanup.ksh
index e41622d771b4..8ea9c848b0ab 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/pam/cleanup.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/pam/cleanup.ksh
@@ -26,8 +26,4 @@ rmconfig
destroy_pool $TESTPOOL
del_user ${username}
del_group pamtestgroup
-
-rm -rf "$runstatedir"
-for dir in $TESTDIRS; do
- rm -rf $dir
-done
+log_must rm -rf "$runstatedir" $TESTDIRS
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/pam/setup.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/pam/setup.ksh
index 23515a598e72..82370a211fcd 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/pam/setup.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/pam/setup.ksh
@@ -22,9 +22,8 @@
. $STF_SUITE/tests/functional/pam/utilities.kshlib
-if ! which pamtester; then
- log_unsupported "pam tests require the pamtester utility to be installed"
-fi
+command -v pamtester > /dev/null || log_unsupported "pam tests require the pamtester utility to be installed"
+[ -f "$pammodule" ] || log_unsupported "$pammodule missing"
DISK=${DISKS%% *}
create_pool $TESTPOOL "$DISK"
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/pam/utilities.kshlib b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/pam/utilities.kshlib.in
index d328034300b1..29c6ada3dbf3 100644
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/pam/utilities.kshlib
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/pam/utilities.kshlib.in
@@ -24,24 +24,25 @@
username="pamtestuser"
runstatedir="${TESTDIR}_run"
+pammodule="@pammoduledir@/pam_zfs_key.so"
pamservice="pam_zfs_key_test"
pamconfig="/etc/pam.d/${pamservice}"
function keystatus {
- log_must [ "$(zfs list -Ho keystatus "$TESTPOOL/pam/${username}")" == "$1" ]
+ log_must [ "$(get_prop keystatus "$TESTPOOL/pam/${username}")" = "$1" ]
}
function genconfig {
- for i in password auth session; do
- printf "%s\trequired\tpam_permit.so\n%s\toptional\tpam_zfs_key.so\t%s\n" "$i" "$i" "$1"
- done > "${pamconfig}"
+ printf '%s\trequired\tpam_permit.so\n%s\toptional\t%s\t%s\n' \
+ password password "$pammodule" "$1" \
+ auth auth "$pammodule" "$1" \
+ session session "$pammodule" "$1" > "${pamconfig}"
}
function rmconfig {
- log_must rm "${pamconfig}"
+ log_must rm -f "${pamconfig}"
}
function references {
- log_must [ "$(cat "${runstatedir}/$(id -u ${username})")" == "$1" ]
+ log_must [ "$(<"${runstatedir}/$(id -u ${username})")" = "$1" ]
}
-
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/pool_checkpoint/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/pool_checkpoint/Makefile.am
deleted file mode 100644
index cc1c1183db79..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/pool_checkpoint/Makefile.am
+++ /dev/null
@@ -1,26 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/pool_checkpoint
-dist_pkgdata_SCRIPTS = \
- cleanup.ksh \
- setup.ksh \
- checkpoint_after_rewind.ksh \
- checkpoint_big_rewind.ksh \
- checkpoint_capacity.ksh \
- checkpoint_conf_change.ksh \
- checkpoint_discard_busy.ksh \
- checkpoint_discard.ksh \
- checkpoint_discard_many.ksh \
- checkpoint_indirect.ksh \
- checkpoint_invalid.ksh \
- checkpoint_lun_expsz.ksh \
- checkpoint_open.ksh \
- checkpoint_removal.ksh \
- checkpoint_rewind.ksh \
- checkpoint_ro_rewind.ksh \
- checkpoint_sm_scale.ksh \
- checkpoint_twice.ksh \
- checkpoint_vdev_add.ksh \
- checkpoint_zdb.ksh \
- checkpoint_zhack_feat.ksh
-
-dist_pkgdata_DATA = \
- pool_checkpoint.kshlib
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/pool_checkpoint/checkpoint_lun_expsz.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/pool_checkpoint/checkpoint_lun_expsz.ksh
index a18e634cefa7..7cfc3b1829bc 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/pool_checkpoint/checkpoint_lun_expsz.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/pool_checkpoint/checkpoint_lun_expsz.ksh
@@ -42,13 +42,13 @@ setup_nested_pools
log_onexit cleanup_nested_pools
populate_nested_pool
-INITSZ=$(zpool list -v | grep "$FILEDISK1" | awk '{print $2}')
+INITSZ=$(zpool list -v | awk -v d="$FILEDISK1" '$0 ~ d {print $2}')
log_must zpool checkpoint $NESTEDPOOL
log_must truncate -s $EXPSZ $FILEDISK1
log_must zpool online -e $NESTEDPOOL $FILEDISK1
-NEWSZ=$(zpool list -v | grep "$FILEDISK1" | awk '{print $2}')
-DEXPSZ=$(zpool list -v | grep "$FILEDISK1" | awk '{print $6}')
+NEWSZ=$(zpool list -v | awk -v d="$FILEDISK1" '$0 ~ d {print $2}')
+DEXPSZ=$(zpool list -v | awk -v d="$FILEDISK1" '$0 ~ d {print $6}')
nested_change_state_after_checkpoint
log_mustnot [ "$INITSZ" = "$NEWSZ" ]
log_must [ "$DEXPSZ" = "-" ]
@@ -57,8 +57,8 @@ log_must zpool export $NESTEDPOOL
log_must zpool import -d $FILEDISKDIR --rewind-to-checkpoint $NESTEDPOOL
nested_verify_pre_checkpoint_state
-FINSZ=$(zpool list -v | grep "$FILEDISK1" | awk '{print $2}')
-DEXPSZ=$(zpool list -v | grep "$FILEDISK1" | awk '{print $6}')
+FINSZ=$(zpool list -v | awk -v d="$FILEDISK1" '$0 ~ d {print $2}')
+DEXPSZ=$(zpool list -v | awk -v d="$FILEDISK1" '$0 ~ d {print $6}')
log_must [ "$EXPSZ" = "$FINSZ" ]
log_must [ "$DEXPSZ" != "-" ]
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/pool_checkpoint/checkpoint_zdb.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/pool_checkpoint/checkpoint_zdb.ksh
index fdefc0c3bdbb..18ef2309c605 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/pool_checkpoint/checkpoint_zdb.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/pool_checkpoint/checkpoint_zdb.ksh
@@ -47,8 +47,8 @@ verify_runnable "global"
# with the current state. The name of this temporary pool is the
# name of the actual pool with the suffix below appended to it.
#
-CHECKPOINT_SUFFIX="_CHECKPOINTED_UNIVERSE"
-CHECKPOINTED_FS1=$TESTPOOL$CHECKPOINT_SUFFIX/$TESTFS1
+BOGUS_SUFFIX="_CHECKPOINTED_UNIVERSE"
+CHECKPOINTED_FS1=$TESTPOOL$BOGUS_SUFFIX/$TESTFS1
setup_test_pool
log_onexit cleanup_test_pool
@@ -58,41 +58,23 @@ log_must zpool checkpoint $TESTPOOL
test_change_state_after_checkpoint
-zdb $TESTPOOL | grep "Checkpointed uberblock found" || \
- log_fail "zdb could not find checkpointed uberblock"
-
-zdb -k $TESTPOOL | grep "Checkpointed uberblock found" && \
- log_fail "zdb found checkpointed uberblock in checkpointed state"
-
-zdb $TESTPOOL | grep "Dataset $FS1" && \
- log_fail "zdb found destroyed dataset in current state"
-
-zdb -k $TESTPOOL | grep "Dataset $CHECKPOINTED_FS1" || \
- log_fail "zdb could not find destroyed dataset in checkpoint"
+log_must eval "zdb $TESTPOOL | grep -q \"Checkpointed uberblock found\""
+log_mustnot eval "zdb -k $TESTPOOL | grep -q \"Checkpointed uberblock found\""
+log_mustnot eval "zdb $TESTPOOL | grep \"Dataset $FS1\""
+log_must eval "zdb -k $TESTPOOL | grep \"Dataset $CHECKPOINTED_FS1\""
log_must zpool export $TESTPOOL
-zdb -e $TESTPOOL | grep "Checkpointed uberblock found" || \
- log_fail "zdb could not find checkpointed uberblock"
-
-zdb -k -e $TESTPOOL | grep "Checkpointed uberblock found" && \
- log_fail "zdb found checkpointed uberblock in checkpointed state"
-
-zdb -e $TESTPOOL | grep "Dataset $FS1" && \
- log_fail "zdb found destroyed dataset in current state"
-
-zdb -k -e $TESTPOOL | grep "Dataset $CHECKPOINTED_FS1" || \
- log_fail "zdb could not find destroyed dataset in checkpoint"
+log_must eval "zdb -e $TESTPOOL | grep \"Checkpointed uberblock found\""
+log_mustnot eval "zdb -k -e $TESTPOOL | grep \"Checkpointed uberblock found\""
+log_mustnot eval "zdb -e $TESTPOOL | grep \"Dataset $FS1\""
+log_must eval "zdb -k -e $TESTPOOL | grep \"Dataset $CHECKPOINTED_FS1\""
log_must zpool import $TESTPOOL
log_must zpool checkpoint -d $TESTPOOL
-zdb $TESTPOOL | grep "Checkpointed uberblock found" && \
- log_fail "zdb found checkpointed uberblock after discarding " \
- "the checkpoint"
-
-zdb -k $TESTPOOL && \
- log_fail "zdb opened checkpointed state that was discarded"
+log_mustnot eval "zdb $TESTPOOL | grep \"Checkpointed uberblock found\""
+log_mustnot eval "zdb -k $TESTPOOL"
log_pass "zdb can analyze checkpointed pools."
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/pool_names/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/pool_names/Makefile.am
deleted file mode 100644
index cd874861f0ac..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/pool_names/Makefile.am
+++ /dev/null
@@ -1,4 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/pool_names
-dist_pkgdata_SCRIPTS = \
- pool_names_001_pos.ksh \
- pool_names_002_neg.ksh
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/poolversion/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/poolversion/Makefile.am
deleted file mode 100644
index 51c2046457df..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/poolversion/Makefile.am
+++ /dev/null
@@ -1,6 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/poolversion
-dist_pkgdata_SCRIPTS = \
- setup.ksh \
- cleanup.ksh \
- poolversion_001_pos.ksh \
- poolversion_002_pos.ksh
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/poolversion/poolversion_001_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/poolversion/poolversion_001_pos.ksh
index 048cb29e3217..1f4780ccd387 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/poolversion/poolversion_001_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/poolversion/poolversion_001_pos.ksh
@@ -47,8 +47,7 @@ log_assert "zpool set version can upgrade a pool"
for version in 1 2 3 4 5 6 7 8
do
log_must zpool set version=$version $TESTPOOL
- ACTUAL=$(zpool get version $TESTPOOL | grep version \
- | awk '{print $3}')
+ ACTUAL=$(get_pool_prop version $TESTPOOL)
if [ "$ACTUAL" != "$version" ]
then
log_fail "v. $ACTUAL set for $TESTPOOL, expected v. $version!"
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/poolversion/poolversion_002_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/poolversion/poolversion_002_pos.ksh
index 69586473eaab..15cd446b6ea6 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/poolversion/poolversion_002_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/poolversion/poolversion_002_pos.ksh
@@ -50,7 +50,7 @@ log_must zpool set version=6 $TESTPOOL2
# verify it's actually that version - by checking the version property
# and also by trying to set bootfs (which should fail if it is not version 6)
-VERSION=$(zpool get version $TESTPOOL2| grep version | awk '{print $3}')
+VERSION=$(get_pool_prop version $TESTPOOL2)
if [ "$VERSION" != "6" ]
then
log_fail "Version $VERSION set for $TESTPOOL2 expected version 6!"
@@ -62,7 +62,7 @@ log_mustnot zpool set version=5 $TESTPOOL2
log_mustnot zpool set version=-1 $TESTPOOL2
# verify the version is still 6
-VERSION=$(zpool get version $TESTPOOL2 | grep version | awk '{print $3}')
+VERSION=$(get_pool_prop version $TESTPOOL2)
if [ "$VERSION" != "6" ]
then
log_fail "Version $VERSION set for $TESTPOOL2, expected version 6!"
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/privilege/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/privilege/Makefile.am
deleted file mode 100644
index ef26a750bb00..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/privilege/Makefile.am
+++ /dev/null
@@ -1,6 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/privilege
-dist_pkgdata_SCRIPTS = \
- setup.ksh \
- cleanup.ksh \
- privilege_001_pos.ksh \
- privilege_002_pos.ksh
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/privilege/setup.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/privilege/setup.ksh
index 4eb069394475..9d48d1961a7b 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/privilege/setup.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/privilege/setup.ksh
@@ -36,8 +36,7 @@ USES_NIS=false
# if we're running NIS, turn it off until we clean up
# (it can cause useradd to take a long time, hitting our TIMEOUT)
-svcs svc:/network/nis/client:default | grep online > /dev/null
-if [ $? -eq 0 ]
+if svcs svc:/network/nis/client:default | grep -q online
then
svcadm disable svc:/network/nis/client:default
USES_NIS=true
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/procfs/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/procfs/Makefile.am
deleted file mode 100644
index a7f022d9f210..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/procfs/Makefile.am
+++ /dev/null
@@ -1,8 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/procfs
-dist_pkgdata_SCRIPTS = \
- setup.ksh \
- cleanup.ksh \
- procfs_list_basic.ksh \
- procfs_list_concurrent_readers.ksh \
- procfs_list_stale_read.ksh \
- pool_state.ksh
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/procfs/pool_state.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/procfs/pool_state.ksh
index 080fdddb2d8f..d29bfd806913 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/procfs/pool_state.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/procfs/pool_state.ksh
@@ -106,7 +106,7 @@ log_assert "Testing /proc/spl/kstat/zfs/<pool>/state kstat"
check_all $TESTPOOL "ONLINE"
# Fault one of the disks, and check that pool is degraded
-DISK1=$(echo "$DISKS" | awk '{print $2}')
+read -r DISK1 _ <<<"$DISKS"
log_must zpool offline -tf $TESTPOOL $DISK1
check_all $TESTPOOL "DEGRADED"
log_must zpool online $TESTPOOL $DISK1
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/procfs/procfs_list_basic.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/procfs/procfs_list_basic.ksh
index 9104e4ba2ac3..18caea3c32cc 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/procfs/procfs_list_basic.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/procfs/procfs_list_basic.ksh
@@ -48,8 +48,8 @@ function cleanup
function count_snap_cmds
{
typeset expected_count=$1
- count=$(grep -E "command: (lt-)?zfs snapshot $FS@testsnapshot" | wc -l)
- log_must eval "[[ $count -eq $expected_count ]]"
+ count=$(grep -cE "command: (lt-)?zfs snapshot $FS@testsnapshot")
+ log_must [ "$count" -eq "$expected_count" ]
}
typeset -r ZFS_DBGMSG=/proc/spl/kstat/zfs/dbgmsg
@@ -85,7 +85,7 @@ done
# Clear out old messages and check that they really are gone
echo 0 >$ZFS_DBGMSG || log_fail "failed to write to $ZFS_DBGMSG"
-cat $ZFS_DBGMSG | count_snap_cmds 0
+count_snap_cmds 0 < $ZFS_DBGMSG
#
# Even though we don't expect any messages in the file, reading should still
# succeed.
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/procfs/procfs_list_concurrent_readers.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/procfs/procfs_list_concurrent_readers.ksh
index a24452ed5892..fcdd54da3591 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/procfs/procfs_list_concurrent_readers.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/procfs/procfs_list_concurrent_readers.ksh
@@ -41,8 +41,7 @@
function cleanup
{
- [[ -z $msgs1 ]] || log_must rm $msgs1
- [[ -z $msgs2 ]] || log_must rm $msgs2
+ log_must rm -f $msgs1 $msgs2
datasetexists $FS && destroy_dataset $FS -r
}
@@ -69,7 +68,7 @@ msgs2=$(mktemp) || log_fail
# Start reading file, pause and read it from another process, and then finish
# reading.
#
-{ dd bs=512 count=4; cat $ZFS_DBGMSG >$msgs1; cat; } <$ZFS_DBGMSG >$msgs2
+{ dd bs=512 count=4; cp $ZFS_DBGMSG $msgs1; cat; } <$ZFS_DBGMSG >$msgs2
#
# Truncate the result of the read that completed second in case it picked up an
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/procfs/procfs_list_stale_read.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/procfs/procfs_list_stale_read.ksh
index b3958b345d2a..dcc71788682d 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/procfs/procfs_list_stale_read.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/procfs/procfs_list_stale_read.ksh
@@ -74,9 +74,9 @@ function do_test
# finish reading.
#
{
- log_must dd bs=512 count=4 >/dev/null
+ log_must eval "dd bs=512 count=4 >/dev/null"
log_must eval "$cmd"
- cat 2>&1 >/dev/null | log_must grep "Input/output error"
+ log_must eval 'cat 2>&1 >/dev/null | grep "Input/output error"'
} <$TXG_HIST
}
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/projectquota/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/projectquota/Makefile.am
deleted file mode 100644
index e98c8672802e..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/projectquota/Makefile.am
+++ /dev/null
@@ -1,27 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/projectquota
-dist_pkgdata_SCRIPTS = \
- setup.ksh \
- cleanup.ksh \
- projectid_001_pos.ksh \
- projectid_002_pos.ksh \
- projectid_003_pos.ksh \
- projectquota_001_pos.ksh \
- projectquota_002_pos.ksh \
- projectquota_003_pos.ksh \
- projectquota_004_neg.ksh \
- projectquota_005_pos.ksh \
- projectquota_006_pos.ksh \
- projectquota_007_pos.ksh \
- projectquota_008_pos.ksh \
- projectquota_009_pos.ksh \
- projectspace_001_pos.ksh \
- projectspace_002_pos.ksh \
- projectspace_003_pos.ksh \
- projectspace_004_pos.ksh \
- projecttree_001_pos.ksh \
- projecttree_002_pos.ksh \
- projecttree_003_neg.ksh
-
-dist_pkgdata_DATA = \
- projectquota.cfg \
- projectquota_common.kshlib
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/projectquota/projectquota_003_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/projectquota/projectquota_003_pos.ksh
index 06f360d30b2b..44a5b09f9001 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/projectquota/projectquota_003_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/projectquota/projectquota_003_pos.ksh
@@ -54,7 +54,7 @@ log_onexit cleanup
log_assert "Check the basic function of project{obj}used"
sync_pool
-typeset project_used=$(get_value "projectused@$PRJID1" $QFS)
+typeset project_used=$(get_prop "projectused@$PRJID1" $QFS)
typeset file_size='10m'
if [[ $project_used != 0 ]]; then
@@ -66,8 +66,8 @@ log_must user_run $PUSER mkdir $PRJDIR
log_must chattr +P -p $PRJID1 $PRJDIR
log_must user_run $PUSER mkfile $file_size $PRJDIR/qf
sync_pool
-project_used=$(get_value "projectused@$PRJID1" $QFS)
-# get_value() reads the exact byte value which is slightly more than 10m
+project_used=$(get_prop "projectused@$PRJID1" $QFS)
+# get_prop() reads the exact byte value which is slightly more than 10m
if [[ "$(($project_used/1024/1024))m" != "$file_size" ]]; then
log_note "project $PRJID1 used is $project_used"
log_fail "projectused for project $PRJID1 expected to be $file_size, " \
@@ -75,7 +75,7 @@ if [[ "$(($project_used/1024/1024))m" != "$file_size" ]]; then
fi
log_must rm -rf $PRJDIR
-typeset project_obj_used=$(get_value "projectobjused@$PRJID2" $QFS)
+typeset project_obj_used=$(get_prop "projectobjused@$PRJID2" $QFS)
typeset file_count=100
if [[ $project_obj_used != 0 ]]; then
@@ -88,7 +88,7 @@ log_must chattr +P -p $PRJID2 $PRJDIR
# $PRJDIR has already used one object with the $PRJID2
log_must user_run $PUSER mkfiles $PRJDIR/qf_ $((file_count - 1))
sync_pool
-project_obj_used=$(get_value "projectobjused@$PRJID2" $QFS)
+project_obj_used=$(get_prop "projectobjused@$PRJID2" $QFS)
if [[ $project_obj_used != $file_count ]]; then
log_note "project $PRJID2 used is $project_obj_used"
log_fail "projectobjused for project $PRJID2 expected to be " \
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/projectquota/projectquota_common.kshlib b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/projectquota/projectquota_common.kshlib
index 0582164f9d6c..a90e001b2407 100644
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/projectquota/projectquota_common.kshlib
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/projectquota/projectquota_common.kshlib
@@ -75,21 +75,6 @@ function check_quota
fi
}
-function get_value
-{
- typeset prop_val
- typeset prop=$1
- typeset dataset=$2
-
- prop_val=$(zfs get -H -p -o value $prop $dataset 2>/dev/null)
- if [[ $? -ne 0 ]]; then
- log_note "Unable to get $prop property for dataset $dataset"
- return 1
- fi
-
- echo $prop_val
-}
-
function project_obj_count
{
typeset fs=$1
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/projectquota/projectspace_004_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/projectquota/projectspace_004_pos.ksh
index fc4a93f04463..51e790348ca6 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/projectquota/projectspace_004_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/projectquota/projectspace_004_pos.ksh
@@ -65,10 +65,10 @@ log_must chattr +P -p $PRJID1 $PRJDIR
log_must user_run $PUSER mkfile 50m $PRJDIR/qf
sync_pool
-total=$(df $PRJDIR | tail -n 1 | awk '{ print $2 }')
+total=$(df $PRJDIR | awk 'END { print $2 }')
[[ $total -eq 102400 ]] || log_fail "expect '102400' resource, but got '$total'"
-used=$(df -i $PRJDIR | tail -n 1 | awk '{ print $5 }')
+used=$(df -i $PRJDIR | awk 'END { print $5 }')
[[ "$used" == "2%" ]] || log_fail "expect '2%' used, but got '$used'"
log_pass "'df' on the directory with inherit project ID flag pass as expect"
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/projectquota/setup.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/projectquota/setup.ksh
index 88906d91cdbb..0402d241b100 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/projectquota/setup.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/projectquota/setup.ksh
@@ -45,10 +45,8 @@ log_must add_user $PGROUP $PUSER
#
# chmod 0750 $HOME
#
-user_run $PUSER zfs list
-if [ $? -ne 0 ]; then
+user_run $PUSER zfs list ||
log_unsupported "Test user $PUSER cannot execute zfs utilities"
-fi
DISK=${DISKS%% *}
default_setup_noexit $DISK
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/pyzfs/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/pyzfs/Makefile.am
deleted file mode 100644
index 26c5ac595a5d..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/pyzfs/Makefile.am
+++ /dev/null
@@ -1,7 +0,0 @@
-include $(top_srcdir)/config/Substfiles.am
-
-pkgpyzfsdir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/pyzfs
-pkgpyzfs_SCRIPTS = \
- pyzfs_unittest.ksh
-
-SUBSTFILES += $(pkgpyzfs_SCRIPTS)
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/pyzfs/pyzfs_unittest.ksh.in b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/pyzfs/pyzfs_unittest.ksh.in
index 84e20e2e7eba..d55c4f3270ae 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/pyzfs/pyzfs_unittest.ksh.in
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/pyzfs/pyzfs_unittest.ksh.in
@@ -32,10 +32,8 @@ fi
verify_runnable "global"
# Verify that the required dependencies for testing are installed.
-@PYTHON@ -c "import cffi" 2>/dev/null
-if [ $? -eq 1 ]; then
+@PYTHON@ -c "import cffi" 2>/dev/null ||
log_unsupported "python3-cffi not found by Python"
-fi
# We don't just try to "import libzfs_core" because we want to skip these tests
# only if pyzfs was not installed due to missing, build-time, dependencies; if
@@ -43,19 +41,16 @@ fi
# mismatch, we want to report it.
@PYTHON@ -c '
import pkgutil, sys
-sys.exit(pkgutil.find_loader("libzfs_core") is None)'
-if [ $? -eq 1 ]; then
+sys.exit(pkgutil.find_loader("libzfs_core") is None)' ||
log_unsupported "libzfs_core not found by Python"
-fi
log_assert "Verify the nvlist and libzfs_core Python unittest run successfully"
-# NOTE: don't use log_must() here because it makes output unreadable
+# log_must buffers stderr, which interacts badly with
+# no-output timeouts on CI runners
@PYTHON@ -m unittest --verbose \
libzfs_core.test.test_nvlist.TestNVList \
- libzfs_core.test.test_libzfs_core.ZFSTest
-if [ $? -ne 0 ]; then
+ libzfs_core.test.test_libzfs_core.ZFSTest ||
log_fail "Python unittest completed with errors"
-fi
log_pass "Python unittest completed without errors"
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/quota/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/quota/Makefile.am
deleted file mode 100644
index ba18bff7ecb7..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/quota/Makefile.am
+++ /dev/null
@@ -1,14 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/quota
-dist_pkgdata_SCRIPTS = \
- setup.ksh \
- cleanup.ksh \
- quota_001_pos.ksh \
- quota_002_pos.ksh \
- quota_003_pos.ksh \
- quota_004_pos.ksh \
- quota_005_pos.ksh \
- quota_006_neg.ksh
-
-dist_pkgdata_DATA = \
- quota.cfg \
- quota.kshlib
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/quota/quota.kshlib b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/quota/quota.kshlib
index 0ffe6394b54a..12e882d47e34 100644
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/quota/quota.kshlib
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/quota/quota.kshlib
@@ -59,8 +59,8 @@ function fill_quota
file_write -o create -f $MNTPT/$TESTFILE1 -b $BLOCK_SIZE \
-c $write_size -d 0
zret=$?
- [[ $zret -ne $EDQUOT ]] && \
- log_fail "Returned error code: $zret. Expected: $EDQUOT."
+ [[ $zret -ne $EDQUOT ]] && \
+ log_fail "Returned error code: $zret. Expected: $EDQUOT."
typeset -i file_size=`ls -lsk $MNTPT/$TESTFILE1 | awk '{ print $1 }'`
typeset -i limit=0
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/raidz/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/raidz/Makefile.am
deleted file mode 100644
index d93eb73cf832..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/raidz/Makefile.am
+++ /dev/null
@@ -1,8 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/raidz
-dist_pkgdata_SCRIPTS = \
- setup.ksh \
- cleanup.ksh \
- raidz_001_neg.ksh \
- raidz_002_pos.ksh \
- raidz_003_pos.ksh \
- raidz_004_pos.ksh
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/redacted_send/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/redacted_send/Makefile.am
deleted file mode 100644
index 61d0ea21356e..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/redacted_send/Makefile.am
+++ /dev/null
@@ -1,26 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/redacted_send
-dist_pkgdata_SCRIPTS = \
- setup.ksh \
- cleanup.ksh \
- redacted_compressed.ksh \
- redacted_contents.ksh \
- redacted_deleted.ksh \
- redacted_disabled_feature.ksh \
- redacted_embedded.ksh \
- redacted_holes.ksh \
- redacted_incrementals.ksh \
- redacted_largeblocks.ksh \
- redacted_many_clones.ksh \
- redacted_mixed_recsize.ksh \
- redacted_mounts.ksh \
- redacted_negative.ksh \
- redacted_origin.ksh \
- redacted_panic.ksh \
- redacted_props.ksh \
- redacted_resume.ksh \
- redacted_size.ksh \
- redacted_volume.ksh
-
-dist_pkgdata_DATA = \
- redacted.cfg \
- redacted.kshlib
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/redacted_send/redacted.cfg b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/redacted_send/redacted.cfg
index f964b37bad3b..3b9e1714dfe9 100644
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/redacted_send/redacted.cfg
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/redacted_send/redacted.cfg
@@ -23,8 +23,8 @@
# Copyright (c) 2018 by Delphix. All rights reserved.
#
-export DISK1=$(echo $DISKS | awk '{print $1}')
-export DISK2=$(echo $DISKS | awk '{print $2}')
+read -r DISK1 DISK2 _ <<<"$DISKS"
+export DISK1 DISK2
export POOL=$TESTPOOL
export POOL2=$TESTPOOL2
@@ -83,4 +83,4 @@ typeset RANGE12="0,2097152"
typeset RANGE13="0,16384"
typeset RANGE14=""
typeset RANGE15="0,4194304"
-typeset RANGE16="0,6291456" \ No newline at end of file
+typeset RANGE16="0,6291456"
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/redacted_send/redacted.kshlib b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/redacted_send/redacted.kshlib
index 30101939db64..a3810d55f97c 100644
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/redacted_send/redacted.kshlib
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/redacted_send/redacted.kshlib
@@ -29,6 +29,10 @@
. $STF_SUITE/tests/functional/rsend/rsend.kshlib
. $STF_SUITE/tests/functional/redacted_send/redacted.cfg
+if ! is_linux; then
+ alias udevadm=:
+fi
+
function setup_dataset
{
typeset ds_name=$1
@@ -227,7 +231,7 @@ function compare_files
[[ -f $file2 ]] || log_fail "File $file2 does not exist."
log_must eval "get_diff $file1 $file2 >$tmpfile"
- typeset range="$(cat $tmpfile)"
+ typeset range="$(<$tmpfile)"
log_must unmount_redacted $recvfs
[[ "$expected" = "$range" ]] || log_fail "Unexpected range: $range"
}
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/redacted_send/redacted_embedded.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/redacted_send/redacted_embedded.ksh
index 1c5b503a9be5..35faf038ad8f 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/redacted_send/redacted_embedded.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/redacted_send/redacted_embedded.ksh
@@ -60,13 +60,10 @@ for recsize in 512 1024 2048 4096 8192 16384; do
log_must eval "zdb -ddddd $sendfs $send_obj >$tmpdir/send.zdb"
log_must eval "zdb -ddddd $recvfs $recv_obj >$tmpdir/recv.zdb"
- grep -q "EMBEDDED" $tmpdir/send.zdb || \
- log_fail "Obj $send_obj not embedded in $sendfs"
- grep -q "EMBEDDED" $tmpdir/recv.zdb || \
- log_fail "Obj $recv_obj not embedded in $recvfs"
+ log_must grep -q "EMBEDDED" $tmpdir/send.zdb
+ log_must grep -q "EMBEDDED" $tmpdir/recv.zdb
- cat $stream | zstream dump -v | log_must grep -q \
- "WRITE_EMBEDDED object = $send_obj offset = 0"
+ log_must eval "zstream dump -v $stream | grep -q \"WRITE_EMBEDDED object = $send_obj offset = 0\""
done
log_must zfs destroy -R $recvfs
@@ -91,13 +88,10 @@ for recsize in 1024 4096 16384; do
log_must eval "zdb -ddddd $sendfs $send_obj >$tmpdir/send.zdb"
log_must eval "zdb -ddddd $recvfs $recv_obj >$tmpdir/recv.zdb"
- grep -q "EMBEDDED" $tmpdir/send.zdb || \
- log_fail "Obj $send_obj not embedded in $sendfs"
- grep -q "EMBEDDED" $tmpdir/recv.zdb || \
- log_fail "Obj $recv_obj not embedded in $recvfs"
+ log_must grep -q "EMBEDDED" $tmpdir/send.zdb
+ log_must grep -q "EMBEDDED" $tmpdir/recv.zdb
- cat $stream | zstream dump -v | log_must grep -q \
- "WRITE_EMBEDDED object = $send_obj offset = 0"
+ log_must eval "zstream dump -v $stream | log_must grep -q \"WRITE_EMBEDDED object = $send_obj offset = 0\""
done
log_pass "Embedded blocks and redacted send work correctly together."
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/redacted_send/redacted_props.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/redacted_send/redacted_props.ksh
index e4163c4ef8da..74b71cdf6954 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/redacted_send/redacted_props.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/redacted_send/redacted_props.ksh
@@ -66,8 +66,8 @@ get_guid_list $tmpdir/prop_list $sendfs#book1
get_guid_list $tmpdir/zdb_list $sendfs#book1 true
get_guid_list $tmpdir/recvd_prop_list $recvfs@snap
-count=$(wc -l $tmpdir/prop_list | awk '{print $1}')
-[[ $count -eq 16 ]] || log_fail "Found incorrect number of redaction snapshots."
+count=$(wc -l < $tmpdir/prop_list)
+[ $count -eq 16 ] || log_fail "Found incorrect number of redaction snapshots."
diff $tmpdir/prop_list $tmpdir/zdb_list || \
log_fail "Property list differed from zdb output"
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/redacted_send/redacted_resume.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/redacted_send/redacted_resume.ksh
index 8118ea59ec8b..31f7b0ada82c 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/redacted_send/redacted_resume.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/redacted_send/redacted_resume.ksh
@@ -53,7 +53,7 @@ log_must mount_redacted -f $recvfs
log_must set_tunable32 ALLOW_REDACTED_DATASET_MOUNT 1
log_must diff $send_mnt/f1 $recv_mnt/f1
log_must eval "get_diff $send_mnt/f2 $recv_mnt/f2 >$tmpdir/get_diff.out"
-typeset range=$(cat $tmpdir/get_diff.out)
+typeset range=$(<$tmpdir/get_diff.out)
[[ "$RANGE9" = "$range" ]] || log_fail "Unexpected range: $range"
log_must dd if=/dev/urandom of=$send_mnt/f3 bs=1024k count=3
@@ -70,7 +70,7 @@ resume_test "zfs send --redact book2 -i $sendfs#book1 $sendfs@snap2" \
log_must diff $send_mnt/f1 $recv_mnt/f1
log_must diff $send_mnt/f2 $recv_mnt/f2
log_must eval "get_diff $send_mnt/f3 $recv_mnt/f3 >$tmpdir/get_diff.out"
-range=$(cat $tmpdir/get_diff.out)
+range=$(<$tmpdir/get_diff.out)
[[ "$RANGE10" = "$range" ]] || log_fail "Unexpected range: $range"
# Test recv -A works properly and verify saved sends are not allowed
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/redacted_send/redacted_size.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/redacted_send/redacted_size.ksh
index 7456084b04bc..1634ffe06463 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/redacted_send/redacted_size.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/redacted_send/redacted_size.ksh
@@ -43,22 +43,19 @@ typeset clone_mnt="$(get_prop mountpoint $clone)"
log_must rm -rf $clone_mnt/*
log_must zfs snapshot $clone@snap
log_must zfs redact $sendfs@snap book $clone@snap
-log_must eval "zfs send -nvP --redact book $sendfs@snap | \
- grep '^size' | awk '{print \$2}' >$size"
-log_must eval "zfs send --redact book $sendfs@snap | wc -c \
- >$size2"
-bytes1=$(cat $size | tr -d '[[:space:]]')
-bytes2=$(cat $size2 | tr -d '[[:space:]]')
-[[ "$bytes1" -eq "$bytes2" ]] || \
+log_must eval "zfs send -nvP --redact book $sendfs@snap | awk '/^size/ {print \$2}' >$size"
+log_must eval "zfs send --redact book $sendfs@snap | wc -c >$size2"
+read -r bytes1 < $size
+read -r bytes2 < $size2
+[ "$bytes1" -eq "$bytes2" ] || \
log_fail "Full sizes differ: estimate $bytes1 and actual $bytes2"
log_must zfs snapshot $sendfs@snap2
-log_must eval "zfs send -nvP -i $sendfs#book $sendfs@snap2 | \
- grep '^size' | awk '{print \$2}' >$size"
+log_must eval "zfs send -nvP -i $sendfs#book $sendfs@snap2 | awk '/^size/ {print \$2}' >$size"
log_must eval "zfs send -i $sendfs#book $sendfs@snap2 | wc -c >$size2"
-bytes1=$(cat $size | tr -d '[[:space:]]')
-bytes2=$(cat $size2 | tr -d '[[:space:]]')
-[[ "$bytes1" -eq "$bytes2" ]] || \
+read -r bytes1 < $size
+read -r bytes2 < $size2
+[ "$bytes1" -eq "$bytes2" ] || \
log_fail "Incremental sizes differ: estimate $bytes1 and actual $bytes2"
log_pass "Size estimates of redacted sends estimate accurately."
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/redundancy/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/redundancy/Makefile.am
deleted file mode 100644
index 42c11c4aa957..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/redundancy/Makefile.am
+++ /dev/null
@@ -1,22 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/redundancy
-dist_pkgdata_SCRIPTS = \
- setup.ksh \
- cleanup.ksh \
- redundancy_draid.ksh \
- redundancy_draid1.ksh \
- redundancy_draid2.ksh \
- redundancy_draid3.ksh \
- redundancy_draid_damaged.ksh \
- redundancy_draid_spare1.ksh \
- redundancy_draid_spare2.ksh \
- redundancy_draid_spare3.ksh \
- redundancy_mirror.ksh \
- redundancy_raidz.ksh \
- redundancy_raidz1.ksh \
- redundancy_raidz2.ksh \
- redundancy_raidz3.ksh \
- redundancy_stripe.ksh
-
-dist_pkgdata_DATA = \
- redundancy.cfg \
- redundancy.kshlib
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/redundancy/redundancy.kshlib b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/redundancy/redundancy.kshlib
index 55816b451612..78c33d81db26 100644
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/redundancy/redundancy.kshlib
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/redundancy/redundancy.kshlib
@@ -142,7 +142,6 @@ function setup_test_env
log_must zpool create -O compression=off -f -m $TESTDIR $pool $keyword $vdevs
log_note "Filling up the filesystem ..."
- typeset -i ret=0
typeset -i i=0
typeset file=$TESTDIR/file
typeset -i limit
@@ -150,9 +149,7 @@ function setup_test_env
while true ; do
[[ $(get_prop available $pool) -lt $limit ]] && break
- file_write -o create -f $file.$i -b $BLOCKSZ -c $NUM_WRITES
- ret=$?
- (( $ret != 0 )) && break
+ file_write -o create -f $file.$i -b $BLOCKSZ -c $NUM_WRITES || break
(( i = i + 1 ))
done
@@ -163,16 +160,13 @@ function refill_test_env
{
log_note "Re-filling the filesystem ..."
typeset pool=$1
- typeset -i ret=0
typeset -i i=0
typeset mntpnt
mntpnt=$(get_prop mountpoint $pool)
typeset file=$mntpnt/file
while [[ -e $file.$i ]]; do
log_must rm -f $file.$i
- file_write -o create -f $file.$i -b $BLOCKSZ -c $NUM_WRITES
- ret=$?
- (( $ret != 0 )) && break
+ file_write -o create -f $file.$i -b $BLOCKSZ -c $NUM_WRITES || break
(( i = i + 1 ))
done
@@ -195,15 +189,12 @@ function is_healthy
return 0
else
typeset -i ret
- zpool status -x $pool | grep "state:" | \
- grep "FAULTED" >/dev/null 2>&1
- ret=$?
- (( $ret == 0 )) && return 1
+ zpool status -x $pool | grep "state:" | grep -q "FAULTED" && return 1
typeset l_scan
- typeset errnum
+ typeset errnum _
l_scan=$(zpool status -x $pool | grep "scan:")
l_scan=${l_scan##*"with"}
- errnum=$(echo $l_scan | awk '{print $1}')
+ read -r errnum _ <<<"$l_scan"
return $errnum
fi
@@ -221,7 +212,7 @@ function is_data_valid
log_must zpool scrub -w $pool
record_data $pool $PST_RECORD_FILE
- if ! diff $PRE_RECORD_FILE $PST_RECORD_FILE > /dev/null 2>&1; then
+ if ! cmp $PRE_RECORD_FILE $PST_RECORD_FILE > /dev/null; then
log_must cat $PRE_RECORD_FILE
log_must cat $PST_RECORD_FILE
diff -u $PRE_RECORD_FILE $PST_RECORD_FILE
@@ -242,13 +233,14 @@ function get_vdevs #pool cnt
typeset pool=$1
typeset -i cnt=$2
- typeset all_devs=$(zpool iostat -v $pool | awk '{print $1}'| \
- egrep -v "^pool$|^capacity$|^mirror\-[0-9]$|^raidz[1-3]\-[0-9]$|^draid[1-3].*\-[0-9]$|---" | \
- egrep -v "/old$|^$pool$")
+ typeset all_devs=$(zpool iostat -v $pool | awk '{print $1}' | \
+ grep -vEe "^pool$|^capacity$|^mirror\-[0-9]$|^raidz[1-3]\-[0-9]$|^draid[1-3].*\-[0-9]$|---" \
+ -e "/old$|^$pool$")
typeset -i i=0
typeset vdevs
while ((i < cnt)); do
- typeset dev=$(echo $all_devs | awk '{print $1}')
+ typeset dev _
+ read -r dev _ <<<"$all_devs"
eval all_devs=\${all_devs##*$dev}
vdevs="$dev $vdevs"
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/redundancy/redundancy_draid.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/redundancy/redundancy_draid.ksh
index b2721707cb75..285318853a9e 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/redundancy/redundancy_draid.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/redundancy/redundancy_draid.ksh
@@ -77,7 +77,7 @@ function test_selfheal # <pool> <parity> <dir>
log_must zpool import -o cachefile=none -d $dir $pool
typeset mntpnt=$(get_prop mountpoint $pool/fs)
- log_must find $mntpnt -type f -exec cksum {} + >> /dev/null 2>&1
+ log_must eval "find $mntpnt -type f -exec cksum {} + >> /dev/null 2>&1"
log_must check_pool_status $pool "errors" "No known data errors"
#
@@ -100,7 +100,7 @@ function test_selfheal # <pool> <parity> <dir>
log_must zpool import -o cachefile=none -d $dir $pool
typeset mntpnt=$(get_prop mountpoint $pool/fs)
- log_must find $mntpnt -type f -exec cksum {} + >> /dev/null 2>&1
+ log_must eval "find $mntpnt -type f -exec cksum {} + >> /dev/null 2>&1"
log_must check_pool_status $pool "errors" "No known data errors"
log_must zpool scrub -w $pool
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/redundancy/redundancy_draid_spare3.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/redundancy/redundancy_draid_spare3.ksh
index 28e8e3c6d707..dd4bca2795b9 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/redundancy/redundancy_draid_spare3.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/redundancy/redundancy_draid_spare3.ksh
@@ -48,10 +48,6 @@ function cleanup_tunable
log_onexit cleanup_tunable
-if is_kmemleak; then
- log_unsupported "Test case runs slowly when kmemleak is enabled"
-fi
-
#
# Disable scrubbing after a sequential resilver to verify the resilver
# alone is able to reconstruct the data without the help of a scrub.
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/redundancy/redundancy_raidz.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/redundancy/redundancy_raidz.ksh
index 7351cfaae5ed..a3ea3e53cb75 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/redundancy/redundancy_raidz.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/redundancy/redundancy_raidz.ksh
@@ -77,7 +77,7 @@ function test_selfheal # <pool> <parity> <dir>
log_must zpool import -o cachefile=none -d $dir $pool
typeset mntpnt=$(get_prop mountpoint $pool/fs)
- log_must find $mntpnt -type f -exec cksum {} + >> /dev/null 2>&1
+ log_must eval "find $mntpnt -type f -exec cksum {} + >> /dev/null 2>&1"
log_must check_pool_status $pool "errors" "No known data errors"
#
@@ -100,7 +100,7 @@ function test_selfheal # <pool> <parity> <dir>
log_must zpool import -o cachefile=none -d $dir $pool
typeset mntpnt=$(get_prop mountpoint $pool/fs)
- log_must find $mntpnt -type f -exec cksum {} + >> /dev/null 2>&1
+ log_must eval "find $mntpnt -type f -exec cksum {} + >> /dev/null 2>&1"
log_must check_pool_status $pool "errors" "No known data errors"
log_must zpool scrub -w $pool
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/refquota/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/refquota/Makefile.am
deleted file mode 100644
index 1d8418fbbec5..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/refquota/Makefile.am
+++ /dev/null
@@ -1,12 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/refquota
-dist_pkgdata_SCRIPTS = \
- setup.ksh \
- cleanup.ksh \
- refquota_001_pos.ksh \
- refquota_002_pos.ksh \
- refquota_003_pos.ksh \
- refquota_004_pos.ksh \
- refquota_005_pos.ksh \
- refquota_006_neg.ksh \
- refquota_007_neg.ksh \
- refquota_008_neg.ksh
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/refreserv/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/refreserv/Makefile.am
deleted file mode 100644
index bd760a1f0697..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/refreserv/Makefile.am
+++ /dev/null
@@ -1,14 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/refreserv
-dist_pkgdata_SCRIPTS = \
- setup.ksh \
- cleanup.ksh \
- refreserv_001_pos.ksh \
- refreserv_002_pos.ksh \
- refreserv_003_pos.ksh \
- refreserv_004_pos.ksh \
- refreserv_005_pos.ksh \
- refreserv_multi_raidz.ksh \
- refreserv_raidz.ksh
-
-dist_pkgdata_DATA = \
- refreserv.cfg
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/refreserv/refreserv_002_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/refreserv/refreserv_002_pos.ksh
index a8f58631f7b6..6b096f5d2010 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/refreserv/refreserv_002_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/refreserv/refreserv_002_pos.ksh
@@ -68,8 +68,7 @@ function max_refreserv
log_must zfs set refreserv=$rr $ds
while :; do
- zfs set refreserv=$((rr + incsize)) $ds >/dev/null 2>&1
- if [[ $? == 0 ]]; then
+ if zfs set refreserv=$((rr + incsize)) $ds >/dev/null 2>&1; then
((rr += incsize))
continue
else
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/removal/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/removal/Makefile.am
deleted file mode 100644
index 878935b96d3c..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/removal/Makefile.am
+++ /dev/null
@@ -1,38 +0,0 @@
-#
-# This file and its contents are supplied under the terms of the
-# Common Development and Distribution License ("CDDL"), version 1.0.
-# You may only use this file in accordance with the terms of version
-# 1.0 of the CDDL.
-#
-# A full copy of the text of the CDDL should have accompanied this
-# source. A copy of the CDDL is also available via the Internet at
-# http://www.illumos.org/license/CDDL.
-#
-
-#
-# Copyright (c) 2014, 2019 by Delphix. All rights reserved.
-#
-
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/removal
-
-dist_pkgdata_SCRIPTS = \
- cleanup.ksh removal_all_vdev.ksh removal_cancel.ksh \
- removal_check_space.ksh removal_condense_export.ksh \
- removal_multiple_indirection.ksh \
- removal_nopwrite.ksh removal_remap_deadlists.ksh \
- removal_reservation.ksh removal_resume_export.ksh \
- removal_sanity.ksh removal_with_add.ksh removal_with_create_fs.ksh \
- removal_with_dedup.ksh removal_with_errors.ksh \
- removal_with_export.ksh removal_with_faulted.ksh \
- removal_with_ganging.ksh \
- removal_with_remove.ksh removal_with_scrub.ksh \
- removal_with_send.ksh removal_with_send_recv.ksh \
- removal_with_snapshot.ksh removal_with_write.ksh \
- removal_with_zdb.ksh remove_mirror.ksh remove_mirror_sanity.ksh \
- remove_raidz.ksh remove_expanded.ksh remove_indirect.ksh \
- remove_attach_mirror.ksh
-
-dist_pkgdata_DATA = \
- removal.kshlib
-
-pkgexecdir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/removal
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/removal/removal.kshlib b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/removal/removal.kshlib
index 5752575a8bb1..664cafd9f39e 100644
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/removal/removal.kshlib
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/removal/removal.kshlib
@@ -88,13 +88,6 @@ function attempt_during_removal # pool disk callback [args]
return 0
}
-function indirect_vdev_mapping_size # pool
-{
- typeset pool=$1
- zdb -P $pool | grep 'indirect vdev' | \
- sed -E 's/.*\(([0-9]+) in memory\).*/\1/g'
-}
-
function random_write # file write_size
{
typeset file=$1
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/removal/remove_attach_mirror.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/removal/remove_attach_mirror.ksh
index 9bbb07cd9419..cdbd962025cf 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/removal/remove_attach_mirror.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/removal/remove_attach_mirror.ksh
@@ -32,6 +32,8 @@
# 4. Reattach it to make a mirror
#
+command -v fio > /dev/null || log_unsupported "fio missing"
+
TMPDIR=${TMPDIR:-$TEST_BASE_DIR}
DISK1="$TMPDIR/dsk1"
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/removal/remove_mirror_sanity.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/removal/remove_mirror_sanity.ksh
index 4473771521ba..21af3965ae79 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/removal/remove_mirror_sanity.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/removal/remove_mirror_sanity.ksh
@@ -21,9 +21,7 @@
. $STF_SUITE/include/libtest.shlib
. $STF_SUITE/tests/functional/removal/removal.kshlib
-DISK1=$(echo $DISKS | awk '{print $1}')
-DISK2=$(echo $DISKS | awk '{print $2}')
-DISK3=$(echo $DISKS | awk '{print $3}')
+read -r DISK1 DISK2 DISK3 _ <<<"$DISKS"
DISKS="$DISK1 $DISK2 $DISK3"
log_must default_setup_noexit "$DISK1 mirror $DISK2 $DISK3"
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/rename_dirs/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/rename_dirs/Makefile.am
deleted file mode 100644
index 029daf1f564b..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/rename_dirs/Makefile.am
+++ /dev/null
@@ -1,5 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/rename_dirs
-dist_pkgdata_SCRIPTS = \
- setup.ksh \
- cleanup.ksh \
- rename_dirs_001_pos.ksh
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/rename_dirs/rename_dirs_001_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/rename_dirs/rename_dirs_001_pos.ksh
index d7b6de1a2e01..938a7d391ab5 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/rename_dirs/rename_dirs_001_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/rename_dirs/rename_dirs_001_pos.ksh
@@ -61,10 +61,7 @@ mkdir -p 1/2/3/4/5 a/b/c/d/e
rename_dir &
sleep 10
-typeset -i retval=1
-pgrep -x rename_dir >/dev/null 2>&1
-retval=$?
-if (( $retval == 0 )); then
+if pgrep -x rename_dir >/dev/null 2>&1; then
pkill -9 -x rename_dir >/dev/null 2>&1
fi
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/replacement/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/replacement/Makefile.am
deleted file mode 100644
index fe6e4912198d..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/replacement/Makefile.am
+++ /dev/null
@@ -1,21 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/replacement
-dist_pkgdata_SCRIPTS = \
- setup.ksh \
- cleanup.ksh \
- attach_import.ksh \
- attach_multiple.ksh \
- attach_rebuild.ksh \
- attach_resilver.ksh \
- detach.ksh \
- rebuild_disabled_feature.ksh \
- rebuild_multiple.ksh \
- rebuild_raidz.ksh \
- replace_import.ksh \
- replace_rebuild.ksh \
- replace_resilver.ksh \
- resilver_restart_001.ksh \
- resilver_restart_002.ksh \
- scrub_cancel.ksh
-
-dist_pkgdata_DATA = \
- replacement.cfg
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/replacement/attach_rebuild.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/replacement/attach_rebuild.ksh
index 998d3eec7c71..384a588064b1 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/replacement/attach_rebuild.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/replacement/attach_rebuild.ksh
@@ -142,10 +142,7 @@ for op in "" "-f"; do
attach_test "$opt" $TESTDIR/$TESTFILE1.1 $TESTDIR/$REPLACEFILE
- zpool iostat -v $TESTPOOL1 | grep "$REPLACEFILE"
- if [[ $? -ne 0 ]]; then
- log_fail "$REPLACEFILE is not present."
- fi
+ log_must eval "zpool iostat -v $TESTPOOL1 | grep \"$REPLACEFILE\""
destroy_pool $TESTPOOL1
done
@@ -161,10 +158,7 @@ for type in "" "raidz" "raidz1" "draid" "draid1"; do
log_mustnot zpool attach -s "$opt" $TESTDIR/$TESTFILE1.1 \
$TESTDIR/$REPLACEFILE
- zpool iostat -v $TESTPOOL1 | grep "$REPLACEFILE"
- if [[ $? -eq 0 ]]; then
- log_fail "$REPLACEFILE should not be present."
- fi
+ log_mustnot eval "zpool iostat -v $TESTPOOL1 | grep \"$REPLACEFILE\""
destroy_pool $TESTPOOL1
done
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/replacement/attach_resilver.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/replacement/attach_resilver.ksh
index e99d681bb21d..d855ad928b60 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/replacement/attach_resilver.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/replacement/attach_resilver.ksh
@@ -141,10 +141,7 @@ for op in "" "-f"; do
attach_test "$opt" $TESTDIR/$TESTFILE1.1 $TESTDIR/$REPLACEFILE
- zpool iostat -v $TESTPOOL1 | grep "$REPLACEFILE"
- if [[ $? -ne 0 ]]; then
- log_fail "$REPLACEFILE is not present."
- fi
+ log_must eval "zpool iostat -v $TESTPOOL1 | grep \"$REPLACEFILE\""
destroy_pool $TESTPOOL1
done
@@ -160,10 +157,7 @@ for type in "" "raidz" "raidz1" "draid"; do
log_mustnot zpool attach "$opt" $TESTDIR/$TESTFILE1.1 \
$TESTDIR/$REPLACEFILE
- zpool iostat -v $TESTPOOL1 | grep "$REPLACEFILE"
- if [[ $? -eq 0 ]]; then
- log_fail "$REPLACEFILE should not be present."
- fi
+ log_mustnot eval "zpool iostat -v $TESTPOOL1 | grep \"$REPLACEFILE\""
destroy_pool $TESTPOOL1
done
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/replacement/detach.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/replacement/detach.ksh
index f049c639d8a6..8c8eb1e88331 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/replacement/detach.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/replacement/detach.ksh
@@ -134,10 +134,7 @@ log_must zfs set mountpoint=$TESTDIR1 $TESTPOOL1/$TESTFS1
detach_test $TESTDIR/$TESTFILE1.1
-zpool iostat -v $TESTPOOL1 | grep "$TESTFILE1.1"
-if [[ $? -eq 0 ]]; then
- log_fail "$TESTFILE1.1 should no longer be present."
-fi
+log_mustnot eval "zpool iostat -v $TESTPOOL1 | grep \"$TESTFILE1.1\""
destroy_pool $TESTPOOL1
@@ -150,10 +147,7 @@ for type in "" "raidz" "raidz1" "draid"; do
log_mustnot zpool detach $TESTDIR/$TESTFILE1.1
- zpool iostat -v $TESTPOOL1 | grep "$TESTFILE1.1"
- if [[ $? -ne 0 ]]; then
- log_fail "$TESTFILE1.1 is not present."
- fi
+ log_must eval "zpool iostat -v $TESTPOOL1 | grep \"$TESTFILE1.1\""
destroy_pool $TESTPOOL1
done
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/replacement/rebuild_disabled_feature.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/replacement/rebuild_disabled_feature.ksh
index d17d83b78333..5e86a8ccb8ac 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/replacement/rebuild_disabled_feature.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/replacement/rebuild_disabled_feature.ksh
@@ -45,8 +45,7 @@ function check_feature_flag
pool=$2
expected_value=$3
- value="$(zpool get -H -o property,value all $pool | \
- egrep "$feature" | awk '{print $2}')"
+ value="$(zpool get -H -o property,value all $pool | awk -v f="$feature" '$0 ~ f {print $2}')"
if [ "$value" = "$expected_value" ]; then
log_note "$feature verified to be $value"
else
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/replacement/replace_rebuild.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/replacement/replace_rebuild.ksh
index b3c7995fd62a..19823de1240d 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/replacement/replace_rebuild.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/replacement/replace_rebuild.ksh
@@ -145,10 +145,7 @@ for type in "" "mirror" "draid"; do
replace_test "$opt" $TESTDIR/$TESTFILE1.1 $TESTDIR/$REPLACEFILE
- zpool iostat -v $TESTPOOL1 | grep "$REPLACEFILE"
- if [[ $? -ne 0 ]]; then
- log_fail "$REPLACEFILE is not present."
- fi
+ log_must eval "zpool iostat -v $TESTPOOL1 | grep \"$REPLACEFILE\""
destroy_pool $TESTPOOL1
log_must rm -rf /$TESTPOOL1
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/replacement/replace_resilver.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/replacement/replace_resilver.ksh
index 2585397bba88..f25e8f548b72 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/replacement/replace_resilver.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/replacement/replace_resilver.ksh
@@ -142,10 +142,7 @@ for type in "" "raidz" "mirror" "draid"; do
replace_test "$opt" $TESTDIR/$TESTFILE1.1 $TESTDIR/$REPLACEFILE
- zpool iostat -v $TESTPOOL1 | grep "$REPLACEFILE"
- if [[ $? -ne 0 ]]; then
- log_fail "$REPLACEFILE is not present."
- fi
+ log_must eval "zpool iostat -v $TESTPOOL1 | grep \"$REPLACEFILE\""
destroy_pool $TESTPOOL1
log_must rm -rf /$TESTPOOL1
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/replacement/resilver_restart_001.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/replacement/resilver_restart_001.ksh
index 269d31bf8905..b498ba4af730 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/replacement/resilver_restart_001.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/replacement/resilver_restart_001.ksh
@@ -162,7 +162,7 @@ do
# inject read io errors on vdev and verify resilver does not restart
log_must zinject -a -d ${VDEV_FILES[2]} -e io -T read -f 0.25 $TESTPOOL1
- log_must cat ${DATAPATHS[1]} > /dev/null
+ log_must cp ${DATAPATHS[1]} /dev/null
log_must zinject -c all
# there should still be 2 resilver starts w/o defer, 1 with defer
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/replacement/resilver_restart_002.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/replacement/resilver_restart_002.ksh
index 4f2707693d13..bc5bc017768c 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/replacement/resilver_restart_002.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/replacement/resilver_restart_002.ksh
@@ -57,14 +57,14 @@ log_must set_tunable32 SCAN_LEGACY 1
# create the pool and a 32M file (32k blocks)
log_must truncate -s $VDEV_FILE_SIZE ${VDEV_FILES[0]} $SPARE_VDEV_FILE
log_must zpool create -f -O recordsize=1k $TESTPOOL1 ${VDEV_FILES[0]}
-log_must dd if=/dev/urandom of=/$TESTPOOL1/file bs=1M count=32 > /dev/null 2>&1
+log_must eval "dd if=/dev/urandom of=/$TESTPOOL1/file bs=1M count=32 2>/dev/null"
# determine objset/object
objset=$(zdb -d $TESTPOOL1/ | sed -ne 's/.*ID \([0-9]*\).*/\1/p')
object=$(ls -i /$TESTPOOL1/file | awk '{print $1}')
# inject event to cause error during resilver
-log_must zinject -b `printf "%x:%x:0:3fff" $objset $object` $TESTPOOL1
+log_must zinject -b $(printf "%x:%x:0:3fff" $objset $object) $TESTPOOL1
# clear events and start resilver
log_must zpool events -c
@@ -74,7 +74,7 @@ log_note "waiting for read errors to start showing up"
for iter in {0..59}
do
sync_pool $TESTPOOL1
- err=$(zpool status $TESTPOOL1 | grep ${VDEV_FILES[0]} | awk '{print $3}')
+ err=$(zpool status $TESTPOOL1 | awk -v dev=${VDEV_FILES[0]} '$0 ~ dev {print $3}')
(( $err > 0 )) && break
sleep 1
done
@@ -84,7 +84,7 @@ done
log_note "waiting for resilver to finish"
for iter in {0..59}
do
- finish=$(zpool events | grep "sysevent.fs.zfs.resilver_finish" | wc -l)
+ finish=$(zpool events | grep -cF "sysevent.fs.zfs.resilver_finish")
(( $finish > 0 )) && break
sleep 1
done
@@ -96,7 +96,7 @@ sync_pool $TESTPOOL1
sync_pool $TESTPOOL1
# check if resilver was restarted
-start=$(zpool events | grep "sysevent.fs.zfs.resilver_start" | wc -l)
+start=$(zpool events | grep -cF "sysevent.fs.zfs.resilver_start")
(( $start != 1 )) && log_fail "resilver restarted unnecessarily"
log_pass "Resilver did not restart unnecessarily from scan errors"
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/reservation/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/reservation/Makefile.am
deleted file mode 100644
index 8eaf09861551..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/reservation/Makefile.am
+++ /dev/null
@@ -1,30 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/reservation
-dist_pkgdata_SCRIPTS = \
- setup.ksh \
- cleanup.ksh \
- reservation_001_pos.ksh \
- reservation_002_pos.ksh \
- reservation_003_pos.ksh \
- reservation_004_pos.ksh \
- reservation_005_pos.ksh \
- reservation_006_pos.ksh \
- reservation_007_pos.ksh \
- reservation_008_pos.ksh \
- reservation_009_pos.ksh \
- reservation_010_pos.ksh \
- reservation_011_pos.ksh \
- reservation_012_pos.ksh \
- reservation_013_pos.ksh \
- reservation_014_pos.ksh \
- reservation_015_pos.ksh \
- reservation_016_pos.ksh \
- reservation_017_pos.ksh \
- reservation_018_pos.ksh \
- reservation_019_pos.ksh \
- reservation_020_pos.ksh \
- reservation_021_neg.ksh \
- reservation_022_pos.ksh
-
-dist_pkgdata_DATA = \
- reservation.cfg \
- reservation.shlib
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/reservation/reservation.shlib b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/reservation/reservation.shlib
index 47bd70f7cbcc..9bac794a9784 100644
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/reservation/reservation.shlib
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/reservation/reservation.shlib
@@ -38,25 +38,15 @@
#
function zero_reservation
{
- typeset resv_val
dataset=$1
log_must zfs set reservation=none $dataset
- resv_val=`zfs get -H reservation $dataset | awk '{print $3}'`
- if [[ $? -ne 0 ]]; then
- log_fail "Unable to get reservation prop on $dataset"
- elif [[ $resv_val != "none" ]]; then
- log_fail "Reservation not 'none' ($resv_val) as expected"
- fi
-
+ log_must eval 'resv_val="$(zfs get -Ho value reservation $dataset)"'
+ log_must [ $resv_val = "none" ]
- resv_val=`zfs get -pH reservation $dataset | awk '{print $3}'`
- if [[ $? -ne 0 ]]; then
- log_fail "Unable to get reservation prop on $dataset"
- elif [[ $resv_val -ne 0 ]]; then
- log_fail "Reservation not 0 ($resv_val) as expected"
- fi
+ log_must eval 'resv_val="$(zfs get -pHo value reservation $dataset)"'
+ log_must [ $resv_val -eq 0 ]
return 0
}
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/reservation/reservation_001_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/reservation/reservation_001_pos.ksh
index b8220791f1d4..4f151ef15c1d 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/reservation/reservation_001_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/reservation/reservation_001_pos.ksh
@@ -60,10 +60,10 @@ function cleanup
log_onexit cleanup
-log_assert "Verify that to set a reservation on a filesystem or volume must " \
+log_assert "Verify that to set a reservation on a filesystem or volume must" \
"use value smaller than space available property of pool"
-space_avail=`get_prop available $TESTPOOL`
+space_avail=$(get_prop available $TESTPOOL)
if ! is_global_zone ; then
OBJ_LIST=""
@@ -103,7 +103,7 @@ for obj in $TESTPOOL/$TESTFS $OBJ_LIST; do
log_must zfs set reservation=$resv_size_set $obj
- resv_size_get=`get_prop reservation $obj`
+ resv_size_get=$(get_prop reservation $obj)
if [[ $resv_size_set != $resv_size_get ]]; then
log_fail "Reservation not the expected value " \
"($resv_size_set != $resv_size_get)"
@@ -111,7 +111,7 @@ for obj in $TESTPOOL/$TESTFS $OBJ_LIST; do
log_must zero_reservation $obj
- new_space_avail=`get_prop available $obj`
+ new_space_avail=$(get_prop available $obj)
#
# Due to the way space is consumed and released by metadata we
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/reservation/reservation_013_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/reservation/reservation_013_pos.ksh
index bf0955223490..786d5d4d3008 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/reservation/reservation_013_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/reservation/reservation_013_pos.ksh
@@ -72,8 +72,6 @@ log_must zfs create $TESTPOOL/$TESTFS1
log_must zfs create $TESTPOOL/$TESTFS1/$TESTFS2
space_avail=$(get_prop available $TESTPOOL)
-[[ $? -ne 0 ]] && \
- log_fail "Unable to get space available property for $TESTPOOL"
typeset -il resv_set=space_avail/5
resv_set=$(floor_volsize $resv_set)
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/rootpool/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/rootpool/Makefile.am
deleted file mode 100644
index ca5ad14fdbb1..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/rootpool/Makefile.am
+++ /dev/null
@@ -1,7 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/rootpool
-dist_pkgdata_SCRIPTS = \
- setup.ksh \
- cleanup.ksh \
- rootpool_002_neg.ksh \
- rootpool_003_neg.ksh \
- rootpool_007_pos.ksh
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/rootpool/rootpool_002_neg.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/rootpool/rootpool_002_neg.ksh
index 32bacf753a0e..0d592ad33e58 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/rootpool/rootpool_002_neg.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/rootpool/rootpool_002_neg.ksh
@@ -54,7 +54,7 @@ typeset tmpfile="$TEST_BASE_DIR/mounted-datasets.$$"
# damage done by the attempted pool destroy. The destroy itself should fail,
# but some filesystems can become unmounted in the process, and aren't
# automatically remounted.
-mount -p | awk '{if ($4 == "zfs") print $1}' > $tmpfile
+mount -p | awk '$4 == "zfs" {print $1}' > $tmpfile
log_mustnot zpool destroy $rootpool
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/rootpool/setup.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/rootpool/setup.ksh
index 8d8097108190..d81b3dfbdd40 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/rootpool/setup.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/rootpool/setup.ksh
@@ -35,7 +35,7 @@ verify_runnable "global"
#
# This functionality is supported under Linux, but these test cases
-# are disabled by default since they manipulate the systems root pool.
+# are disabled by default since they manipulate the system's root pool.
#
if is_linux || is_freebsd; then
log_unsupported "Supported but disabled by default"
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/rsend/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/rsend/Makefile.am
deleted file mode 100644
index 305fc0d517d2..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/rsend/Makefile.am
+++ /dev/null
@@ -1,73 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/rsend
-dist_pkgdata_SCRIPTS = \
- setup.ksh \
- cleanup.ksh \
- recv_dedup.ksh \
- recv_dedup_encrypted_zvol.ksh \
- rsend_001_pos.ksh \
- rsend_002_pos.ksh \
- rsend_003_pos.ksh \
- rsend_004_pos.ksh \
- rsend_005_pos.ksh \
- rsend_006_pos.ksh \
- rsend_007_pos.ksh \
- rsend_008_pos.ksh \
- rsend_009_pos.ksh \
- rsend_010_pos.ksh \
- rsend_011_pos.ksh \
- rsend_012_pos.ksh \
- rsend_013_pos.ksh \
- rsend_014_pos.ksh \
- rsend_016_neg.ksh \
- rsend_019_pos.ksh \
- rsend_020_pos.ksh \
- rsend_021_pos.ksh \
- rsend_022_pos.ksh \
- rsend_024_pos.ksh \
- rsend_025_pos.ksh \
- rsend_026_neg.ksh \
- rsend_027_pos.ksh \
- rsend_028_neg.ksh \
- rsend_029_neg.ksh \
- send_encrypted_files.ksh \
- send_encrypted_hierarchy.ksh \
- send_encrypted_props.ksh \
- send_encrypted_truncated_files.ksh \
- send-c_embedded_blocks.ksh \
- send-c_incremental.ksh \
- send-c_lz4_disabled.ksh \
- send-c_mixed_compression.ksh \
- send-c_props.ksh \
- send-c_recv_dedup.ksh \
- send-c_recv_lz4_disabled.ksh \
- send-c_resume.ksh \
- send-c_stream_size_estimate.ksh \
- send-c_verify_contents.ksh \
- send-c_verify_ratio.ksh \
- send-c_volume.ksh \
- send-c_zstreamdump.ksh \
- send-cpL_varied_recsize.ksh \
- send-L_toggle.ksh \
- send_freeobjects.ksh \
- send_partial_dataset.ksh \
- send_realloc_dnode_size.ksh \
- send_realloc_files.ksh \
- send_realloc_encrypted_files.ksh \
- send_spill_block.ksh \
- send_raw_spill_block.ksh \
- send_raw_ashift.ksh \
- send_holds.ksh \
- send_hole_birth.ksh \
- send_invalid.ksh \
- send_mixed_raw.ksh \
- send-wR_encrypted_zvol.ksh \
- send_doall.ksh
-
-dist_pkgdata_DATA = \
- dedup.zsend.bz2 \
- dedup_encrypted_zvol.bz2 \
- dedup_encrypted_zvol.zsend.bz2 \
- fs.tar.gz \
- rsend.cfg \
- rsend.kshlib
-
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/rsend/rsend.cfg b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/rsend/rsend.cfg
index 8400ecfe35b4..99e87d9369ed 100644
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/rsend/rsend.cfg
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/rsend/rsend.cfg
@@ -29,9 +29,8 @@
export BACKDIR=${TEST_BASE_DIR%%/}/backdir-rsend
-export DISK1=$(echo $DISKS | awk '{print $1}')
-export DISK2=$(echo $DISKS | awk '{print $2}')
-export DISK3=$(echo $DISKS | awk '{print $3}')
+read -r DISK1 DISK2 DISK3 _ <<<"$DISKS"
+export DISK1 DISK2 DISK3
export POOL=$TESTPOOL
export POOL2=$TESTPOOL2
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/rsend/rsend.kshlib b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/rsend/rsend.kshlib
index 8d704ee36876..06886131cf83 100644
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/rsend/rsend.kshlib
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/rsend/rsend.kshlib
@@ -128,7 +128,7 @@ function cleanup_pool
#
# https://github.com/openzfs/zfs/issues/6143
#
- log_must df >/dev/null
+ log_must eval "df >/dev/null"
log_must_busy zfs destroy -Rf $pool
else
typeset list=$(zfs list -H -r -t all -o name $pool)
@@ -153,23 +153,13 @@ function cleanup_pool
if [[ -d $mntpnt ]]; then
rm -rf $mntpnt/*
fi
-
- return 0
-}
-
-function cleanup_pools
-{
- cleanup_pool $POOL2
- destroy_pool $POOL3
}
function cmp_md5s {
typeset file1=$1
typeset file2=$2
- typeset sum1=$(md5digest $file1)
- typeset sum2=$(md5digest $file2)
- test "$sum1" = "$sum2"
+ [ "$(md5digest $file1)" = "$(md5digest $file2)" ]
}
#
@@ -183,18 +173,9 @@ function cmp_ds_subs
typeset src_fs=$1
typeset dst_fs=$2
- zfs list -r -H -t all -o name $src_fs > $BACKDIR/src1
- zfs list -r -H -t all -o name $dst_fs > $BACKDIR/dst1
-
- eval sed -e 's:^$src_fs:PREFIX:g' < $BACKDIR/src1 > $BACKDIR/src
- eval sed -e 's:^$dst_fs:PREFIX:g' < $BACKDIR/dst1 > $BACKDIR/dst
-
- diff $BACKDIR/src $BACKDIR/dst
- typeset -i ret=$?
-
- rm -f $BACKDIR/src $BACKDIR/dst $BACKDIR/src1 $BACKDIR/dst1
-
- return $ret
+ diff \
+ <(zfs list -rHt all -o name $src_fs | sed "s:^$src_fs:PREFIX:g") \
+ <(zfs list -rHt all -o name $dst_fs | sed "s:^$dst_fs:PREFIX:g")
}
#
@@ -213,7 +194,6 @@ function cmp_ds_cont
dstdir=$(get_prop mountpoint $dst_fs)
replay_directory_diff $srcdir $dstdir
- return $?
}
#
@@ -221,39 +201,30 @@ function cmp_ds_cont
#
# $1 dataset 1
# $2 dataset 2
+# $3 -n == don't track property source
+# $4 -n == don't track the origin property
#
function cmp_ds_prop
{
typeset dtst1=$1
typeset dtst2=$2
- typeset -a props=("type" "origin" "volblocksize" "acltype" "dnodesize" \
- "atime" "canmount" "checksum" "compression" "copies" "devices" \
- "exec" "quota" "readonly" "recordsize" "reservation" "setuid" \
- "snapdir" "version" "volsize" "xattr" "mountpoint");
+ typeset nosource=$3
+ typeset noorigin=$4
+ typeset source=",source"; [ -n "$nosource" ] && source=
+ typeset origin=",origin"; [ -n "$noorigin" ] && origin=
+ typeset props="type$origin,volblocksize,acltype,dnodesize"
+ props+=",atime,canmount,checksum,compression,copies,devices"
+ props+=",exec,quota,readonly,recordsize,reservation,setuid"
+ props+=",snapdir,version,volsize,xattr,mountpoint"
if is_freebsd; then
- props+=("jailed")
+ props+=",jailed"
else
- props+=("zoned")
+ props+=",zoned"
fi
- for prop in $props;
- do
- zfs get -H -o property,value,source $prop $dtst1 >> \
- $BACKDIR/dtst1
- zfs get -H -o property,value,source $prop $dtst2 >> \
- $BACKDIR/dtst2
- done
-
- eval sed -e 's:$dtst1:PREFIX:g' < $BACKDIR/dtst1 > $BACKDIR/dtst1
- eval sed -e 's:$dtst2:PREFIX:g' < $BACKDIR/dtst2 > $BACKDIR/dtst2
-
- diff $BACKDIR/dtst1 $BACKDIR/dtst2
- typeset -i ret=$?
-
- rm -f $BACKDIR/dtst1 $BACKDIR/dtst2
-
- return $ret
-
+ diff \
+ <(zfs get -Ho property,value$source $props $dtst1 | sed -e "s:$dtst1:PREFIX:g" -e 's/^origin [^@]*/origin POOL/' -e 's/ inherited from [^/]*/ inherited from POOL/') \
+ <(zfs get -Ho property,value$source $props $dtst2 | sed -e "s:$dtst2:PREFIX:g" -e 's/^origin [^@]*/origin POOL/' -e 's/ inherited from [^/]*/ inherited from POOL/')
}
#
@@ -295,7 +266,6 @@ function snapshot_tree
typeset -i ret=0
if [[ $type == "filesystem" ]]; then
typeset mntpnt=$(get_prop mountpoint $ds)
- ((ret |= $?))
if ((ret == 0)) ; then
eval random_tree $mntpnt/${snap##$ds}
@@ -347,9 +317,7 @@ function getds_with_suffix
typeset ds=$1
typeset suffix=$2
- typeset list=$(zfs list -r -H -t all -o name $ds | grep "$suffix$")
-
- echo $list
+ zfs list -rHt all -o name $ds | grep "$suffix$"
}
#
@@ -366,8 +334,7 @@ function fs_inherit_prop
fi
else
fs_prop=$(zfs inherit 2>&1 | \
- awk '$2=="YES" && $3=="YES" {print $1}'|
- egrep -v "devices|mlslabel|sharenfs|sharesmb|zoned")
+ awk '$2=="YES" && $3=="YES" && !/devices|mlslabel|sharenfs|sharesmb|zoned/ {print $1}')
fi
echo $fs_prop
@@ -378,7 +345,7 @@ function fs_inherit_prop
#
function vol_inherit_prop
{
- echo "checksum readonly"
+ echo checksum readonly
}
#
@@ -597,8 +564,8 @@ function mess_send_file
# We use zstream dump to verify there is an intact DRR_BEGIN record.
offset=$(((($RANDOM * $RANDOM) % ($filesize - $minsize)) + $minsize))
nr_begins=$(head -c $offset $file | zstream dump | \
- grep DRR_BEGIN | awk '{ print $5 }')
- log_must test "$nr_begins" -eq 1
+ awk '/DRR_BEGIN/ { print $5 }')
+ log_must [ "$nr_begins" -eq 1 ]
if (($RANDOM % 7 <= 1)); then
#
@@ -625,13 +592,11 @@ function file_check
if [[ -d /$recvfs/.zfs/snapshot/a && -d \
/$sendfs/.zfs/snapshot/a ]]; then
- directory_diff /$recvfs/.zfs/snapshot/a /$sendfs/.zfs/snapshot/a
- [[ $? -eq 0 ]] || log_fail "Differences found in snap a"
+ log_must directory_diff /$recvfs/.zfs/snapshot/a /$sendfs/.zfs/snapshot/a
fi
if [[ -d /$recvfs/.zfs/snapshot/b && -d \
/$sendfs/.zfs/snapshot/b ]]; then
- directory_diff /$recvfs/.zfs/snapshot/b /$sendfs/.zfs/snapshot/b
- [[ $? -eq 0 ]] || log_fail "Differences found in snap b"
+ log_must directory_diff /$recvfs/.zfs/snapshot/b /$sendfs/.zfs/snapshot/b
fi
}
@@ -655,20 +620,18 @@ function resume_test
for ((i=0; i<2; i=i+1)); do
mess_send_file /$streamfs/$stream_num
- log_mustnot zfs recv -suv $recvfs </$streamfs/$stream_num
+ log_mustnot eval "zfs recv -suv $recvfs </$streamfs/$stream_num"
stream_num=$((stream_num+1))
- token=$(zfs get -Hp -o value receive_resume_token $recvfs)
+ token=$(get_prop receive_resume_token $recvfs)
# Do a dry-run
[ $dryrun -ne 0 ] && \
log_must eval "zfs send -nvt $token > /dev/null"
log_must eval "zfs send -t $token >/$streamfs/$stream_num"
- [[ -f /$streamfs/$stream_num ]] || \
- log_fail "NO FILE /$streamfs/$stream_num"
done
- log_must zfs recv -suv $recvfs </$streamfs/$stream_num
+ log_must eval "zfs recv -suv $recvfs </$streamfs/$stream_num"
}
function get_resume_token
@@ -679,11 +642,8 @@ function get_resume_token
log_must eval "$sendcmd > /$streamfs/1"
mess_send_file /$streamfs/1
- log_mustnot zfs recv -suv $recvfs < /$streamfs/1 2>&1
- token=$(zfs get -Hp -o value receive_resume_token $recvfs)
- echo "$token" > /$streamfs/resume_token
-
- return 0
+ log_mustnot eval "zfs recv -suv $recvfs < /$streamfs/1 2>&1"
+ get_prop receive_resume_token $recvfs > /$streamfs/resume_token
}
#
@@ -747,7 +707,7 @@ function stream_has_features
shift
[[ -f $file ]] || log_fail "Couldn't find file: $file"
- typeset flags=$(cat $file | zstream dump | \
+ typeset flags=$(zstream dump $file | \
awk '/features =/ {features = $3} END {print features}')
typeset -A feature
feature[dedup]="1"
@@ -797,7 +757,7 @@ function verify_stream_size
[[ -f $stream ]] || log_fail "No such file: $stream"
datasetexists $ds || log_fail "No such dataset: $ds"
- typeset stream_size=$(cat $stream | zstream dump | sed -n \
+ typeset stream_size=$(zstream dump $stream | sed -n \
's/ Total payload size = \(.*\) (0x.*)/\1/p')
typeset inc_size=0
@@ -815,8 +775,7 @@ function verify_stream_size
fi
ds_size=$((ds_size - inc_size))
- within_percent $stream_size $ds_size $percent || log_fail \
- "$stream_size $ds_size differed by too much"
+ log_must within_percent $stream_size $ds_size $percent
}
# Cleanup function for tests involving resumable send
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/rsend/rsend_011_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/rsend/rsend_011_pos.ksh
index f2df0ed03460..88f79f3e921a 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/rsend/rsend_011_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/rsend/rsend_011_pos.ksh
@@ -65,13 +65,13 @@ done
#
# Inherit properties in sub-datasets
#
-for ds in "$POOL/$FS/fs1" "$POOL/$FS/fs1/fs2" "$POOL/$FS/fs1/fclone" ; do
- for prop in $(fs_inherit_prop) ; do
+for ds in "$POOL/$FS/fs1" "$POOL/$FS/fs1/fs2" "$POOL/$FS/fs1/fclone"; do
+ for prop in $(fs_inherit_prop); do
log_must zfs inherit $prop $ds
done
done
-if is_global_zone ; then
- for prop in $(vol_inherit_prop) ; do
+if is_global_zone; then
+ for prop in $(vol_inherit_prop); do
log_must zfs inherit $prop $POOL/$FS/vol
done
fi
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/rsend/rsend_012_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/rsend/rsend_012_pos.ksh
index 694dd15b44f6..0608598b8333 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/rsend/rsend_012_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/rsend/rsend_012_pos.ksh
@@ -47,29 +47,21 @@ function edited_prop
typeset behaviour=$1
typeset ds=$2
typeset backfile=$TESTDIR/edited_prop_$ds
+ typeset te=0
case $behaviour in
"get")
+ is_te_enabled && te=1
typeset props=$(zfs inherit 2>&1 | \
- awk '$2=="YES" {print $1}' | \
- grep -Ev "^vol|\.\.\.$")
- for item in $props ; do
- if [[ $item == "mlslabel" ]] && \
- ! is_te_enabled ; then
- continue
- fi
- log_must eval "zfs get -H -o property,value $item $ds >> $backfile"
- done
+ awk -v te=$te '$2=="YES" && $1 !~ /^vol|\.\.\.$/ && (te || $1 != "mlslabel") {printf("%s,", $1)}')
+ log_must eval "zfs get -Ho property,value ${props%,} $ds >> $backfile"
;;
"set")
if [[ ! -f $backfile ]] ; then
log_fail "$ds need backup properties firstly."
fi
- typeset prop value
- while read -r prop value; do
- log_must zfs set "$prop=$value" "$ds"
- done < $backfile
+ log_must zfs set $(tr '\t' '=' < $backfile) "$ds"
;;
*)
log_fail "Unrecognized behaviour: $behaviour"
@@ -159,20 +151,16 @@ set -A pair "$POOL" "$POOL2" \
typeset -i i=0
while ((i < ${#pair[@]})); do
- log_must cmp_ds_prop ${pair[$i]} ${pair[((i+1))]}
-
+ log_must cmp_ds_prop ${pair[$i]} ${pair[((i+1))]} nosource
((i += 2))
done
-zpool upgrade -v | grep "Snapshot properties" > /dev/null 2>&1
-if (( $? == 0 )) ; then
- i=0
- while ((i < ${#pair[@]})); do
- log_must cmp_ds_prop ${pair[$i]}@final ${pair[((i+1))]}@final
- ((i += 2))
- done
-fi
+i=0
+while ((i < ${#pair[@]})); do
+ log_must cmp_ds_prop ${pair[$i]}@final ${pair[((i+1))]}@final
+ ((i += 2))
+done
-log_pass "Verify zfs send -R will backup all the filesystem properties " \
+log_pass "Verify zfs send -R will backup all the filesystem properties" \
"correctly."
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/rsend/send-c_props.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/rsend/send-c_props.ksh
index 6e95c2c30b67..82a2eb91e825 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/rsend/send-c_props.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/rsend/send-c_props.ksh
@@ -52,16 +52,27 @@ for opt in "-p" "-R"; do
randomize_ds_props $POOL$ds
done
- log_must eval "zfs send -c $opt $POOL@final > $BACKDIR/pool-final$opt"
- log_must eval "zfs receive -d -F $POOL2 < $BACKDIR/pool-final$opt"
+ if [ $opt = "-p" ]; then
+ for ds in ${datasets[@]}; do
+ log_must eval "zfs send -c $opt $POOL$ds@final > $BACKDIR/pool-final$opt"
+ log_must eval "zfs receive -dF $POOL2 < $BACKDIR/pool-final$opt"
+ done
+ else
+ log_must eval "zfs send -c $opt $POOL@final > $BACKDIR/pool-final$opt"
+ log_must eval "zfs receive -dF $POOL2 < $BACKDIR/pool-final$opt"
+ fi
for ds in ${datasets[@]}; do
- log_must cmp_ds_prop $POOL$ds $POOL2$ds
+ typeset origin=
+ if [ $opt = "-p" ] && [ ${ds/clone//} != $ds ]; then
+ origin=noorigin
+ fi
+ log_must cmp_ds_prop $POOL$ds $POOL2$ds nosource $origin
log_must cmp_ds_prop $POOL$ds@final $POOL2$ds@final
done
# Don't cleanup the second time, since we do that on exit anyway.
- [[ $opt = "-p" ]] && cleanup
+ [ $opt = "-p" ] && cleanup
done
log_pass "Compressed send doesn't interfere with preservation of properties"
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/rsend/send-c_stream_size_estimate.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/rsend/send-c_stream_size_estimate.ksh
index 056fc2cc2584..5d308d8f6574 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/rsend/send-c_stream_size_estimate.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/rsend/send-c_stream_size_estimate.ksh
@@ -40,19 +40,11 @@ function get_estimated_size
{
typeset cmd=$1
typeset ds=${cmd##* }
- if is_freebsd; then
- mkdir -p $BACKDIR
- typeset tmpfile=$(TMPDIR=$BACKDIR mktemp)
- else
- typeset tmpfile=$(mktemp -p $BACKDIR)
- fi
-
- eval "$cmd >$tmpfile"
- [[ $? -eq 0 ]] || log_fail "get_estimated_size: $cmd"
- typeset size=$(eval "awk '\$2 == \"$ds\" {print \$3}' $tmpfile")
- rm -f $tmpfile
+ typeset tmpfile=$(mktemp $BACKDIR/size_estimate.XXXXXXXX)
- echo $size
+ eval "$cmd >$tmpfile" || log_fail "$cmd: $?"
+ awk -v ds="$ds" '$2 == ds {print $3}' $tmpfile
+ rm -f $tmpfile
}
log_assert "Verify the stream size given by -P accounts for compressed send."
@@ -75,23 +67,19 @@ for compress in "${compress_prop_vals[@]}"; do
typeset ds_size=$(get_estimated_size "zfs send -nP $send_ds@snap")
typeset ds_lrefer=$(get_prop lrefer $send_ds)
- within_percent $ds_size $ds_lrefer 90 || log_fail \
- "$ds_size and $ds_lrefer differed by too much"
+ log_must within_percent $ds_size $ds_lrefer 90
typeset vol_size=$(get_estimated_size "zfs send -nP $send_vol@snap")
typeset vol_lrefer=$(get_prop lrefer $send_vol)
- within_percent $vol_size $vol_lrefer 90 || log_fail \
- "$vol_size and $vol_lrefer differed by too much"
+ log_must within_percent $vol_size $vol_lrefer 90
typeset ds_csize=$(get_estimated_size "zfs send -nP -c $send_ds@snap")
typeset ds_refer=$(get_prop refer $send_ds)
- within_percent $ds_csize $ds_refer 90 || log_fail \
- "$ds_csize and $ds_refer differed by too much"
+ log_must within_percent $ds_csize $ds_refer 90
typeset vol_csize=$(get_estimated_size "zfs send -nP -c $send_vol@snap")
typeset vol_refer=$(get_prop refer $send_vol)
- within_percent $vol_csize $vol_refer 90 || log_fail \
- "$vol_csize and $vol_refer differed by too much"
+ log_must within_percent $vol_csize $vol_refer 90
done
log_pass "The stream size given by -P accounts for compressed send."
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/rsend/send-c_zstreamdump.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/rsend/send-c_zstreamdump.ksh
index 5b9939c6a64c..82d15c68ec47 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/rsend/send-c_zstreamdump.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/rsend/send-c_zstreamdump.ksh
@@ -49,7 +49,7 @@ log_must zfs snapshot $sendfs@full
log_must eval "zfs send -c $sendfs@full >$BACKDIR/full"
log_must stream_has_features $BACKDIR/full lz4 compressed
-cat $BACKDIR/full | zstream dump -v > $BACKDIR/dump.out
+zstream dump -v $BACKDIR/full > $BACKDIR/dump.out
lsize=$(awk '/^WRITE [^0]/ {lsize += $24} END {printf("%d", lsize)}' \
$BACKDIR/dump.out)
@@ -63,8 +63,8 @@ csize_prop=$(get_prop used $sendfs)
within_percent $csize $csize_prop 90 || log_fail \
"$csize and $csize_prop differed by too much"
-x=$(get_resume_token "zfs send -c $sendfs@full" $streamfs $recvfs)
-resume_token=$(cat /$streamfs/resume_token)
+get_resume_token "zfs send -c $sendfs@full" $streamfs $recvfs
+resume_token=$(</$streamfs/resume_token)
to_name_fs=$sendfs
log_must eval "zstream token $resume_token | grep $to_name_fs"
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/rsend/send-cpL_varied_recsize.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/rsend/send-cpL_varied_recsize.ksh
index 25ad8e0820d1..cf390c26f960 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/rsend/send-cpL_varied_recsize.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/rsend/send-cpL_varied_recsize.ksh
@@ -134,7 +134,7 @@ function check
[[ -f $stream ]] && log_must rm $stream
log_must eval "zfs send $flags $send_snap >$stream"
$verify eval "zfs recv $recv_ds <$stream"
- typeset stream_size=$(cat $stream | zstream dump | sed -n \
+ typeset stream_size=$(zstream dump $stream | sed -n \
's/ Total write size = \(.*\) (0x.*)/\1/p')
#
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/rsend/send_doall.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/rsend/send_doall.ksh
index e5c3490b32cd..55b8c002e61a 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/rsend/send_doall.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/rsend/send_doall.ksh
@@ -46,12 +46,7 @@ log_must zfs create $POOL/fs/child
# Create 3 files and a snapshot between each file creation.
for i in {1..3}; do
- file="/$POOL/fs/file$i"
- log_must mkfile 16384 $file
-
- file="/$POOL/fs/child/file$i"
- log_must mkfile 16384 $file
-
+ log_must mkfile 16384 "/$POOL/fs/file$i" "/$POOL/fs/child/file$i"
log_must zfs snapshot -r $POOL/fs@snap$i
done
@@ -59,9 +54,6 @@ done
log_must eval "send_doall $POOL/fs@snap3 >$BACKDIR/fs@snap3"
log_must eval "zfs recv $POOL/newfs < $BACKDIR/fs@snap3"
-zfs list $POOL/newfs/child
-if [[ $? -eq 0 ]]; then
- log_fail "Children dataset should not have been received"
-fi
+log_mustnot datasetexists $POOL/newfs/child
log_pass "Verify send_doall stream is correct"
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/rsend/send_encrypted_truncated_files.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/rsend/send_encrypted_truncated_files.ksh
index aa19847e0695..aff54e3a7d69 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/rsend/send_encrypted_truncated_files.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/rsend/send_encrypted_truncated_files.ksh
@@ -54,11 +54,11 @@ function recursive_cksum
{
case "$(uname)" in
FreeBSD)
- find $1 -type f -exec sha256 -q {} \; | \
+ find $1 -type f -exec sha256 -q {} + | \
sort | sha256digest
;;
*)
- find $1 -type f -exec sha256sum {} \; | \
+ find $1 -type f -exec sha256sum {} + | \
sort -k 2 | awk '{ print $1 }' | sha256digest
;;
esac
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/scrub_mirror/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/scrub_mirror/Makefile.am
deleted file mode 100644
index bc657fbf2ad9..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/scrub_mirror/Makefile.am
+++ /dev/null
@@ -1,12 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/scrub_mirror
-dist_pkgdata_SCRIPTS = \
- setup.ksh \
- cleanup.ksh \
- scrub_mirror_001_pos.ksh \
- scrub_mirror_002_pos.ksh \
- scrub_mirror_003_pos.ksh \
- scrub_mirror_004_pos.ksh
-
-dist_pkgdata_DATA = \
- default.cfg \
- scrub_mirror_common.kshlib
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/simd/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/simd/Makefile.am
deleted file mode 100644
index bfc28868024a..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/simd/Makefile.am
+++ /dev/null
@@ -1,2 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/simd
-dist_pkgdata_SCRIPTS = simd_supported.ksh
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/simd/simd_supported.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/simd/simd_supported.ksh
index d88bc582bf08..1c89824e02fd 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/simd/simd_supported.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/simd/simd_supported.ksh
@@ -32,20 +32,20 @@
#
# STRATEGY:
# 1. Test if we are running on a Linux x86 system with SSE support
-# 2. If so, check if the zfs_fletcher_4_impl module parameter contains
+# 2. If so, check if the zfs_fletcher_4_impl module parameter contains
# a sse implementation
# 3. If not fail the test, otherwise pass it
log_note "Testing if we support SIMD instructions (Linux x86 only)"
-if !is_linux; then
+if ! is_linux; then
log_unsupported "Not a Linux System"
fi
case "$(uname -m)" in
-i386|i686|x86_64)
- typeset -R modparam="/sys/module/zcommon/parameters/zfs_fletcher_4_impl"
- if cat /proc/cpuinfo | awk '/^flags/ {print; exit;}' | grep -q sse; then
+i?86|x86_64)
+ typeset -R modparam="/sys/module/zfs/parameters/zfs_fletcher_4_impl"
+ if awk '/^flags/ {exit !/sse/}' /proc/cpuinfo; then
log_must grep -q sse "$modparam"
log_pass "SIMD instructions supported"
else
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/slog/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/slog/Makefile.am
deleted file mode 100644
index 92c3fd6c8e75..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/slog/Makefile.am
+++ /dev/null
@@ -1,27 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/slog
-dist_pkgdata_SCRIPTS = \
- setup.ksh \
- cleanup.ksh \
- slog_001_pos.ksh \
- slog_002_pos.ksh \
- slog_003_pos.ksh \
- slog_004_pos.ksh \
- slog_005_pos.ksh \
- slog_006_pos.ksh \
- slog_007_pos.ksh \
- slog_008_neg.ksh \
- slog_009_neg.ksh \
- slog_010_neg.ksh \
- slog_011_neg.ksh \
- slog_012_neg.ksh \
- slog_013_pos.ksh \
- slog_014_pos.ksh \
- slog_015_neg.ksh \
- slog_replay_fs_001.ksh \
- slog_replay_fs_002.ksh \
- slog_replay_volume.ksh \
- slog_016_pos.ksh
-
-dist_pkgdata_DATA = \
- slog.cfg \
- slog.kshlib
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/slog/slog.kshlib b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/slog/slog.kshlib
index 75cfec2d832d..8bc34d0dac32 100644
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/slog/slog.kshlib
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/slog/slog.kshlib
@@ -101,7 +101,7 @@ function verify_slog_device
#
# mirror:/disks/d ONLINE mirror:/disks/e ONLINE stripe:/disks/f ONLINE
#
- set -A dev_stat_tab $(zpool status -v $pool | nawk 'BEGIN {start=0} \
+ set -A dev_stat_tab $(zpool status -v $pool | awk 'BEGIN {start=0} \
/\tlogs/ {start=1}
/\tmirror/ || /\tspares/ || /^$/ {start=0}
(start==1) && /\t (\/|[a-zA-Z])/ \
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/slog/slog_014_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/slog/slog_014_pos.ksh
index dbdf1f1ce527..9d9bcf885d50 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/slog/slog_014_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/slog/slog_014_pos.ksh
@@ -76,11 +76,7 @@ for type in "mirror" "raidz" "raidz2"; do
log_must zpool offline $TESTPOOL $VDIR/a
log_must wait_for_degraded $TESTPOOL
- zpool status -v $TESTPOOL | grep logs | \
- grep "DEGRADED" 2>&1 >/dev/null
- if (( $? == 0 )); then
- log_fail "log device should display correct status"
- fi
+ log_mustnot eval "zpool status -v $TESTPOOL | grep logs | grep -q \"DEGRADED\""
log_must zpool online $TESTPOOL $VDIR/a
log_must zpool destroy -f $TESTPOOL
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/slog/slog_015_neg.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/slog/slog_015_neg.ksh
index 04fb225ed4ae..464be019dac3 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/slog/slog_015_neg.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/slog/slog_015_neg.ksh
@@ -31,6 +31,8 @@
verify_runnable "global"
+command -v fio > /dev/null || log_unsupported "fio missing"
+
function cleanup
{
#
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/snapshot/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/snapshot/Makefile.am
deleted file mode 100644
index 783133a643a1..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/snapshot/Makefile.am
+++ /dev/null
@@ -1,28 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/snapshot
-dist_pkgdata_SCRIPTS = \
- setup.ksh \
- cleanup.ksh \
- clone_001_pos.ksh \
- rollback_001_pos.ksh \
- rollback_002_pos.ksh \
- rollback_003_pos.ksh \
- snapshot_001_pos.ksh \
- snapshot_002_pos.ksh \
- snapshot_003_pos.ksh \
- snapshot_004_pos.ksh \
- snapshot_005_pos.ksh \
- snapshot_006_pos.ksh \
- snapshot_007_pos.ksh \
- snapshot_008_pos.ksh \
- snapshot_009_pos.ksh \
- snapshot_010_pos.ksh \
- snapshot_011_pos.ksh \
- snapshot_012_pos.ksh \
- snapshot_013_pos.ksh \
- snapshot_014_pos.ksh \
- snapshot_015_pos.ksh \
- snapshot_016_pos.ksh \
- snapshot_017_pos.ksh
-
-dist_pkgdata_DATA = \
- snapshot.cfg
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/snapshot/clone_001_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/snapshot/clone_001_pos.ksh
index 1c8a3b2a6c20..819e263b1c5b 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/snapshot/clone_001_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/snapshot/clone_001_pos.ksh
@@ -113,8 +113,7 @@ log_onexit cleanup_all
setup_all
-[[ -n $TESTDIR ]] && \
- log_must rm -rf $TESTDIR/* > /dev/null 2>&1
+[ -n $TESTDIR ] && log_must rm -rf $TESTDIR/*
typeset -i COUNT=10
typeset -i i=0
@@ -143,8 +142,7 @@ while (( i < ${#args[*]} )); do
if [[ -n ${args[i+3]} ]] ; then
log_must zfs set mountpoint=${args[i+3]} ${args[i+2]}
- FILE_COUNT=`ls -Al ${args[i+3]} | grep -v "total" \
- | grep -v "\.zfs" | wc -l`
+ FILE_COUNT=$(ls -A ${args[i+3]} | grep -cvF ".zfs")
if [[ $FILE_COUNT -ne $COUNT ]]; then
ls -Al ${args[i+3]}
log_fail "AFTER: ${args[i+3]} contains $FILE_COUNT files(s)."
@@ -158,7 +156,7 @@ while (( i < ${#args[*]} )); do
(( j = j + 1 ))
done
- FILE_COUNT=`ls -Al ${args[i+3]}/after* | grep -v "total" | wc -l`
+ FILE_COUNT=$(ls -A ${args[i+3]}/after* | wc -l)
if [[ $FILE_COUNT -ne $COUNT ]]; then
ls -Al ${args[i+3]}
log_fail "${args[i+3]} contains $FILE_COUNT after* files(s)."
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/snapshot/rollback_001_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/snapshot/rollback_001_pos.ksh
index 97194f4fe4a0..38db22fdfe17 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/snapshot/rollback_001_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/snapshot/rollback_001_pos.ksh
@@ -51,20 +51,17 @@ verify_runnable "both"
function cleanup
{
- snapexists $SNAPFS
- [[ $? -eq 0 ]] && \
+ snapexists $SNAPFS &&
log_must zfs destroy $SNAPFS
- [[ -e $TESTDIR ]] && \
- log_must rm -rf $TESTDIR/* > /dev/null 2>&1
+ [ -e $TESTDIR ] && log_must rm -rf $TESTDIR/*
}
log_assert "Verify that a rollback to a previous snapshot succeeds."
log_onexit cleanup
-[[ -n $TESTDIR ]] && \
- log_must rm -rf $TESTDIR/* > /dev/null 2>&1
+[ -n $TESTDIR ] && log_must rm -rf $TESTDIR/*
typeset -i COUNT=10
@@ -79,7 +76,7 @@ done
log_must zfs snapshot $SNAPFS
-FILE_COUNT=`ls -Al $SNAPDIR | grep -v "total" | wc -l`
+FILE_COUNT=$(ls -A $SNAPDIR | wc -l)
if [[ $FILE_COUNT -ne $COUNT ]]; then
ls -Al $SNAPDIR
log_fail "AFTER: $SNAPFS contains $FILE_COUNT files(s)."
@@ -100,14 +97,13 @@ sync_pool $TESTPOOL
#
log_must zfs rollback $SNAPFS
-FILE_COUNT=`ls -Al $TESTDIR/after* 2> /dev/null | grep -v "total" | wc -l`
+FILE_COUNT=$(ls -A $TESTDIR/after* 2> /dev/null | wc -l)
if [[ $FILE_COUNT -ne 0 ]]; then
ls -Al $TESTDIR
log_fail "$TESTDIR contains $FILE_COUNT after* files(s)."
fi
-FILE_COUNT=`ls -Al $TESTDIR/before* 2> /dev/null \
- | grep -v "total" | wc -l`
+FILE_COUNT=$(ls -A $TESTDIR/before* 2> /dev/null | wc -l)
if [[ $FILE_COUNT -ne $COUNT ]]; then
ls -Al $TESTDIR
log_fail "$TESTDIR contains $FILE_COUNT before* files(s)."
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/snapshot/rollback_002_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/snapshot/rollback_002_pos.ksh
index c424a69f0a7e..571065fdd69b 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/snapshot/rollback_002_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/snapshot/rollback_002_pos.ksh
@@ -51,24 +51,20 @@ verify_runnable "both"
function cleanup
{
- snapexists $SNAPFS.1
- [[ $? -eq 0 ]] && \
+ snapexists $SNAPFS.1 &&
log_must zfs destroy $SNAPFS.1
- snapexists $SNAPFS
- [[ $? -eq 0 ]] && \
+ snapexists $SNAPFS &&
log_must zfs destroy $SNAPFS
- [[ -e $TESTDIR ]] && \
- log_must rm -rf $TESTDIR/* > /dev/null 2>&1
+ [ -e $TESTDIR ] && log_must rm -rf $TESTDIR/*
}
log_assert "Verify rollback is with respect to latest snapshot."
log_onexit cleanup
-[[ -n $TESTDIR ]] && \
- log_must rm -rf $TESTDIR/* > /dev/null 2>&1
+[ -n $TESTDIR ] && log_must rm -rf $TESTDIR/*
typeset -i COUNT=10
@@ -83,7 +79,7 @@ done
log_must zfs snapshot $SNAPFS
-FILE_COUNT=`ls -Al $SNAPDIR | grep -v "total" | wc -l`
+FILE_COUNT=$(ls -A $SNAPDIR | wc -l)
if [[ $FILE_COUNT -ne $COUNT ]]; then
ls -Al $SNAPDIR
log_fail "AFTER: $SNAPFS contains $FILE_COUNT files(s)."
@@ -109,22 +105,20 @@ while [[ $i -le $COUNT ]]; do
(( i = i + 1 ))
done
-[[ -n $TESTDIR ]] && \
- log_must rm -rf $TESTDIR/original_file* > /dev/null 2>&1
+[ -n $TESTDIR ] && log_must rm -f $TESTDIR/original_file*
#
# Now rollback to latest snapshot
#
log_must zfs rollback $SNAPFS.1
-FILE_COUNT=`ls -Al $TESTDIR/aftersecond* 2> /dev/null \
- | grep -v "total" | wc -l`
+FILE_COUNT=$(ls -A $TESTDIR/aftersecond* 2> /dev/null | wc -l)
if [[ $FILE_COUNT -ne 0 ]]; then
ls -Al $TESTDIR
log_fail "$TESTDIR contains $FILE_COUNT aftersecond* files(s)."
fi
-FILE_COUNT=`ls -Al $TESTDIR/original* $TESTDIR/afterfirst*| grep -v "total" | wc -l`
+FILE_COUNT=$(ls -A $TESTDIR/original* $TESTDIR/afterfirst* | wc -l)
if [[ $FILE_COUNT -ne 20 ]]; then
ls -Al $TESTDIR
log_fail "$TESTDIR contains $FILE_COUNT original* files(s)."
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/snapshot/rollback_003_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/snapshot/rollback_003_pos.ksh
index 766de990ecdb..e707640acd14 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/snapshot/rollback_003_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/snapshot/rollback_003_pos.ksh
@@ -100,7 +100,7 @@ log_must zfs snapshot $SNAPPOOL.1
#
# https://github.com/openzfs/zfs/issues/6143
#
-log_must df >/dev/null
+log_must eval "df >/dev/null"
export __ZFS_POOL_RESTRICT="$TESTPOOL"
log_must zfs unmount -a
@@ -110,6 +110,6 @@ unset __ZFS_POOL_RESTRICT
log_must touch /$TESTPOOL/$TESTFILE/$TESTFILE.1
log_must zfs rollback $SNAPPOOL.1
-log_must df >/dev/null
+log_must eval "df >/dev/null"
log_pass "Rollbacks succeed when nested file systems are present."
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/snapshot/snapshot_001_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/snapshot/snapshot_001_pos.ksh
index 8b8c118d9dfb..9a677b036ead 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/snapshot/snapshot_001_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/snapshot/snapshot_001_pos.ksh
@@ -35,8 +35,8 @@
#
# DESCRIPTION:
# A zfs file system snapshot is identical to
-# the originally snapshot'd file system, after the file
-# system has been changed. Uses 'sum -r'.
+# the originally snapshotted file system, after the file
+# system has been changed. Uses 'cksum'.
#
# STRATEGY:
# 1. Create a file in the zfs file system
@@ -50,18 +50,11 @@ verify_runnable "both"
function cleanup
{
- snapexists $SNAPFS
- if [[ $? -eq 0 ]]; then
+ if snapexists $SNAPFS; then
log_must zfs destroy $SNAPFS
fi
- if [[ -e $SNAPDIR ]]; then
- log_must rm -rf $SNAPDIR > /dev/null 2>&1
- fi
-
- if [[ -e $TESTDIR ]]; then
- log_must rm -rf $TESTDIR/* > /dev/null 2>&1
- fi
+ log_must rm -rf $SNAPDIR $TESTDIR/*
}
log_assert "Verify a file system snapshot is identical to original."
@@ -73,7 +66,7 @@ log_must file_write -o create -f $TESTDIR/$TESTFILE -b $BLOCKSZ \
-c $NUM_WRITES -d $DATA
log_note "Sum the file, save for later comparison..."
-FILE_SUM=`sum -r $TESTDIR/$TESTFILE | awk '{ print $1 }'`
+read -r FILE_SUM _ < <(cksum $TESTDIR/$TESTFILE)
log_note "FILE_SUM = $FILE_SUM"
log_note "Create a snapshot and mount it..."
@@ -83,7 +76,7 @@ log_note "Append to the original file..."
log_must file_write -o append -f $TESTDIR/$TESTFILE -b $BLOCKSZ \
-c $NUM_WRITES -d $DATA
-SNAP_FILE_SUM=`sum -r $SNAPDIR/$TESTFILE | awk '{ print $1 }'`
+read -r SNAP_FILE_SUM _ < <(cksum $SNAPDIR/$TESTFILE)
if [[ $SNAP_FILE_SUM -ne $FILE_SUM ]]; then
log_fail "Sums do not match, aborting!! ($SNAP_FILE_SUM != $FILE_SUM)"
fi
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/snapshot/snapshot_002_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/snapshot/snapshot_002_pos.ksh
index 42fbbd9a7a2b..a3ed1b548210 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/snapshot/snapshot_002_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/snapshot/snapshot_002_pos.ksh
@@ -51,26 +51,13 @@ verify_runnable "both"
function cleanup
{
- if [[ -d $CWD ]]; then
- cd $CWD || log_fail "Could not cd $CWD"
- fi
-
- snapexists $SNAPFS
- if [[ $? -eq 0 ]]; then
- log_must zfs destroy $SNAPFS
- fi
-
- if [[ -e $SNAPDIR ]]; then
- log_must rm -rf $SNAPDIR > /dev/null 2>&1
- fi
-
- if [[ -e $TESTDIR ]]; then
- log_must rm -rf $TESTDIR/* > /dev/null 2>&1
- fi
-
- if [[ -d "$SNAPSHOT_TARDIR" ]]; then
- log_must rm -rf $SNAPSHOT_TARDIR > /dev/null 2>&1
- fi
+ [ -d $CWD ] && log_must cd $CWD
+
+ snapexists $SNAPFS && log_must zfs destroy $SNAPFS
+
+ [ -e $SNAPDIR ] && log_must rm -rf $SNAPDIR
+ [ -e $TESTDIR ] && log_must rm -rf $TESTDIR/*
+ [ -d "$SNAPSHOT_TARDIR" ] && log_must rm -rf $SNAPSHOT_TARDIR
}
log_assert "Verify an archive of a file system is identical to " \
@@ -82,8 +69,7 @@ log_onexit cleanup
typeset -i COUNT=21
typeset OP=create
-[[ -n $TESTDIR ]] && \
- rm -rf $TESTDIR/* > /dev/null 2>&1
+[ -n $TESTDIR ] && rm -rf $TESTDIR/*
log_note "Create files in the zfs filesystem..."
@@ -96,33 +82,32 @@ done
log_note "Create a tarball from $TESTDIR contents..."
CWD=$PWD
-cd $TESTDIR || log_fail "Could not cd $TESTDIR"
+log_must cd $TESTDIR
log_must tar cf $SNAPSHOT_TARDIR/original.tar .
-cd $CWD || log_fail "Could not cd $CWD"
+log_must cd $CWD
log_note "Create a snapshot and mount it..."
log_must zfs snapshot $SNAPFS
log_note "Remove all of the original files..."
-log_must rm -f $TESTDIR/file* > /dev/null 2>&1
+log_must rm -f $TESTDIR/file*
log_note "Create tarball of snapshot..."
CWD=$PWD
-cd $SNAPDIR || log_fail "Could not cd $SNAPDIR"
+log_must cd $SNAPDIR
log_must tar cf $SNAPSHOT_TARDIR/snapshot.tar .
-cd $CWD || log_fail "Could not cd $CWD"
+log_must cd $CWD
-log_must mkdir $TESTDIR/original
-log_must mkdir $TESTDIR/snapshot
+log_must mkdir $TESTDIR/original $TESTDIR/snapshot
CWD=$PWD
-cd $TESTDIR/original || log_fail "Could not cd $TESTDIR/original"
+log_must cd $TESTDIR/original
log_must tar xf $SNAPSHOT_TARDIR/original.tar
-cd $TESTDIR/snapshot || log_fail "Could not cd $TESTDIR/snapshot"
+log_must cd $TESTDIR/snapshot
log_must tar xf $SNAPSHOT_TARDIR/snapshot.tar
-cd $CWD || log_fail "Could not cd $CWD"
+log_must cd $CWD
log_must directory_diff $TESTDIR/original $TESTDIR/snapshot
log_pass "Directory structures match."
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/snapshot/snapshot_003_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/snapshot/snapshot_003_pos.ksh
index 054b58cd5590..a1357b1551e6 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/snapshot/snapshot_003_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/snapshot/snapshot_003_pos.ksh
@@ -49,20 +49,17 @@ function cleanup
{
typeset -i i=1
while [ $i -lt $COUNT ]; do
- snapexists $SNAPFS.$i
- if [[ $? -eq 0 ]]; then
- log_must zfs destroy $SNAPFS.$i
- fi
+ snapexists $SNAPFS.$i && log_must zfs destroy $SNAPFS.$i
- if [[ -e $SNAPDIR.$i ]]; then
- log_must rm -rf $SNAPDIR.$i > /dev/null 2>&1
+ if [ -e $SNAPDIR.$i ]; then
+ log_must rm -rf $SNAPDIR.$i
fi
(( i = i + 1 ))
done
- if [[ -e $TESTDIR ]]; then
- log_must rm -rf $TESTDIR/* > /dev/null 2>&1
+ if [ -e $TESTDIR ]; then
+ log_must rm -rf $TESTDIR/*
fi
}
@@ -70,8 +67,7 @@ log_assert "Verify many snapshots of a file system can be taken."
log_onexit cleanup
-[[ -n $TESTDIR ]] && \
- log_must rm -rf $TESTDIR/* > /dev/null 2>&1
+[ -n $TESTDIR ] && log_must rm -rf $TESTDIR/*
typeset -i COUNT=10
@@ -86,12 +82,11 @@ while [[ $i -lt $COUNT ]]; do
done
log_note "Remove all of the original files"
-[[ -n $TESTDIR ]] && \
- log_must rm -rf $TESTDIR/file* > /dev/null 2>&1
+[ -n $TESTDIR ] && log_must rm -rf $TESTDIR/file*
i=1
while [[ $i -lt $COUNT ]]; do
- FILECOUNT=`ls $SNAPDIR.$i/file* | wc -l`
+ FILECOUNT=$(ls $SNAPDIR.$i/file* | wc -l)
typeset j=1
while [ $j -lt $FILECOUNT ]; do
log_must file_check $SNAPDIR.$i/file$j $j
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/snapshot/snapshot_004_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/snapshot/snapshot_004_pos.ksh
index 9d3b3de1adc0..683afb5e1a3f 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/snapshot/snapshot_004_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/snapshot/snapshot_004_pos.ksh
@@ -48,23 +48,19 @@ verify_runnable "both"
function cleanup
{
- snapexists $SNAPFS
- [[ $? -eq 0 ]] && \
- log_must zfs destroy $SNAPFS
+ snapexists $SNAPFS && log_must zfs destroy $SNAPFS
- [[ -e $TESTDIR ]] && \
- log_must rm -rf $TESTDIR/* > /dev/null 2>&1
+ [ -e $TESTDIR ] && log_must rm -rf $TESTDIR/*
}
log_assert "Verify that a snapshot of an empty file system remains empty."
log_onexit cleanup
-[[ -n $TESTDIR ]] && \
- log_must rm -rf $TESTDIR/* > /dev/null 2>&1
+[ -n $TESTDIR ] && log_must rm -rf $TESTDIR/*
log_must zfs snapshot $SNAPFS
-FILE_COUNT=`ls -Al $SNAPDIR | grep -v "total 0" | wc -l`
+FILE_COUNT=$(ls -A $SNAPDIR | wc -l)
if [[ $FILE_COUNT -ne 0 ]]; then
ls $SNAPDIR
log_fail "BEFORE: $SNAPDIR contains $FILE_COUNT files(s)."
@@ -81,7 +77,7 @@ while [[ $i -lt $COUNT ]]; do
(( i = i + 1 ))
done
-FILE_COUNT=`ls -Al $SNAPDIR | grep -v "total 0" | wc -l`
+FILE_COUNT=$(ls -A $SNAPDIR | wc -l)
if [[ $FILE_COUNT -ne 0 ]]; then
ls $SNAPDIR
log_fail "AFTER: $SNAPDIR contains $FILE_COUNT files(s)."
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/snapshot/snapshot_005_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/snapshot/snapshot_005_pos.ksh
index c1917dff1299..a5667badf53a 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/snapshot/snapshot_005_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/snapshot/snapshot_005_pos.ksh
@@ -35,7 +35,7 @@
#
# DESCRIPTION:
# to the originally snapshot'd file system, after the file
-# system has been changed. Uses 'sum -r'.
+# system has been changed. Uses 'cksum'.
#
# STRATEGY:
# 1) Create a file in the zfs dataset
@@ -49,17 +49,14 @@ verify_runnable "both"
function cleanup
{
- snapexists $SNAPCTR
- if [[ $? -eq 0 ]]; then
- log_must zfs destroy $SNAPCTR
- fi
+ snapexists $SNAPCTR && log_must zfs destroy $SNAPCTR
- if [[ -e $SNAPDIR1 ]]; then
- log_must rm -rf $SNAPDIR1 > /dev/null 2>&1
+ if [ -e $SNAPDIR1 ]; then
+ log_must rm -rf $SNAPDIR1
fi
- if [[ -e $TESTDIR ]]; then
- log_must rm -rf $TESTDIR/* > /dev/null 2>&1
+ if [ -e $TESTDIR ]; then
+ log_must rm -rf $TESTDIR/*
fi
}
@@ -72,7 +69,7 @@ log_must file_write -o create -f $TESTDIR1/$TESTFILE -b $BLOCKSZ \
-c $NUM_WRITES -d $DATA
log_note "Sum the file, save for later comparison..."
-FILE_SUM=`sum -r $TESTDIR1/$TESTFILE | awk '{ print $1 }'`
+read -r FILE_SUM _ < <(cksum $TESTDIR1/$TESTFILE)
log_note "FILE_SUM = $FILE_SUM"
log_note "Create a snapshot and mount it..."
@@ -82,8 +79,8 @@ log_note "Append to the original file..."
log_must file_write -o append -f $TESTDIR1/$TESTFILE -b $BLOCKSZ \
-c $NUM_WRITES -d $DATA
-SNAP_FILE_SUM=`sum -r $SNAPDIR1/$TESTFILE | awk '{ print $1 }'`
-if [[ $SNAP_FILE_SUM -ne $FILE_SUM ]]; then
+read -r SNAP_FILE_SUM _ < <(cksum $SNAPDIR1/$TESTFILE)
+if [ $SNAP_FILE_SUM -ne $FILE_SUM ]; then
log_fail "Sums do not match, aborting!! ($SNAP_FILE_SUM != $FILE_SUM)"
fi
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/snapshot/snapshot_006_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/snapshot/snapshot_006_pos.ksh
index d2a304670981..2130ff8901cd 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/snapshot/snapshot_006_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/snapshot/snapshot_006_pos.ksh
@@ -51,24 +51,21 @@ verify_runnable "both"
function cleanup
{
if [[ -d $CWD ]]; then
- cd $CWD || log_fail "Could not cd $CWD"
+ log_must cd $CWD
fi
- snapexists $SNAPCTR
- if [[ $? -eq 0 ]]; then
- log_must zfs destroy $SNAPCTR
- fi
+ snapexists $SNAPCTR && log_must zfs destroy $SNAPCTR
- if [[ -e $SNAPDIR1 ]]; then
- log_must rm -rf $SNAPDIR1 > /dev/null 2>&1
+ if [ -e $SNAPDIR1 ]; then
+ log_must rm -rf $SNAPDIR1
fi
- if [[ -e $TESTDIR1 ]]; then
- log_must rm -rf $TESTDIR1/* > /dev/null 2>&1
+ if [ -e $TESTDIR1 ]; then
+ log_must rm -rf $TESTDIR1/*
fi
- if [[ -d "$SNAPSHOT_TARDIR" ]]; then
- log_must rm -rf $SNAPSHOT_TARDIR > /dev/null 2>&1
+ if [ -d "$SNAPSHOT_TARDIR" ]; then
+ log_must rm -rf $SNAPSHOT_TARDIR
fi
}
@@ -81,7 +78,7 @@ log_onexit cleanup
typeset -i COUNT=21
typeset OP=create
-[[ -n $TESTDIR1 ]] && rm -rf $TESTDIR1/* > /dev/null 2>&1
+[ -n $TESTDIR1 ] && rm -rf $TESTDIR1/*
log_note "Create files in the zfs dataset ..."
@@ -94,33 +91,32 @@ done
log_note "Create a tarball from $TESTDIR1 contents..."
CWD=$PWD
-cd $TESTDIR1 || log_fail "Could not cd $TESTDIR1"
+log_must cd $TESTDIR1
log_must tar cf $SNAPSHOT_TARDIR/original.tar .
-cd $CWD || log_fail "Could not cd $CWD"
+log_must cd $CWD
log_note "Create a snapshot and mount it..."
log_must zfs snapshot $SNAPCTR
log_note "Remove all of the original files..."
-log_must rm -f $TESTDIR1/file* > /dev/null 2>&1
+log_must rm -f $TESTDIR1/file*
log_note "Create tarball of snapshot..."
CWD=$PWD
-cd $SNAPDIR1 || log_fail "Could not cd $SNAPDIR1"
+log_must cd $SNAPDIR1
log_must tar cf $SNAPSHOT_TARDIR/snapshot.tar .
-cd $CWD || log_fail "Could not cd $CWD"
+log_must cd $CWD
-log_must mkdir $TESTDIR1/original
-log_must mkdir $TESTDIR1/snapshot
+log_must mkdir $TESTDIR1/original mkdir $TESTDIR1/snapshot
CWD=$PWD
-cd $TESTDIR1/original || log_fail "Could not cd $TESTDIR1/original"
+log_must cd $TESTDIR1/original
log_must tar xf $SNAPSHOT_TARDIR/original.tar
-cd $TESTDIR1/snapshot || log_fail "Could not cd $TESTDIR1/snapshot"
+log_must cd $TESTDIR1/snapshot
log_must tar xf $SNAPSHOT_TARDIR/snapshot.tar
-cd $CWD || log_fail "Could not cd $CWD"
+log_must cd $CWD
log_must directory_diff $TESTDIR1/original $TESTDIR1/snapshot
log_pass "Directory structures match."
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/snapshot/snapshot_007_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/snapshot/snapshot_007_pos.ksh
index 7ed1fdb6e7ad..bcca2a04a7c4 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/snapshot/snapshot_007_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/snapshot/snapshot_007_pos.ksh
@@ -49,24 +49,21 @@ function cleanup
{
typeset -i i=1
while [ $i -lt $COUNT ]; do
- snapexists $SNAPCTR.$i
- if [[ $? -eq 0 ]]; then
- log_must zfs destroy $SNAPCTR.$i
- fi
+ snapexists $SNAPCTR.$i && log_must zfs destroy $SNAPCTR.$i
- if [[ -e $SNAPDIR.$i ]]; then
- log_must rm -rf $SNAPDIR1.$i > /dev/null 2>&1
+ if [ -e $SNAPDIR.$i ]; then
+ log_must rm -rf $SNAPDIR1.$i
fi
(( i = i + 1 ))
done
- if [[ -e $SNAPDIR1 ]]; then
- log_must rm -rf $SNAPDIR1 > /dev/null 2>&1
+ if [ -e $SNAPDIR1 ]; then
+ log_must rm -rf $SNAPDIR1
fi
- if [[ -e $TESTDIR ]]; then
- log_must rm -rf $TESTDIR/* > /dev/null 2>&1
+ if [ -e $TESTDIR ]; then
+ log_must rm -rf $TESTDIR/*
fi
}
@@ -74,8 +71,7 @@ log_assert "Verify that many snapshots can be made on a zfs dataset."
log_onexit cleanup
-[[ -n $TESTDIR ]] && \
- log_must rm -rf $TESTDIR/* > /dev/null 2>&1
+[ -n $TESTDIR ] && log_must rm -rf $TESTDIR/*
typeset -i COUNT=10
@@ -90,12 +86,11 @@ while [[ $i -lt $COUNT ]]; do
done
log_note "Remove all of the original files"
-[[ -n $TESTDIR ]] && \
- log_must rm -rf $TESTDIR1/file* > /dev/null 2>&1
+[ -n $TESTDIR ] && log_must rm -f $TESTDIR1/file*
i=1
while [[ $i -lt $COUNT ]]; do
- FILECOUNT=`ls $SNAPDIR1.$i/file* | wc -l`
+ FILECOUNT=$(ls $SNAPDIR1.$i/file* 2>/dev/null | wc -l)
typeset j=1
while [ $j -lt $FILECOUNT ]; do
log_must file_check $SNAPDIR1.$i/file$j $j
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/snapshot/snapshot_008_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/snapshot/snapshot_008_pos.ksh
index d0ecb77fe0a0..560e846cee9d 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/snapshot/snapshot_008_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/snapshot/snapshot_008_pos.ksh
@@ -48,23 +48,20 @@ function cleanup
{
typeset -i i=1
while [[ $i -lt $COUNT ]]; do
- snapexists $SNAPFS.$i
- [[ $? -eq 0 ]] && \
+ snapexists $SNAPFS.$i &&
log_must zfs destroy $SNAPFS.$i
(( i = i + 1 ))
done
- [[ -e $TESTDIR ]] && \
- log_must rm -rf $TESTDIR/* > /dev/null 2>&1
+ [ -e $TESTDIR ] && log_must rm -rf $TESTDIR/*
}
log_assert "Verify that destroying snapshots returns space to the pool."
log_onexit cleanup
-[[ -n $TESTDIR ]] && \
- log_must rm -rf $TESTDIR/* > /dev/null 2>&1
+[ -n $TESTDIR ] && log_must rm -rf $TESTDIR/*
typeset -i COUNT=10
@@ -82,7 +79,7 @@ done
typeset -i i=1
while [[ $i -lt $COUNT ]]; do
- log_must rm -rf $TESTDIR/file$i > /dev/null 2>&1
+ log_must rm -f $TESTDIR/file$i
log_must zfs destroy $SNAPFS.$i
(( i = i + 1 ))
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/snapshot/snapshot_011_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/snapshot/snapshot_011_pos.ksh
index 7e0a7f4ce1d8..7fa7aec22d6f 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/snapshot/snapshot_011_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/snapshot/snapshot_011_pos.ksh
@@ -53,15 +53,13 @@ function cleanup
{
snapexists $SNAPPOOL && destroy_dataset $SNAPPOOL -r
- [[ -e $TESTDIR ]] && \
- log_must rm -rf $TESTDIR/* > /dev/null 2>&1
+ [ -e $TESTDIR ] && log_must rm -rf $TESTDIR/*
}
log_assert "Verify that rollback to a snapshot created by snapshot -r succeeds."
log_onexit cleanup
-[[ -n $TESTDIR ]] && \
- log_must rm -rf $TESTDIR/* > /dev/null 2>&1
+[ -n $TESTDIR ] && log_must rm -rf $TESTDIR/*
typeset -i COUNT=10
@@ -76,7 +74,7 @@ done
log_must zfs snapshot -r $SNAPPOOL
-FILE_COUNT=`ls -Al $SNAPDIR | grep -v "total" | wc -l`
+FILE_COUNT=$(ls -A $SNAPDIR | wc -l)
if (( FILE_COUNT != COUNT )); then
ls -Al $SNAPDIR
log_fail "AFTER: $SNAPFS contains $FILE_COUNT files(s)."
@@ -96,14 +94,13 @@ done
#
log_must zfs rollback $SNAPFS
-FILE_COUNT=`ls -Al $TESTDIR/after* 2> /dev/null | grep -v "total" | wc -l`
+FILE_COUNT=$(ls -A $TESTDIR/after* 2> /dev/null | wc -l)
if (( FILE_COUNT != 0 )); then
ls -Al $TESTDIR
log_fail "$TESTDIR contains $FILE_COUNT after* files(s)."
fi
-FILE_COUNT=`ls -Al $TESTDIR/before* 2> /dev/null \
- | grep -v "total" | wc -l`
+FILE_COUNT=$(ls -A $TESTDIR/before* 2> /dev/null | wc -l)
if (( FILE_COUNT != $COUNT )); then
ls -Al $TESTDIR
log_fail "$TESTDIR contains $FILE_COUNT before* files(s)."
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/snapshot/snapshot_013_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/snapshot/snapshot_013_pos.ksh
index e02f6eb30042..27408222c80e 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/snapshot/snapshot_013_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/snapshot/snapshot_013_pos.ksh
@@ -51,8 +51,7 @@ function cleanup
datasetexists $ctrfs && destroy_dataset $ctrfs -r
snapexists $snappool && destroy_dataset $snappool -r
- [[ -e $TESTDIR ]] && \
- log_must rm -rf $TESTDIR/* > /dev/null 2>&1
+ [ -e $TESTDIR ] && log_must rm -rf $TESTDIR/*
}
log_assert "Verify snapshots from 'snapshot -r' can be used for zfs send/recv"
@@ -67,8 +66,7 @@ snapctrfs=$ctrfs@$TESTSNAP
fsdir=/$ctrfs
snapdir=$fsdir/.zfs/snapshot/$TESTSNAP
-[[ -n $TESTDIR ]] && \
- log_must rm -rf $TESTDIR/* > /dev/null 2>&1
+[ -n $TESTDIR ] && log_must rm -rf $TESTDIR/*
typeset -i COUNT=10
@@ -89,7 +87,7 @@ if ! datasetexists $ctrfs || ! snapexists $snapctrfs; then
fi
for dir in $fsdir $snapdir; do
- FILE_COUNT=`ls -Al $dir | grep -v "total" | wc -l`
+ FILE_COUNT=$(ls -A $dir | wc -l)
(( FILE_COUNT != COUNT )) && log_fail "Got $FILE_COUNT expected $COUNT"
done
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/snapshot/snapshot_014_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/snapshot/snapshot_014_pos.ksh
index 384377c7f64b..55188960b7e3 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/snapshot/snapshot_014_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/snapshot/snapshot_014_pos.ksh
@@ -48,8 +48,7 @@ verify_runnable "both"
function cleanup
{
- [[ -e $TESTDIR1 ]] && \
- log_must rm -rf $TESTDIR1/* > /dev/null 2>&1
+ [ -e $TESTDIR1 ] && log_must rm -rf $TESTDIR1/*
snapexists $SNAPCTR && destroy_dataset $SNAPCTR
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/snapused/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/snapused/Makefile.am
deleted file mode 100644
index d6551b7c41b1..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/snapused/Makefile.am
+++ /dev/null
@@ -1,12 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/snapused
-dist_pkgdata_SCRIPTS = \
- setup.ksh \
- cleanup.ksh \
- snapused_001_pos.ksh \
- snapused_002_pos.ksh \
- snapused_003_pos.ksh \
- snapused_004_pos.ksh \
- snapused_005_pos.ksh
-
-dist_pkgdata_DATA = \
- snapused.kshlib
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/sparse/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/sparse/Makefile.am
deleted file mode 100644
index f1b9e04dcefe..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/sparse/Makefile.am
+++ /dev/null
@@ -1,8 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/sparse
-dist_pkgdata_SCRIPTS = \
- setup.ksh \
- cleanup.ksh \
- sparse_001_pos.ksh
-
-dist_pkgdata_DATA = \
- sparse.cfg
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/sparse/sparse.cfg b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/sparse/sparse.cfg
index 0fc669148aa1..b7e403bce5f1 100644
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/sparse/sparse.cfg
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/sparse/sparse.cfg
@@ -39,5 +39,5 @@ export HOLES_COUNT=${HOLES_COUNT-"16384"} # FILESIZE/BLKSIZE/8
export STF_TIMEOUT=3600
export DISKSARRAY=$DISKS
-export DISK_ARRAY_NUM=$(echo ${DISKS} | nawk '{print NF}')
+export DISK_ARRAY_NUM=$(echo ${DISKS} | awk '{print NF}')
set_device_dir
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/stat/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/stat/Makefile.am
deleted file mode 100644
index 1a861a655cb1..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/stat/Makefile.am
+++ /dev/null
@@ -1,8 +0,0 @@
-include $(top_srcdir)/config/Rules.am
-
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/stat
-
-dist_pkgdata_SCRIPTS = \
- cleanup.ksh \
- setup.ksh \
- stat_001_pos.ksh
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/suid/.gitignore b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/suid/.gitignore
deleted file mode 100644
index a9a3db79ba44..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/suid/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/suid_write_to_file
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/suid/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/suid/Makefile.am
deleted file mode 100644
index 0145c1205fb3..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/suid/Makefile.am
+++ /dev/null
@@ -1,17 +0,0 @@
-include $(top_srcdir)/config/Rules.am
-
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/suid
-
-dist_pkgdata_SCRIPTS = \
- suid_write_to_suid.ksh \
- suid_write_to_sgid.ksh \
- suid_write_to_suid_sgid.ksh \
- suid_write_to_none.ksh \
- suid_write_zil_replay.ksh \
- cleanup.ksh \
- setup.ksh
-
-pkgexecdir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/suid
-
-pkgexec_PROGRAMS = suid_write_to_file
-suid_write_to_file_SOURCES = suid_write_to_file.c
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/suid/suid_write_to_file.c b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/suid/suid_write_to_file.c
deleted file mode 100644
index f3febb903b59..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/suid/suid_write_to_file.c
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- * 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) 2019 by Tomohiro Kusumi. All rights reserved.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <stdbool.h>
-
-int
-main(int argc, char *argv[])
-{
- const char *name, *phase;
- mode_t extra;
- struct stat st;
-
- if (argc < 3) {
- fprintf(stderr, "Invalid argc\n");
- exit(1);
- }
-
- name = argv[1];
- if (strcmp(name, "SUID") == 0) {
- extra = S_ISUID;
- } else if (strcmp(name, "SGID") == 0) {
- extra = S_ISGID;
- } else if (strcmp(name, "SUID_SGID") == 0) {
- extra = S_ISUID | S_ISGID;
- } else if (strcmp(name, "NONE") == 0) {
- extra = 0;
- } else {
- fprintf(stderr, "Invalid name %s\n", name);
- exit(1);
- }
-
- const char *testdir = getenv("TESTDIR");
- if (!testdir) {
- fprintf(stderr, "getenv(TESTDIR)\n");
- exit(1);
- }
-
- umask(0);
- if (stat(testdir, &st) == -1 && mkdir(testdir, 0777) == -1) {
- perror("mkdir");
- exit(2);
- }
-
- char fpath[1024];
- snprintf(fpath, sizeof (fpath), "%s/%s", testdir, name);
-
-
- phase = argv[2];
- if (strcmp(phase, "PRECRASH") == 0) {
-
- /* clean up last run */
- unlink(fpath);
- if (stat(fpath, &st) == 0) {
- fprintf(stderr, "%s exists\n", fpath);
- exit(3);
- }
-
- int fd;
-
- fd = creat(fpath, 0777 | extra);
- if (fd == -1) {
- perror("creat");
- exit(4);
- }
- close(fd);
-
- if (setuid(65534) == -1) {
- perror("setuid");
- exit(5);
- }
-
- fd = open(fpath, O_RDWR);
- if (fd == -1) {
- perror("open");
- exit(6);
- }
-
- const char buf[] = "test";
- if (write(fd, buf, sizeof (buf)) == -1) {
- perror("write");
- exit(7);
- }
- close(fd);
-
- } else if (strcmp(phase, "REPLAY") == 0) {
- /* created in PRECRASH run */
- } else {
- fprintf(stderr, "Invalid phase %s\n", phase);
- exit(1);
- }
-
- if (stat(fpath, &st) == -1) {
- perror("stat");
- exit(8);
- }
-
- /* Verify SUID/SGID are dropped */
- mode_t res = st.st_mode & (0777 | S_ISUID | S_ISGID);
- if (res != 0777) {
- fprintf(stderr, "stat(2) %o\n", res);
- exit(9);
- }
-
- return (0);
-}
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/suid/suid_write_to_none.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/suid/suid_write_to_none.ksh
index 470350f960cf..907c94e3fd9c 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/suid/suid_write_to_none.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/suid/suid_write_to_none.ksh
@@ -47,6 +47,6 @@ function cleanup
log_onexit cleanup
log_note "Verify write(2) to regular file by non-owner"
-log_must $STF_SUITE/tests/functional/suid/suid_write_to_file "NONE" "PRECRASH"
+log_must suid_write_to_file "NONE" "PRECRASH"
log_pass "Verify write(2) to regular file by non-owner passed"
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/suid/suid_write_to_sgid.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/suid/suid_write_to_sgid.ksh
index 3c95a402658e..4554bc3c00a4 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/suid/suid_write_to_sgid.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/suid/suid_write_to_sgid.ksh
@@ -47,6 +47,6 @@ function cleanup
log_onexit cleanup
log_note "Verify write(2) to SGID file by non-owner"
-log_must $STF_SUITE/tests/functional/suid/suid_write_to_file "SGID" "PRECRASH"
+log_must suid_write_to_file "SGID" "PRECRASH"
log_pass "Verify write(2) to SGID file by non-owner passed"
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/suid/suid_write_to_suid.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/suid/suid_write_to_suid.ksh
index 4183cbeefc20..541e1125d539 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/suid/suid_write_to_suid.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/suid/suid_write_to_suid.ksh
@@ -47,6 +47,6 @@ function cleanup
log_onexit cleanup
log_note "Verify write(2) to SUID file by non-owner"
-log_must $STF_SUITE/tests/functional/suid/suid_write_to_file "SUID" "PRECRASH"
+log_must suid_write_to_file "SUID" "PRECRASH"
log_pass "Verify write(2) to SUID file by non-owner passed"
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/suid/suid_write_to_suid_sgid.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/suid/suid_write_to_suid_sgid.ksh
index f7a08a55fc4b..57361d2e39a9 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/suid/suid_write_to_suid_sgid.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/suid/suid_write_to_suid_sgid.ksh
@@ -47,6 +47,6 @@ function cleanup
log_onexit cleanup
log_note "Verify write(2) to SUID/SGID file by non-owner"
-log_must $STF_SUITE/tests/functional/suid/suid_write_to_file "SUID_SGID" "PRECRASH"
+log_must suid_write_to_file "SUID_SGID" "PRECRASH"
log_pass "Verify write(2) to SUID/SGID file by non-owner passed"
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/suid/suid_write_zil_replay.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/suid/suid_write_zil_replay.ksh
index 81f431f6b68b..8843e67da24b 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/suid/suid_write_zil_replay.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/suid/suid_write_zil_replay.ksh
@@ -65,10 +65,10 @@ log_must zpool freeze $TESTPOOL
#
# 3. Unprivileged write to a setuid file
#
-log_must $STF_SUITE/tests/functional/suid/suid_write_to_file "NONE" "PRECRASH"
-log_must $STF_SUITE/tests/functional/suid/suid_write_to_file "SUID" "PRECRASH"
-log_must $STF_SUITE/tests/functional/suid/suid_write_to_file "SGID" "PRECRASH"
-log_must $STF_SUITE/tests/functional/suid/suid_write_to_file "SUID_SGID" "PRECRASH"
+log_must suid_write_to_file "NONE" "PRECRASH"
+log_must suid_write_to_file "SUID" "PRECRASH"
+log_must suid_write_to_file "SGID" "PRECRASH"
+log_must suid_write_to_file "SUID_SGID" "PRECRASH"
#
# 4. Unmount filesystem and export the pool
@@ -91,9 +91,9 @@ log_must zpool export $TESTPOOL
#
log_must zpool import -f -d $VDIR $TESTPOOL
-log_must $STF_SUITE/tests/functional/suid/suid_write_to_file "NONE" "REPLAY"
-log_must $STF_SUITE/tests/functional/suid/suid_write_to_file "SUID" "REPLAY"
-log_must $STF_SUITE/tests/functional/suid/suid_write_to_file "SGID" "REPLAY"
-log_must $STF_SUITE/tests/functional/suid/suid_write_to_file "SUID_SGID" "REPLAY"
+log_must suid_write_to_file "NONE" "REPLAY"
+log_must suid_write_to_file "SUID" "REPLAY"
+log_must suid_write_to_file "SGID" "REPLAY"
+log_must suid_write_to_file "SUID_SGID" "REPLAY"
log_pass
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/threadsappend/.gitignore b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/threadsappend/.gitignore
deleted file mode 100644
index 4c8c8cdf34c1..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/threadsappend/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/threadsappend
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/threadsappend/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/threadsappend/Makefile.am
deleted file mode 100644
index 80f7788c8d86..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/threadsappend/Makefile.am
+++ /dev/null
@@ -1,8 +0,0 @@
-include $(top_srcdir)/config/Rules.am
-
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/threadsappend
-
-dist_pkgdata_SCRIPTS = \
- cleanup.ksh \
- setup.ksh \
- threadsappend_001_pos.ksh
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/tmpfile/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/tmpfile/Makefile.am
deleted file mode 100644
index 35a1f44c1693..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/tmpfile/Makefile.am
+++ /dev/null
@@ -1,16 +0,0 @@
-include $(top_srcdir)/config/Rules.am
-
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/tmpfile
-
-dist_pkgdata_SCRIPTS = \
- cleanup.ksh \
- setup.ksh
-
-pkgexecdir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/tmpfile
-
-pkgexec_PROGRAMS = tmpfile_test tmpfile_001_pos tmpfile_002_pos \
- tmpfile_003_pos tmpfile_stat_mode
-tmpfile_test_SOURCES= tmpfile_test.c
-tmpfile_001_pos_SOURCES = tmpfile_001_pos.c
-tmpfile_002_pos_SOURCES = tmpfile_002_pos.c
-tmpfile_003_pos_SOURCES = tmpfile_003_pos.c
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/trim/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/trim/Makefile.am
deleted file mode 100644
index 8917ed726e90..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/trim/Makefile.am
+++ /dev/null
@@ -1,12 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/trim
-dist_pkgdata_SCRIPTS = \
- setup.ksh \
- cleanup.ksh \
- trim.kshlib \
- trim.cfg \
- autotrim_integrity.ksh \
- autotrim_config.ksh \
- autotrim_trim_integrity.ksh \
- trim_integrity.ksh \
- trim_config.ksh \
- trim_l2arc.ksh
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/trim/trim.kshlib b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/trim/trim.kshlib
index dc1a60a5ee9d..f36f3870fc4e 100644
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/trim/trim.kshlib
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/trim/trim.kshlib
@@ -22,8 +22,7 @@
#
function get_size_mb
{
- typeset rval=$(du --block-size 1048576 -s "$1" | awk '{print $1}')
- echo -n "$rval"
+ du --block-size 1048576 -s "$1" | cut -f1
}
#
@@ -39,14 +38,12 @@ function get_trim_io
# Sum the ind or agg columns of the trim request size histogram.
case "$type" in
"ind")
- rval=$(zpool iostat -pr $pool $vdev | awk \
- '$1 ~ /[0-9].*/ { sum += $12 } END { print sum }')
- echo -n "$rval"
+ zpool iostat -pr $pool $vdev |
+ awk '$1 ~ /[0-9].*/ { sum += $12 } END { print sum }'
;;
"agg")
- rval=$(zpool iostat -pr $pool $vdev | awk \
- '$1 ~ /[0-9].*/ { sum += $13 } END { print sum }')
- echo -n "$rval"
+ zpool iostat -pr $pool $vdev |
+ awk '$1 ~ /[0-9].*/ { sum += $13 } END { print sum }'
;;
*)
log_fail "Type must be 'ind' or 'agg'"
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/trim/trim_l2arc.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/trim/trim_l2arc.ksh
index ecf9f3424eb5..0bbd08acdd3f 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/trim/trim_l2arc.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/trim/trim_l2arc.ksh
@@ -36,6 +36,8 @@
verify_runnable "global"
+command -v fio > /dev/null || log_unsupported "fio missing"
+
log_assert "Trim of L2ARC succeeds."
function cleanup
@@ -95,8 +97,8 @@ done
verify_trim_io $TESTPOOL "ind" 5 $TRIM_VDEV2
-typeset cache_size=$(zpool list -vp | grep $TRIM_VDEV2 | awk '{print $2}')
-typeset cache_alloc=$(zpool list -vp | grep $TRIM_VDEV2 | awk '{print $3}')
+typeset cache_size cache_alloc _
+read -r _ cache_size cache_alloc _ < <(zpool list -vp | grep $TRIM_VDEV2)
log_must test $cache_alloc -lt $cache_size
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/truncate/.gitignore b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/truncate/.gitignore
deleted file mode 100644
index f28d93573c51..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/truncate/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/truncate_test
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/truncate/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/truncate/Makefile.am
deleted file mode 100644
index b2d804b5d4c2..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/truncate/Makefile.am
+++ /dev/null
@@ -1,18 +0,0 @@
-include $(top_srcdir)/config/Rules.am
-
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/truncate
-
-dist_pkgdata_SCRIPTS = \
- setup.ksh \
- cleanup.ksh \
- truncate_001_pos.ksh \
- truncate_002_pos.ksh \
- truncate_timestamps.ksh
-
-dist_pkgdata_DATA = \
- truncate.cfg
-
-pkgexecdir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/truncate
-
-pkgexec_PROGRAMS = truncate_test
-truncate_test_SOURCES = truncate_test.c
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/truncate/truncate.cfg b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/truncate/truncate.cfg
index 13cdafab133b..d852ee63abb5 100644
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/truncate/truncate.cfg
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/truncate/truncate.cfg
@@ -34,6 +34,6 @@ export TRUNC_FILEOFFSET=${TRUNC_FILEOFFSET-""}
export TRUNC_COUNT=${TRUNC_COUNT-"16384"} # FILESIZE/BLKSIZE/8
export DISKSARRAY=$DISKS
-export DISK_ARRAY_NUM=$(echo ${DISKS} | nawk '{print NF}')
+export DISK_ARRAY_NUM=$(echo ${DISKS} | awk '{print NF}')
set_device_dir
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/truncate/truncate_test.c b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/truncate/truncate_test.c
deleted file mode 100644
index 3e277e8657b5..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/truncate/truncate_test.c
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * This file and its contents are supplied under the terms of the
- * Common Development and Distribution License ("CDDL"), version 1.0.
- * You may only use this file in accordance with the terms of version
- * 1.0 of the CDDL.
- *
- * A full copy of the text of the CDDL should have accompanied this
- * source. A copy of the CDDL is also available via the Internet at
- * http://www.illumos.org/license/CDDL.
- */
-
-/*
- * Copyright (c) 2012, 2014 by Delphix. All rights reserved.
- * Copyright 2017, loli10K <ezomori.nozomu@gmail.com>. All rights reserved.
- */
-
-#include <fcntl.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <unistd.h>
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-#define FSIZE 256*1024*1024
-
-static long fsize = FSIZE;
-static int errflag = 0;
-static char *filename = NULL;
-static int ftruncflag = 0;
-
-static void parse_options(int argc, char *argv[]);
-
-static void
-usage(char *execname)
-{
- (void) fprintf(stderr,
- "usage: %s [-s filesize] [-f] /path/to/file\n", execname);
- (void) exit(1);
-}
-
-int
-main(int argc, char *argv[])
-{
- int fd;
-
- parse_options(argc, argv);
-
- if (ftruncflag) {
- fd = open(filename, O_RDWR|O_CREAT, 0666);
- if (fd < 0) {
- perror("open");
- return (1);
- }
- if (ftruncate(fd, fsize) < 0) {
- perror("ftruncate");
- return (1);
- }
- if (close(fd)) {
- perror("close");
- return (1);
- }
- } else {
- if (truncate(filename, fsize) < 0) {
- perror("truncate");
- return (1);
- }
- }
- return (0);
-}
-
-static void
-parse_options(int argc, char *argv[])
-{
- int c;
- extern char *optarg;
- extern int optind, optopt;
-
- while ((c = getopt(argc, argv, "s:f")) != -1) {
- switch (c) {
- case 's':
- fsize = atoi(optarg);
- break;
- case 'f':
- ftruncflag++;
- break;
- case ':':
- (void) fprintf(stderr,
- "Option -%c requires an operand\n", optopt);
- errflag++;
- break;
- }
- if (errflag) {
- (void) usage(argv[0]);
- }
- }
-
- if (argc <= optind) {
- (void) fprintf(stderr, "No filename specified\n");
- usage(argv[0]);
- }
- filename = argv[optind];
-}
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/truncate/truncate_timestamps.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/truncate/truncate_timestamps.ksh
index 27b28e82eb5b..3793178701d8 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/truncate/truncate_timestamps.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/truncate/truncate_timestamps.ksh
@@ -42,7 +42,7 @@ function verify_truncate # <filename> <filesize> <option>
typeset -i timestm="$(stat -f "%m" $filename)"
typeset -i timestc="$(stat -f "%c" $filename)"
log_must sleep 1
- log_must $STF_SUITE/tests/functional/truncate/truncate_test -s $size $filename $option
+ log_must truncate_test -s $size $filename $option
verify_eq $size "$(stat_size $filename)" "size"
verify_ne $timestm "$(stat -f "%m" $filename)" "mtime"
verify_ne $timestc "$(stat -f "%c" $filename)" "ctime"
@@ -50,7 +50,7 @@ function verify_truncate # <filename> <filesize> <option>
typeset -i timestm="$(stat -c %Y $filename)"
typeset -i timestc="$(stat -c %Z $filename)"
log_must sleep 1
- log_must $STF_SUITE/tests/functional/truncate/truncate_test -s $size $filename $option
+ log_must truncate_test -s $size $filename $option
verify_eq $size "$(stat_size $filename)" "size"
verify_ne $timestm "$(stat -c %Y $filename)" "mtime"
verify_ne $timestc "$(stat -c %Z $filename)" "ctime"
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/upgrade/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/upgrade/Makefile.am
deleted file mode 100644
index 743baa484522..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/upgrade/Makefile.am
+++ /dev/null
@@ -1,10 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/upgrade
-dist_pkgdata_SCRIPTS = \
- setup.ksh \
- cleanup.ksh \
- upgrade_userobj_001_pos.ksh \
- upgrade_projectquota_001_pos.ksh \
- upgrade_readonly_pool.ksh
-
-dist_pkgdata_DATA = \
- upgrade_common.kshlib
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/upgrade/upgrade_projectquota_001_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/upgrade/upgrade_projectquota_001_pos.ksh
index 364f67e34584..88d09759bfee 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/upgrade/upgrade_projectquota_001_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/upgrade/upgrade_projectquota_001_pos.ksh
@@ -109,7 +109,7 @@ log_must chattr -p 100 $TESTDIR/fs3/dir
log_must sleep 5 # upgrade done in the background so let's wait for a while
zfs projectspace -o used $TESTPOOL/fs3 | grep -q "USED" ||
log_fail "project quota should be enabled for $TESTPOOL/fs3"
-cnt=$(zfs get -H projectobjused@100 $TESTPOOL/fs3 | awk '{print $3}')
+cnt=$(get_prop projectobjused@100 $TESTPOOL/fs3)
# if 'xattr=on', then 'cnt = 2'
[[ $cnt -ne 1 ]] && [[ $cnt -ne 2 ]] &&
log_fail "projectquota accounting failed $cnt"
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/user_namespace/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/user_namespace/Makefile.am
deleted file mode 100644
index 5f95dbf8d967..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/user_namespace/Makefile.am
+++ /dev/null
@@ -1,9 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/user_namespace
-dist_pkgdata_SCRIPTS = \
- setup.ksh \
- cleanup.ksh \
- user_namespace_001.ksh
-
-dist_pkgdata_DATA = \
- user_namespace_common.kshlib \
- user_namespace.cfg
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/user_namespace/user_namespace_001.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/user_namespace/user_namespace_001.ksh
index 6be30ab4d204..3d19c4273e24 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/user_namespace/user_namespace_001.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/user_namespace/user_namespace_001.ksh
@@ -51,8 +51,8 @@ log_onexit cleanup
log_assert "Check root in user namespaces"
-TOUCH=$(readlink -e $(which touch))
-CHMOD=$(readlink -e $(which chmod))
+TOUCH=$(readlink -f $(command -v touch))
+CHMOD=$(readlink -f $(command -v chmod))
for i in ${files[*]}; do
log_must $TOUCH $TESTDIR/$i
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/userquota/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/userquota/Makefile.am
deleted file mode 100644
index 2c94d3e1521c..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/userquota/Makefile.am
+++ /dev/null
@@ -1,29 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/userquota
-dist_pkgdata_SCRIPTS = \
- setup.ksh \
- cleanup.ksh \
- groupspace_001_pos.ksh \
- groupspace_002_pos.ksh \
- groupspace_003_pos.ksh \
- userquota_001_pos.ksh \
- userquota_002_pos.ksh \
- userquota_003_pos.ksh \
- userquota_004_pos.ksh \
- userquota_005_neg.ksh \
- userquota_006_pos.ksh \
- userquota_007_pos.ksh \
- userquota_008_pos.ksh \
- userquota_009_pos.ksh \
- userquota_010_pos.ksh \
- userquota_011_pos.ksh \
- userquota_012_neg.ksh \
- userquota_013_pos.ksh \
- userspace_001_pos.ksh \
- userspace_002_pos.ksh \
- userspace_003_pos.ksh \
- userspace_encrypted.ksh \
- userspace_send_encrypted.ksh
-
-dist_pkgdata_DATA = \
- userquota.cfg \
- userquota_common.kshlib
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/userquota/setup.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/userquota/setup.ksh
index 2c609c9eb5e2..29cbbeb660d0 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/userquota/setup.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/userquota/setup.ksh
@@ -47,10 +47,8 @@ log_must add_user $QGROUP $QUSER2
#
# chmod 0750 $HOME
#
-user_run $QUSER1 zfs list
-if [ $? -ne 0 ]; then
+user_run $QUSER1 zfs list ||
log_unsupported "Test user $QUSER1 cannot execute zfs utilities"
-fi
DISK=${DISKS%% *}
default_setup_noexit $DISK
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/userquota/userquota_004_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/userquota/userquota_004_pos.ksh
index ae748e2c63d4..896645f7ca0d 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/userquota/userquota_004_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/userquota/userquota_004_pos.ksh
@@ -51,8 +51,8 @@ log_onexit cleanup
log_assert "Check the basic function of {user|group} used"
sync_pool
-typeset user_used=$(get_value "userused@$QUSER1" $QFS)
-typeset group_used=$(get_value "groupused@$QGROUP" $QFS)
+typeset user_used=$(get_prop "userused@$QUSER1" $QFS)
+typeset group_used=$(get_prop "groupused@$QGROUP" $QFS)
typeset file_size='100m'
if [[ $user_used != 0 ]]; then
@@ -66,10 +66,10 @@ mkmount_writable $QFS
log_must user_run $QUSER1 mkfile $file_size $QFILE
sync_pool
-user_used=$(get_value "userused@$QUSER1" $QFS)
-group_used=$(get_value "groupused@$QGROUP" $QFS)
+user_used=$(get_prop "userused@$QUSER1" $QFS)
+group_used=$(get_prop "groupused@$QGROUP" $QFS)
-# get_value() reads the exact byte value which is slightly more than 100m
+# get_prop() reads the exact byte value which is slightly more than 100m
if [[ "$(($user_used/1024/1024))m" != "$file_size" ]]; then
log_note "user $QUSER1 used is $user_used"
log_fail "userused for user $QUSER1 expected to be $file_size, " \
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/userquota/userquota_common.kshlib b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/userquota/userquota_common.kshlib
index cee3c6fb3269..40f9184c5254 100644
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/userquota/userquota_common.kshlib
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/userquota/userquota_common.kshlib
@@ -101,23 +101,3 @@ function check_quota
return 1
fi
}
-
-#
-# zfs get prop, which return raw value not -p value.
-#
-function get_value # property dataset
-{
- typeset prop_val
- typeset prop=$1
- typeset dataset=$2
-
- prop_val=$(zfs get -H -p -o value $prop $dataset 2>/dev/null)
- if [[ $? -ne 0 ]]; then
- log_note "Unable to get $prop property for dataset " \
- "$dataset"
- return 1
- fi
-
- echo $prop_val
- return 0
-}
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/userquota/userspace_encrypted.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/userquota/userspace_encrypted.ksh
index 429b16e04e44..e55902237897 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/userquota/userspace_encrypted.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/userquota/userspace_encrypted.ksh
@@ -36,8 +36,7 @@ function cleanup
function log_must_unsupported
{
- log_must_retry "unsupported" 3 "$@"
- (( $? != 0 )) && log_fail
+ log_must_retry "unsupported" 3 "$@" || log_fail
}
log_onexit cleanup
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/vdev_zaps/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/vdev_zaps/Makefile.am
deleted file mode 100644
index 4efb1bcf233a..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/vdev_zaps/Makefile.am
+++ /dev/null
@@ -1,14 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/vdev_zaps
-dist_pkgdata_SCRIPTS = \
- setup.ksh \
- cleanup.ksh \
- vdev_zaps_001_pos.ksh \
- vdev_zaps_002_pos.ksh \
- vdev_zaps_003_pos.ksh \
- vdev_zaps_004_pos.ksh \
- vdev_zaps_005_pos.ksh \
- vdev_zaps_006_pos.ksh \
- vdev_zaps_007_pos.ksh
-
-dist_pkgdata_DATA = \
- vdev_zaps.kshlib
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/vdev_zaps/vdev_zaps.kshlib b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/vdev_zaps/vdev_zaps.kshlib
index aae2ab40ce58..ad5bd9e7f81b 100644
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/vdev_zaps/vdev_zaps.kshlib
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/vdev_zaps/vdev_zaps.kshlib
@@ -19,45 +19,25 @@
function get_conf_section # regex conf
{
- typeset dsk_line next_vd_line conf section
typeset regex="$1"
typeset conf="$2"
- dsk_line=$(grep -n "$regex" "$conf" | awk -F: '{print $1}')
- if [[ -z "$dsk_line" ]]; then
- return
- fi
- next_vd_line=$(tail -n +$dsk_line "$conf" | \
- grep -n "children\[" | awk -F: '{print $1}' | head -n 1)
-
- if [[ -n "$next_vd_line" ]]; then
- section=$(cat "$conf" | sed "1,${dsk_line}d" | head -n \
- $(($next_vd_line - 2)))
-
- else
- section=$(tail -n +$dsk_line "$conf")
- fi
- echo "$section"
+ awk -v r="$1" '$0 ~ r, 0 {if($0 ~ r) next; if(/children\[/) exit; print}' "$conf"
}
function get_leaf_vd_zap # dsk conf
{
- typeset section=$(get_conf_section "$1" "$2")
- echo "$section" | egrep \
- "com.delphix:vdev_zap_leaf: [0-9]+" | awk '{print $2}'
+ get_conf_section "$1" "$2" | awk '/com.delphix:vdev_zap_leaf: [0-9]+/ {print $2}'
}
function get_top_vd_zap # dsk conf
{
- typeset section=$(get_conf_section "$1" "$2")
- echo "$section" | egrep \
- "com.delphix:vdev_zap_top: [0-9]+" | awk '{print $2}'
+ get_conf_section "$1" "$2" | awk '/com.delphix:vdev_zap_top: [0-9]+/ {print $2}'
}
function assert_has_sentinel # conf
{
- res=$(grep "com.delphix:has_per_vdev_zaps" "$1")
- [[ -z "$res" ]] && log_fail "Pool missing ZAP feature sentinel value"
+ log_must grep -q "com.delphix:has_per_vdev_zaps" "$1"
}
function assert_zap_common # pool vd lvl zapobj
@@ -67,9 +47,9 @@ function assert_zap_common # pool vd lvl zapobj
typeset lvl=$3
typeset zapobj=$4
- if [[ -z "$zapobj" ]]; then
+ if [ -z "$zapobj" ]; then
log_fail "$vd on $pool has no $lvl ZAP in config"
- elif [[ -z "$(zdb -d $pool $zapobj | grep 'zap')" ]]; then
+ elif ! zdb -d $pool $zapobj | grep -q 'zap'; then
log_fail "$vd on $pool has no $lvl ZAP in MOS"
fi
}
@@ -100,15 +80,9 @@ function assert_leaf_zap # pool vd conf
function cleanup
{
- if datasetexists $TESTPOOL ; then
- log_must zpool destroy -f $TESTPOOL
- fi
- if [[ -e $conf ]]; then
- log_must rm -f "$conf"
- fi
- if [[ -e $POOL2 ]]; then
- log_must zpool destroy -f $POOL2
- fi
+ datasetexists $TESTPOOL && log_must zpool destroy -f $TESTPOOL
+ [ -e $conf ] && log_must rm -f "$conf"
+ poolexists $POOL2 && log_must zpool destroy -f $POOL2
}
log_onexit cleanup
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/vdev_zaps/vdev_zaps_001_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/vdev_zaps/vdev_zaps_001_pos.ksh
index fe7dff6570a1..b67cc6d973e6 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/vdev_zaps/vdev_zaps_001_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/vdev_zaps/vdev_zaps_001_pos.ksh
@@ -33,7 +33,7 @@ DISK=${DISKS%% *}
log_must zpool create -f $TESTPOOL $DISK
conf="$TESTDIR/vz001"
-log_must zdb -PC $TESTPOOL > $conf
+log_must eval "zdb -PC $TESTPOOL > $conf"
assert_top_zap $TESTPOOL $DISK "$conf"
assert_leaf_zap $TESTPOOL $DISK "$conf"
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/vdev_zaps/vdev_zaps_002_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/vdev_zaps/vdev_zaps_002_pos.ksh
index 01d04ab156db..c571973b080b 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/vdev_zaps/vdev_zaps_002_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/vdev_zaps/vdev_zaps_002_pos.ksh
@@ -33,7 +33,7 @@ log_assert "Per-vdev ZAPs are created on pool creation with many disks."
log_must zpool create -f $TESTPOOL $DISKS
conf="$TESTDIR/vz002"
-log_must zdb -PC $TESTPOOL > $conf
+log_must eval "zdb -PC $TESTPOOL > $conf"
assert_has_sentinel "$conf"
for DISK in $DISKS; do
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/vdev_zaps/vdev_zaps_003_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/vdev_zaps/vdev_zaps_003_pos.ksh
index b6d9ffbda15c..015729576a7d 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/vdev_zaps/vdev_zaps_003_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/vdev_zaps/vdev_zaps_003_pos.ksh
@@ -34,7 +34,7 @@ log_assert "Per-vdev ZAPs are created on pool creation with multi-level vdev "\
log_must zpool create -f $TESTPOOL mirror $DISKS
conf="$TESTDIR/vz003"
-log_must zdb -PC $TESTPOOL > $conf
+log_must eval "zdb -PC $TESTPOOL > $conf"
assert_has_sentinel "$conf"
assert_top_zap $TESTPOOL "type: 'mirror'" "$conf"
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/vdev_zaps/vdev_zaps_004_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/vdev_zaps/vdev_zaps_004_pos.ksh
index b7468e4c331b..3d0f55d5a9a7 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/vdev_zaps/vdev_zaps_004_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/vdev_zaps/vdev_zaps_004_pos.ksh
@@ -38,7 +38,7 @@ log_must zpool create -f $TESTPOOL $DISK
# Make the pool.
conf="$TESTDIR/vz004"
-log_must zdb -PC $TESTPOOL > $conf
+log_must eval "zdb -PC $TESTPOOL > $conf"
assert_has_sentinel "$conf"
orig_top=$(get_top_vd_zap $DISK $conf)
orig_leaf=$(get_leaf_vd_zap $DISK $conf)
@@ -48,10 +48,10 @@ assert_zap_common $TESTPOOL $DISK "top" $orig_top
# Attach a disk.
#
-disk2=$(echo $DISKS | awk '{print $2}')
+read -r _ disk2 _ <<<"$DISKS"
log_must zpool attach $TESTPOOL $DISK $disk2
log_must zpool wait -t resilver $TESTPOOL
-log_must zdb -PC $TESTPOOL > $conf
+log_must eval "zdb -PC $TESTPOOL > $conf"
# Ensure top-level ZAP was transferred successfully.
new_top=$(get_top_vd_zap "type: 'mirror'" $conf)
@@ -80,7 +80,7 @@ dsk2_leaf=$(get_leaf_vd_zap $disk2 $conf)
#
log_must zpool detach $TESTPOOL $DISK
-log_must zdb -PC $TESTPOOL > $conf
+log_must eval "zdb -PC $TESTPOOL > $conf"
final_top=$(get_top_vd_zap $disk2 $conf)
final_leaf=$(get_leaf_vd_zap $disk2 $conf)
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/vdev_zaps/vdev_zaps_005_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/vdev_zaps/vdev_zaps_005_pos.ksh
index 7a40d8f0c565..1d82218bf283 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/vdev_zaps/vdev_zaps_005_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/vdev_zaps/vdev_zaps_005_pos.ksh
@@ -35,7 +35,7 @@ log_must zpool create -f $TESTPOOL $DISK
# Make the pool.
conf="$TESTDIR/vz005"
-log_must zdb -PC $TESTPOOL > $conf
+log_must eval "zdb -PC $TESTPOOL > $conf"
assert_has_sentinel "$conf"
orig_top=$(get_top_vd_zap $DISK $conf)
orig_leaf=$(get_leaf_vd_zap $DISK $conf)
@@ -50,7 +50,7 @@ log_must zpool export $TESTPOOL
log_must zpool import $TESTPOOL
# Verify that ZAPs persisted.
-log_must zdb -PC $TESTPOOL > $conf
+log_must eval "zdb -PC $TESTPOOL > $conf"
new_top=$(get_top_vd_zap $DISK $conf)
new_leaf=$(get_leaf_vd_zap $DISK $conf)
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/vdev_zaps/vdev_zaps_006_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/vdev_zaps/vdev_zaps_006_pos.ksh
index 0476bcda91ff..ce94336c7c5d 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/vdev_zaps/vdev_zaps_006_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/vdev_zaps/vdev_zaps_006_pos.ksh
@@ -36,7 +36,7 @@ log_assert "Per-vdev ZAPs are created for added vdevs."
log_must zpool add -f $TESTPOOL ${DISK_ARR[1]}
conf="$TESTDIR/vz006"
-log_must zdb -PC $TESTPOOL > $conf
+log_must eval "zdb -PC $TESTPOOL > $conf"
assert_has_sentinel "$conf"
orig_top=$(get_top_vd_zap ${DISK_ARR[1]} $conf)
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/vdev_zaps/vdev_zaps_007_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/vdev_zaps/vdev_zaps_007_pos.ksh
index 1f71b11ee562..c7f12c633706 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/vdev_zaps/vdev_zaps_007_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/vdev_zaps/vdev_zaps_007_pos.ksh
@@ -36,7 +36,7 @@ log_must zpool create -f $TESTPOOL mirror ${DISK_ARR[0]} ${DISK_ARR[1]}
log_assert "Per-vdev ZAPs persist correctly on the original pool after split."
conf="$TESTDIR/vz007"
-log_must zdb -PC $TESTPOOL > $conf
+log_must eval "zdb -PC $TESTPOOL > $conf"
assert_has_sentinel "$conf"
orig_top=$(get_top_vd_zap "type: 'mirror'" $conf)
@@ -49,7 +49,7 @@ assert_zap_common $TESTPOOL ${DISK_ARR[1]} "leaf" $orig_leaf1
log_must zpool split $TESTPOOL $POOL2 ${DISK_ARR[1]}
# Make sure old pool's ZAPs are consistent.
-log_must zdb -PC $TESTPOOL > $conf
+log_must eval "zdb -PC $TESTPOOL > $conf"
new_leaf0=$(get_leaf_vd_zap ${DISK_ARR[0]} $conf)
new_top_s0=$(get_top_vd_zap ${DISK_ARR[0]} $conf)
@@ -62,7 +62,7 @@ log_assert "Per-vdev ZAPs persist on the new pool after import."
# Import the split pool.
log_must zpool import $POOL2
-log_must zdb -PC $TESTPOOL > $conf
+log_must eval "zdb -PC $POOL2 > $conf"
new_leaf1=$(get_leaf_vd_zap ${DISK_ARR[1]} $conf)
new_top_s1=$(get_top_vd_zap ${DISK_ARR[1]} $conf)
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/write_dirs/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/write_dirs/Makefile.am
deleted file mode 100644
index 9bdc46b902e0..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/write_dirs/Makefile.am
+++ /dev/null
@@ -1,6 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/write_dirs
-dist_pkgdata_SCRIPTS = \
- setup.ksh \
- cleanup.ksh \
- write_dirs_001_pos.ksh \
- write_dirs_002_pos.ksh
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/xattr/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/xattr/Makefile.am
deleted file mode 100644
index 0cbd799aac85..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/xattr/Makefile.am
+++ /dev/null
@@ -1,22 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/xattr
-dist_pkgdata_SCRIPTS = \
- setup.ksh \
- cleanup.ksh \
- xattr_001_pos.ksh \
- xattr_002_neg.ksh \
- xattr_003_neg.ksh \
- xattr_004_pos.ksh \
- xattr_005_pos.ksh \
- xattr_006_pos.ksh \
- xattr_007_neg.ksh \
- xattr_008_pos.ksh \
- xattr_009_neg.ksh \
- xattr_010_neg.ksh \
- xattr_011_pos.ksh \
- xattr_012_pos.ksh \
- xattr_013_pos.ksh \
- xattr_compat.ksh
-
-dist_pkgdata_DATA = \
- xattr_common.kshlib \
- xattr.cfg
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/xattr/cleanup.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/xattr/cleanup.ksh
index b3629629c78c..625718cfeac8 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/xattr/cleanup.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/xattr/cleanup.ksh
@@ -30,8 +30,8 @@
. $STF_SUITE/include/libtest.shlib
. $STF_SUITE/tests/functional/xattr/xattr_common.kshlib
-USES_NIS=$(cat $TEST_BASE_DIR/zfs-xattr-test-nis.txt)
-rm $TEST_BASE_DIR/zfs-xattr-test-nis.txt
+USES_NIS=$(<$TEST_BASE_DIR/zfs-xattr-test-nis.txt)
+rm $TEST_BASE_DIR/zfs-xattr-test-nis.txt $TEST_BASE_DIR/zfs-xattr-test-user.txt
if [ "${USES_NIS}" == "true" ]
then
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/xattr/setup.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/xattr/setup.ksh
index 7ad36a714365..4f0fb1abf493 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/xattr/setup.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/xattr/setup.ksh
@@ -34,8 +34,7 @@
# (it can cause useradd to take a long time, hitting our TIMEOUT)
if is_illumos; then
USES_NIS=false
- svcs svc:/network/nis/client:default | grep online > /dev/null
- if [ $? -eq 0 ]
+ if svcs svc:/network/nis/client:default | grep -q online
then
svcadm disable -t svc:/network/nis/client:default
USES_NIS=true
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/xattr/xattr_003_neg.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/xattr/xattr_003_neg.ksh
index ba27d043b7fe..852bffc7a173 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/xattr/xattr_003_neg.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/xattr/xattr_003_neg.ksh
@@ -59,8 +59,8 @@ create_xattr $testfile passwd /etc/passwd
log_must chmod 000 $testfile
if is_illumos; then
- log_mustnot su $ZFS_USER -c "runat $testfile cat passwd"
- log_mustnot su $ZFS_USER -c "runat $testfile cp /etc/passwd ."
+ log_mustnot user_run $ZFS_USER runat $testfile cat passwd
+ log_mustnot user_run $ZFS_USER runat $testfile cp /etc/passwd .
else
log_mustnot user_run $ZFS_USER "
. $STF_SUITE/include/libtest.shlib
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/xattr/xattr_004_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/xattr/xattr_004_pos.ksh
index 786322b30a97..2ed040d864c4 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/xattr/xattr_004_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/xattr/xattr_004_pos.ksh
@@ -50,8 +50,8 @@ verify_runnable "global"
function cleanup {
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
+ log_must rm -rf /tmp/$NEWFS_DEFAULT_FS.$$
}
log_assert "Files from $NEWFS_DEFAULT_FS with xattrs copied to zfs retain xattr info."
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/xattr/xattr_010_neg.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/xattr/xattr_010_neg.ksh
index 43502bfff28b..41c7054f23d7 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/xattr/xattr_010_neg.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/xattr/xattr_010_neg.ksh
@@ -61,6 +61,6 @@ log_mustnot runat $TESTDIR/myfile.$$ mknod block b 888 888
log_mustnot runat $TESTDIR/myfile.$$ mknod char c
-log_mustnot runat $TESTDIR/myfile.$$ mknod fifo p
+log_mustnot runat $TESTDIR/myfile.$$ mkfifo fifo
log_pass "mkdir, mknod fail"
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/xattr/xattr_011_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/xattr/xattr_011_pos.ksh
index fdfefbf674e9..7d7827e135ea 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/xattr/xattr_011_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/xattr/xattr_011_pos.ksh
@@ -126,12 +126,8 @@ if is_illumos; then
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 eval "find $TESTDIR -xattr | grep -q myfile.$$"
+ log_mustnot eval "find $TESTDIR -xattr | grep -q no-xattr"
log_must rm -rf $TESTDIR/noxattrs
else
log_note "Checking find - unsupported"
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/xattr/xattr_012_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/xattr/xattr_012_pos.ksh
index 693ca0a634d5..f5c0ab0c22d0 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/xattr/xattr_012_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/xattr/xattr_012_pos.ksh
@@ -52,19 +52,6 @@ function cleanup {
fi
}
-function get_pool_size {
- poolname=$1
- psize=$(zpool list -H -o allocated $poolname)
- if [[ $psize == *[mM] ]]
- then
- returnvalue=$(echo $psize | sed -e 's/m//g' -e 's/M//g')
- returnvalue=$((returnvalue * 1024))
- else
- returnvalue=$(echo $psize | sed -e 's/k//g' -e 's/K//g')
- fi
- echo $returnvalue
-}
-
log_assert "xattr file sizes count towards normal disk usage"
log_onexit cleanup
@@ -77,10 +64,10 @@ if is_global_zone
then
# get pool and filesystem sizes. Since we're starting with an empty
# pool, the usage should be small - a few k.
- POOL_SIZE=$(get_pool_size $TESTPOOL)
+ POOL_SIZE=$(get_pool_prop allocated $TESTPOOL)
fi
-FS_SIZE=$(zfs get -p -H -o value used $TESTPOOL/$TESTFS)
+FS_SIZE=$(get_prop used $TESTPOOL/$TESTFS)
if is_freebsd; then
# FreeBSD setextattr has awful scaling with respect to input size.
@@ -106,7 +93,7 @@ sync_pool
# now check to see if our pool disk usage has increased
if is_global_zone
then
- NEW_POOL_SIZE=$(get_pool_size $TESTPOOL)
+ NEW_POOL_SIZE=$(get_pool_prop allocated $TESTPOOL)
(($NEW_POOL_SIZE <= $POOL_SIZE)) && \
log_fail "The new pool size $NEW_POOL_SIZE was less \
than or equal to the old pool size $POOL_SIZE."
@@ -114,7 +101,7 @@ then
fi
# also make sure our filesystem usage has increased
-NEW_FS_SIZE=$(zfs get -p -H -o value used $TESTPOOL/$TESTFS)
+NEW_FS_SIZE=$(get_prop used $TESTPOOL/$TESTFS)
(($NEW_FS_SIZE <= $FS_SIZE)) && \
log_fail "The new filesystem size $NEW_FS_SIZE was less \
than or equal to the old filesystem size $FS_SIZE."
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/xattr/xattr_013_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/xattr/xattr_013_pos.ksh
index efa9faab96f5..a5a43ff1083c 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/xattr/xattr_013_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/xattr/xattr_013_pos.ksh
@@ -52,12 +52,6 @@ function cleanup {
log_assert "The noxattr mount option functions as expected"
log_onexit cleanup
-zfs set 2>&1 | grep xattr > /dev/null
-if [ $? -ne 0 ]
-then
- log_unsupported "noxattr mount option not supported on this release."
-fi
-
log_must touch $TESTDIR/myfile.$$
create_xattr $TESTDIR/myfile.$$ passwd /etc/passwd
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/xattr/xattr_common.kshlib b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/xattr/xattr_common.kshlib
index bc06f4716867..5ff2b489024c 100644
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/xattr/xattr_common.kshlib
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/xattr/xattr_common.kshlib
@@ -97,10 +97,10 @@ function delete_xattr { # filename xattr_name
if is_illumos; then
log_must runat $FILE rm $XATTR_NAME
log_mustnot eval "runat $FILE ls $XATTR_NAME > /dev/null 2>&1"
- else
- log_must rm_xattr $XATTR_NAME $FILE
- log_mustnot get_xattr $XATTR_NAME $FILE
- fi
+ else
+ log_must rm_xattr $XATTR_NAME $FILE
+ log_mustnot get_xattr $XATTR_NAME $FILE
+ fi
}
# not sure about this : really this should be testing write/append
@@ -126,12 +126,6 @@ function verify_write_xattr { # filename xattr_name
function create_expected_output { # expected_output_file contents_of_the_output
typeset FILE=$1
shift
- if [[ -f $FILE ]]; then
- log_must rm $FILE
- fi
-
- for line in $@
- do
- log_must eval "echo $line >> $FILE"
- done
+ log_must rm -f $FILE
+ log_must eval "printf '%s\n' $* >> $FILE"
}
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/zpool_influxdb/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/zpool_influxdb/Makefile.am
deleted file mode 100644
index 36d08a41a91c..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/zpool_influxdb/Makefile.am
+++ /dev/null
@@ -1,5 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/zpool_influxdb
-dist_pkgdata_SCRIPTS = \
- setup.ksh \
- cleanup.ksh \
- zpool_influxdb.ksh
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/zpool_influxdb/zpool_influxdb.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/zpool_influxdb/zpool_influxdb.ksh
index 495a4a38b7f5..61a85c50280a 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/zpool_influxdb/zpool_influxdb.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/zpool_influxdb/zpool_influxdb.ksh
@@ -43,14 +43,11 @@ fi
function check_for
{
- grep "^${1}," $tmpfile >/dev/null 2>/dev/null
- if [ $? -ne 0 ]; then
- log_fail "cannot find stats for $1"
- fi
+ log_must grep -q "^${1}," $tmpfile
}
# by default, all stats and histograms for all pools
-log_must zpool_influxdb > $tmpfile
+log_must eval "zpool_influxdb > $tmpfile"
STATS="
zpool_io_size
@@ -64,8 +61,8 @@ for stat in $STATS; do
done
# scan stats aren't expected to be there until after a scan has started
-zpool scrub $TESTPOOL
-zpool_influxdb > $tmpfile
+log_must zpool scrub $TESTPOOL
+log_must eval "zpool_influxdb > $tmpfile"
check_for zpool_scan_stats
log_pass "zpool_influxdb gathers statistics"
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/zvol/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/zvol/Makefile.am
deleted file mode 100644
index e4910754bb81..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/zvol/Makefile.am
+++ /dev/null
@@ -1,10 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/zvol
-dist_pkgdata_DATA = \
- zvol.cfg \
- zvol_common.shlib
-
-SUBDIRS = \
- zvol_ENOSPC \
- zvol_cli \
- zvol_misc \
- zvol_swap
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/zvol/zvol_ENOSPC/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/zvol/zvol_ENOSPC/Makefile.am
deleted file mode 100644
index 9cd9b4149eaf..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/zvol/zvol_ENOSPC/Makefile.am
+++ /dev/null
@@ -1,8 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/zvol/zvol_ENOSPC
-dist_pkgdata_SCRIPTS = \
- cleanup.ksh \
- setup.ksh \
- zvol_ENOSPC_001_pos.ksh
-
-dist_pkgdata_DATA = \
- zvol_ENOSPC.cfg
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/zvol/zvol_ENOSPC/zvol_ENOSPC.cfg b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/zvol/zvol_ENOSPC/zvol_ENOSPC.cfg
index 8a99225ba9ec..92650c5e050e 100644
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/zvol/zvol_ENOSPC/zvol_ENOSPC.cfg
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/zvol/zvol_ENOSPC/zvol_ENOSPC.cfg
@@ -32,7 +32,7 @@
verify_runnable "global"
-export DISK_ARRAY_NUM=$(echo ${DISKS} | nawk '{print NF}')
+export DISK_ARRAY_NUM=$(echo ${DISKS} | awk '{print NF}')
export DISKSARRAY=$DISKS
if is_linux; then
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/zvol/zvol_cli/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/zvol/zvol_cli/Makefile.am
deleted file mode 100644
index c6b15684f45e..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/zvol/zvol_cli/Makefile.am
+++ /dev/null
@@ -1,10 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/zvol/zvol_cli
-dist_pkgdata_SCRIPTS = \
- cleanup.ksh \
- setup.ksh \
- zvol_cli_001_pos.ksh \
- zvol_cli_002_pos.ksh \
- zvol_cli_003_neg.ksh
-
-dist_pkgdata_DATA = \
- zvol_cli.cfg
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/zvol/zvol_cli/zvol_cli.cfg b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/zvol/zvol_cli/zvol_cli.cfg
index 8a99225ba9ec..92650c5e050e 100644
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/zvol/zvol_cli/zvol_cli.cfg
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/zvol/zvol_cli/zvol_cli.cfg
@@ -32,7 +32,7 @@
verify_runnable "global"
-export DISK_ARRAY_NUM=$(echo ${DISKS} | nawk '{print NF}')
+export DISK_ARRAY_NUM=$(echo ${DISKS} | awk '{print NF}')
export DISKSARRAY=$DISKS
if is_linux; then
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/zvol/zvol_common.shlib b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/zvol/zvol_common.shlib
index 4f74c9b92613..c0fd90f58eaf 100644
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/zvol/zvol_common.shlib
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/zvol/zvol_common.shlib
@@ -71,8 +71,7 @@ function default_zvol_cleanup
function get_dumpdevice
{
- typeset ret=$(dumpadm | grep "Dump device:" | awk '{print $3}')
- echo $ret
+ dumpadm | awk '/Dump device:/ {print $3}'
}
function set_dumpsize
@@ -86,8 +85,7 @@ function set_dumpsize
log_must zfs set volsize=64m $volume
- output=$(dumpadm -d /dev/zvol/dsk/$volume 2>&1 | \
- tail -1 | awk '{print $3}')
+ output=$(dumpadm -d /dev/zvol/dsk/$volume 2>&1 | awk 'END {print $3}')
if [[ -n $output ]]; then
(( output = output / 1024 / 1024 ))
@@ -128,6 +126,5 @@ function is_zvol_dumpified
return 1
fi
- zdb -dddd $volume 2 | grep "dumpsize" > /dev/null 2>&1
- return $?
+ zdb -dddd $volume 2 | grep -q "dumpsize"
}
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/zvol/zvol_misc/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/zvol/zvol_misc/Makefile.am
deleted file mode 100644
index 024007a41826..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/zvol/zvol_misc/Makefile.am
+++ /dev/null
@@ -1,19 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/zvol/zvol_misc
-dist_pkgdata_SCRIPTS = \
- cleanup.ksh \
- setup.ksh \
- zvol_misc_001_neg.ksh \
- zvol_misc_002_pos.ksh \
- zvol_misc_003_neg.ksh \
- zvol_misc_004_pos.ksh \
- zvol_misc_005_neg.ksh \
- zvol_misc_006_pos.ksh \
- zvol_misc_hierarchy.ksh \
- zvol_misc_rename_inuse.ksh \
- zvol_misc_snapdev.ksh \
- zvol_misc_volmode.ksh \
- zvol_misc_zil.ksh
-
-dist_pkgdata_DATA = \
- zvol_misc_common.kshlib
-
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/zvol/zvol_misc/zvol_misc_002_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/zvol/zvol_misc/zvol_misc_002_pos.ksh
index 297ad242fe25..16ff1f5f87db 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/zvol/zvol_misc/zvol_misc_002_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/zvol/zvol_misc/zvol_misc_002_pos.ksh
@@ -48,11 +48,11 @@ volsize=$(zfs get -H -o value volsize $TESTPOOL/$TESTVOL)
function cleanup
{
- snapexists $TESTPOOL/$TESTVOL@snap && \
+ snapexists $TESTPOOL/$TESTVOL@snap &&
destroy_dataset $TESTPOOL/$TESTVOL@snap
- ismounted $TESTDIR $NEWFS_DEFAULT_FS
- (( $? == 0 )) && log_must umount $TESTDIR
+ ismounted $TESTDIR $NEWFS_DEFAULT_FS &&
+ log_must umount $TESTDIR
zfs set volsize=$volsize $TESTPOOL/$TESTVOL
}
@@ -73,13 +73,8 @@ log_must mount ${ZVOL_DEVDIR}/$TESTPOOL/$TESTVOL $TESTDIR
typeset -i fn=0
typeset -i retval=0
-while (( 1 )); do
- file_write -o create -f $TESTDIR/testfile$$.$fn \
- -b $BLOCKSZ -c $NUM_WRITES
- retval=$?
- if (( $retval != 0 )); then
- break
- fi
+while file_write -o create -f $TESTDIR/testfile$$.$fn \
+ -b $BLOCKSZ -c $NUM_WRITES; do
(( fn = fn + 1 ))
done
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/zvol/zvol_misc/zvol_misc_004_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/zvol/zvol_misc/zvol_misc_004_pos.ksh
index e0dce0c2c34a..0f8dbb1bcfff 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/zvol/zvol_misc/zvol_misc_004_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/zvol/zvol_misc/zvol_misc_004_pos.ksh
@@ -58,10 +58,7 @@ function cleanup
safe_dumpadm $savedumpdev
fi
- swap -l | grep -w $voldev > /dev/null 2>&1
- if (( $? == 0 )); then
- log_must swap -d $voldev
- fi
+ swap -l | grep -qw $voldev && log_must swap -d $voldev
typeset snap
for snap in snap0 snap1 ; do
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/zvol/zvol_misc/zvol_misc_005_neg.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/zvol/zvol_misc/zvol_misc_005_neg.ksh
index 48dfe6d9386c..b4a6f1248579 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/zvol/zvol_misc/zvol_misc_005_neg.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/zvol/zvol_misc/zvol_misc_005_neg.ksh
@@ -53,10 +53,7 @@ volsize=$(zfs get -H -o value volsize $TESTPOOL/$TESTVOL)
function cleanup
{
- swap -l | grep $voldev > /dev/null 2>&1
- if (( $? == 0 )) ; then
- log_must swap -d $voldev
- fi
+ swap -l | grep -qF $voldev && log_must swap -d $voldev
typeset dumpdev=$(get_dumpdevice)
if [[ $dumpdev != $savedumpdev ]] ; then
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/zvol/zvol_misc/zvol_misc_common.kshlib b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/zvol/zvol_misc/zvol_misc_common.kshlib
index b69d2ce02913..da8a494b4a64 100644
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/zvol/zvol_misc/zvol_misc_common.kshlib
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/zvol/zvol_misc/zvol_misc_common.kshlib
@@ -134,9 +134,8 @@ function verify_partition # device
# verify we can access the partition on the device
devname="$(readlink -f "$device")"
if is_linux || is_freebsd; then
- is_disk_device "$devname""p1"
+ is_disk_device "${devname}p1"
else
- is_disk_device "$devname""s0"
+ is_disk_device "${devname}s0"
fi
- return $?
}
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/zvol/zvol_swap/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/zvol/zvol_swap/Makefile.am
deleted file mode 100644
index 480c0048cfd8..000000000000
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/zvol/zvol_swap/Makefile.am
+++ /dev/null
@@ -1,13 +0,0 @@
-pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/zvol/zvol_swap
-dist_pkgdata_SCRIPTS = \
- cleanup.ksh \
- setup.ksh \
- zvol_swap_001_pos.ksh \
- zvol_swap_002_pos.ksh \
- zvol_swap_003_pos.ksh \
- zvol_swap_004_pos.ksh \
- zvol_swap_005_pos.ksh \
- zvol_swap_006_pos.ksh
-
-dist_pkgdata_DATA = \
- zvol_swap.cfg
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/zvol/zvol_swap/cleanup.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/zvol/zvol_swap/cleanup.ksh
index 70574fcfe705..f1457b72199e 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/zvol/zvol_swap/cleanup.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/zvol/zvol_swap/cleanup.ksh
@@ -46,13 +46,13 @@ fi
for swapdev in $SAVESWAPDEVS
do
if ! is_swap_inuse $swapdev ; then
- log_must swap_setup $swapdev >/dev/null 2>&1
+ swap_setup $swapdev
fi
done
voldev=${ZVOL_DEVDIR}/$TESTPOOL/$TESTVOL
if is_swap_inuse $voldev ; then
- log_must swap_cleanup $voldev
+ swap_cleanup $voldev
fi
default_zvol_cleanup
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/zvol/zvol_swap/setup.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/zvol/zvol_swap/setup.ksh
index 2ec8c72c67de..6c6ca2b3b6f8 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/zvol/zvol_swap/setup.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/zvol/zvol_swap/setup.ksh
@@ -37,11 +37,9 @@ verify_runnable "global"
for i in $SAVESWAPDEVS ; do
log_note "Executing: swap_cleanup $i"
- swap_cleanup $i >/dev/null 2>&1
- if [[ $? != 0 ]]; then
+ swap_cleanup $i >/dev/null 2>&1 ||
log_untested "Unable to delete swap device $i because of" \
"insufficient RAM"
- fi
done
default_zvol_setup $DISK $VOLSIZE
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/zvol/zvol_swap/zvol_swap.cfg b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/zvol/zvol_swap/zvol_swap.cfg
index 54ecc18b5585..b6501da9c5c7 100644
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/zvol/zvol_swap/zvol_swap.cfg
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/zvol/zvol_swap/zvol_swap.cfg
@@ -34,11 +34,11 @@
# Remember swap devices
#
if is_linux; then
- SAVESWAPDEVS=$(swapon -s | nawk '(NR != 1) {print $1}')
+ SAVESWAPDEVS=$(swapon -s | awk '(NR != 1) {print $1}')
elif is_freebsd; then
- SAVESWAPDEVS=$(swapctl -l | nawk '(NR != 1) {print $1}')
+ SAVESWAPDEVS=$(swapctl -l | awk '(NR != 1) {print $1}')
else
- SAVESWAPDEVS=$(swap -l | nawk '(NR != 1) {print $1}')
+ SAVESWAPDEVS=$(swap -l | awk '(NR != 1) {print $1}')
fi
export BLOCKSZ=$(( 1024 * 1024 ))
diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/zvol/zvol_swap/zvol_swap_003_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/zvol/zvol_swap/zvol_swap_003_pos.ksh
index aafdb7a49fac..588663dba278 100755
--- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/zvol/zvol_swap/zvol_swap_003_pos.ksh
+++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/zvol/zvol_swap/zvol_swap_003_pos.ksh
@@ -74,7 +74,7 @@ PREV_VFSTAB_FILE=$TEST_BASE_DIR/zvol_vfstab.PREV.$$
[[ -f $NEW_VFSTAB_FILE ]] && cp /dev/null $NEW_VFSTAB_FILE
-awk '{if ($4 != "swap") print $1}' /etc/vfstab > $NEW_VFSTAB_FILE
+awk '$4 != "swap" {print $1}' /etc/vfstab > $NEW_VFSTAB_FILE
echo "$voldev\t-\t-\tswap\t-\tno\t-" >> $NEW_VFSTAB_FILE
# Copy off the original vfstab, and run swapadd on the newly constructed one.