diff options
Diffstat (limited to 'tests/zfs-tests')
-rw-r--r-- | tests/zfs-tests/include/libtest.shlib | 14 | ||||
-rw-r--r-- | tests/zfs-tests/tests/functional/Makefile.am | 1 | ||||
-rw-r--r-- | tests/zfs-tests/tests/functional/io/Makefile.am | 12 | ||||
-rwxr-xr-x | tests/zfs-tests/tests/functional/io/cleanup.ksh | 31 | ||||
-rw-r--r-- | tests/zfs-tests/tests/functional/io/io.cfg | 25 | ||||
-rwxr-xr-x | tests/zfs-tests/tests/functional/io/libaio.ksh | 65 | ||||
-rwxr-xr-x | tests/zfs-tests/tests/functional/io/mmap.ksh | 69 | ||||
-rwxr-xr-x | tests/zfs-tests/tests/functional/io/posixaio.ksh | 65 | ||||
-rwxr-xr-x | tests/zfs-tests/tests/functional/io/psync.ksh | 65 | ||||
-rwxr-xr-x | tests/zfs-tests/tests/functional/io/setup.ksh | 31 | ||||
-rwxr-xr-x | tests/zfs-tests/tests/functional/io/sync.ksh | 65 |
11 files changed, 443 insertions, 0 deletions
diff --git a/tests/zfs-tests/include/libtest.shlib b/tests/zfs-tests/include/libtest.shlib index 73b397894..1fdb91bd9 100644 --- a/tests/zfs-tests/include/libtest.shlib +++ b/tests/zfs-tests/include/libtest.shlib @@ -41,6 +41,20 @@ if [ -n "$STF_PATH" ]; then PATH="$STF_PATH" fi +# +# Generic dot version comparison function +# +# Returns success when version $1 is greater than or equal to $2. +# +function compare_version_gte +{ + if [[ "$(printf "$1\n$2" | sort -V | tail -n1)" == "$1" ]]; then + return 0 + else + return 1 + fi +} + # Linux kernel version comparison function # # $1 Linux version ("4.10", "2.6.32") or blank for installed Linux version diff --git a/tests/zfs-tests/tests/functional/Makefile.am b/tests/zfs-tests/tests/functional/Makefile.am index 5e877c1bf..5cd079b98 100644 --- a/tests/zfs-tests/tests/functional/Makefile.am +++ b/tests/zfs-tests/tests/functional/Makefile.am @@ -27,6 +27,7 @@ SUBDIRS = \ hkdf \ inheritance \ inuse \ + io \ kstat \ large_files \ largest_pool \ diff --git a/tests/zfs-tests/tests/functional/io/Makefile.am b/tests/zfs-tests/tests/functional/io/Makefile.am new file mode 100644 index 000000000..5253f08a0 --- /dev/null +++ b/tests/zfs-tests/tests/functional/io/Makefile.am @@ -0,0 +1,12 @@ +pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/io +dist_pkgdata_SCRIPTS = \ + setup.ksh \ + cleanup.ksh \ + sync.ksh \ + psync.ksh \ + libaio.ksh \ + posixaio.ksh \ + mmap.ksh + +dist_pkgdata_DATA = \ + io.cfg diff --git a/tests/zfs-tests/tests/functional/io/cleanup.ksh b/tests/zfs-tests/tests/functional/io/cleanup.ksh new file mode 100755 index 000000000..0031a26c3 --- /dev/null +++ b/tests/zfs-tests/tests/functional/io/cleanup.ksh @@ -0,0 +1,31 @@ +#!/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) 2018 by Lawrence Livermore National Security, LLC. +# + +. $STF_SUITE/include/libtest.shlib + +verify_runnable "global" + +default_cleanup diff --git a/tests/zfs-tests/tests/functional/io/io.cfg b/tests/zfs-tests/tests/functional/io/io.cfg new file mode 100644 index 000000000..9312ad1e1 --- /dev/null +++ b/tests/zfs-tests/tests/functional/io/io.cfg @@ -0,0 +1,25 @@ +# +# 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) 2018 by Lawrence Livermore National Security, LLC. +# + +FIO_COMMON_ARGS="--numjobs=1 --bs=32k --size=32M --fallocate=none --group_reporting --verify=sha1 --minimal" + +FIO_READ_ARGS="--name=rw --rw=read $FIO_COMMON_ARGS" +FIO_WRITE_ARGS="--name=rw --rw=write $FIO_COMMON_ARGS" +FIO_RANDREAD_ARGS="--name=rw --rw=randread $FIO_COMMON_ARGS" +FIO_RANDWRITE_ARGS="--name=rw --rw=randwrite $FIO_COMMON_ARGS" diff --git a/tests/zfs-tests/tests/functional/io/libaio.ksh b/tests/zfs-tests/tests/functional/io/libaio.ksh new file mode 100755 index 000000000..c434ad90d --- /dev/null +++ b/tests/zfs-tests/tests/functional/io/libaio.ksh @@ -0,0 +1,65 @@ +#! /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) 2018 by Lawrence Livermore National Security, LLC. +# + +. $STF_SUITE/include/libtest.shlib +. $STF_SUITE/tests/functional/io/io.cfg + +# +# DESCRIPTION: +# Verify Linux native asynchronous IO. +# +# STRATEGY: +# 1. Use fio(1) in verify mode to perform write, read, +# random read, and random write workloads. +# 2. Repeat the test with additional fio(1) options. +# + +verify_runnable "global" + +function cleanup +{ + log_must rm -f "$mntpnt/rw*" +} + +log_assert "Verify Linux native asynchronous IO" + +log_onexit cleanup + +ioengine="--ioengine=libaio" +mntpnt=$(get_prop mountpoint $TESTPOOL/$TESTFS) +dir="--directory=$mntpnt" + +set -A fio_arg -- "--sync=0" "--sync=1" "--direct=0" "--direct=1" + +for arg in "${fio_arg[@]}"; do + log_must fio $dir $ioengine $arg $FIO_WRITE_ARGS + log_must fio $dir $ioengine $arg $FIO_READ_ARGS + log_must fio $dir $ioengine $arg $FIO_RANDWRITE_ARGS + log_must fio $dir $ioengine $arg $FIO_RANDREAD_ARGS + log_must rm -f "$mntpnt/rw*" +done + +log_pass "Verified Linux native asynchronous IO" diff --git a/tests/zfs-tests/tests/functional/io/mmap.ksh b/tests/zfs-tests/tests/functional/io/mmap.ksh new file mode 100755 index 000000000..e9600787a --- /dev/null +++ b/tests/zfs-tests/tests/functional/io/mmap.ksh @@ -0,0 +1,69 @@ +#! /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) 2018 by Lawrence Livermore National Security, LLC. +# + +. $STF_SUITE/include/libtest.shlib +. $STF_SUITE/tests/functional/io/io.cfg + +# +# DESCRIPTION: +# Verify memory mapped IO with mmap(2) and memcpy(3) +# +# STRATEGY: +# 1. Use fio(1) in verify mode to perform write, read, +# random read, and random write workloads. +# 2. Repeat the test with additional fio(1) options. +# + +if ! compare_version_gte $(fio --version) "fio-2.3"; then + log_unsupported "Requires fio-2.3 or newer" +fi + +verify_runnable "global" + +function cleanup +{ + log_must rm -f "$mntpnt/rw*" +} + +log_assert "Verify memory mapped IO with mmap(2) and memcpy(3)" + +log_onexit cleanup + +ioengine="--ioengine=mmap" +mntpnt=$(get_prop mountpoint $TESTPOOL/$TESTFS) +dir="--directory=$mntpnt" + +set -A fio_arg -- "--sync=0" "--sync=1" "--direct=0" "--direct=1" + +for arg in "${fio_arg[@]}"; do + log_must fio $dir $ioengine $arg $FIO_WRITE_ARGS + log_must fio $dir $ioengine $arg $FIO_READ_ARGS + log_must fio $dir $ioengine $arg $FIO_RANDWRITE_ARGS + log_must fio $dir $ioengine $arg $FIO_RANDREAD_ARGS + log_must rm -f "$mntpnt/rw*" +done + +log_pass "Verified memory mapped IO with mmap(2) and memcpy(3)" diff --git a/tests/zfs-tests/tests/functional/io/posixaio.ksh b/tests/zfs-tests/tests/functional/io/posixaio.ksh new file mode 100755 index 000000000..0758164c1 --- /dev/null +++ b/tests/zfs-tests/tests/functional/io/posixaio.ksh @@ -0,0 +1,65 @@ +#! /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) 2018 by Lawrence Livermore National Security, LLC. +# + +. $STF_SUITE/include/libtest.shlib +. $STF_SUITE/tests/functional/io/io.cfg + +# +# DESCRIPTION: +# Verify POSIX asynchronous IO with aio_read(3) and aio_write(3). +# +# STRATEGY: +# 1. Use fio(1) in verify mode to perform write, read, +# random read, and random write workloads. +# 2. Repeat the test with additional fio(1) options. +# + +verify_runnable "global" + +function cleanup +{ + log_must rm -f "$mntpnt/rw*" +} + +log_assert "Verify POSIX asynchronous IO with aio_read(3) and aio_write(3)" + +log_onexit cleanup + +ioengine="--ioengine=posixaio" +mntpnt=$(get_prop mountpoint $TESTPOOL/$TESTFS) +dir="--directory=$mntpnt" + +set -A fio_arg -- "--sync=0" "--sync=1" "--direct=0" "--direct=1" + +for arg in "${fio_arg[@]}"; do + log_must fio $dir $ioengine $arg $FIO_WRITE_ARGS + log_must fio $dir $ioengine $arg $FIO_READ_ARGS + log_must fio $dir $ioengine $arg $FIO_RANDWRITE_ARGS + log_must fio $dir $ioengine $arg $FIO_RANDREAD_ARGS + log_must rm -f "$mntpnt/rw*" +done + +log_pass "Verified POSIX asynchronous IO with aio_read(3) and aio_write(3)" diff --git a/tests/zfs-tests/tests/functional/io/psync.ksh b/tests/zfs-tests/tests/functional/io/psync.ksh new file mode 100755 index 000000000..efeb1103d --- /dev/null +++ b/tests/zfs-tests/tests/functional/io/psync.ksh @@ -0,0 +1,65 @@ +#! /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) 2018 by Lawrence Livermore National Security, LLC. +# + +. $STF_SUITE/include/libtest.shlib +. $STF_SUITE/tests/functional/io/io.cfg + +# +# DESCRIPTION: +# Verify basic pread(2) and pwrite(2). +# +# STRATEGY: +# 1. Use fio(1) in verify mode to perform write, read, +# random read, and random write workloads. +# 2. Repeat the test with additional fio(1) options. +# + +verify_runnable "global" + +function cleanup +{ + log_must rm -f "/$TESTPOOL/rw*" +} + +log_assert "Verify basic pread(2), pwrite(2)" + +log_onexit cleanup + +ioengine="--ioengine=psync" +mntpnt=$(get_prop mountpoint $TESTPOOL/$TESTFS) +dir="--directory=$mntpnt" + +set -A fio_arg -- "--sync=0" "--sync=1" "--direct=0" "--direct=1" + +for arg in "${fio_arg[@]}"; do + log_must fio $dir $ioengine $arg $FIO_WRITE_ARGS + log_must fio $dir $ioengine $arg $FIO_READ_ARGS + log_must fio $dir $ioengine $arg $FIO_RANDWRITE_ARGS + log_must fio $dir $ioengine $arg $FIO_RANDREAD_ARGS + log_must rm -f "$mntpnt/rw*" +done + +log_pass "Verified basic pread(2), pwrite(2)" diff --git a/tests/zfs-tests/tests/functional/io/setup.ksh b/tests/zfs-tests/tests/functional/io/setup.ksh new file mode 100755 index 000000000..ff72fc3db --- /dev/null +++ b/tests/zfs-tests/tests/functional/io/setup.ksh @@ -0,0 +1,31 @@ +#!/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) 2018 by Lawrence Livermore National Security, LLC. +# + +. $STF_SUITE/include/libtest.shlib +verify_runnable "global" + +default_setup "$DISKS" +log_must zfs set compression=on $TESTPOOL/$TESTFS diff --git a/tests/zfs-tests/tests/functional/io/sync.ksh b/tests/zfs-tests/tests/functional/io/sync.ksh new file mode 100755 index 000000000..83f346c69 --- /dev/null +++ b/tests/zfs-tests/tests/functional/io/sync.ksh @@ -0,0 +1,65 @@ +#! /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) 2018 by Lawrence Livermore National Security, LLC. +# + +. $STF_SUITE/include/libtest.shlib +. $STF_SUITE/tests/functional/io/io.cfg + +# +# DESCRIPTION: +# Verify basic read(2), write(2) and lseek(2). +# +# STRATEGY: +# 1. Use fio(1) in verify mode to perform write, read, +# random read, and random write workloads. +# 2. Repeat the test with additional fio(1) options. +# + +verify_runnable "global" + +function cleanup +{ + log_must rm -f "$mntpnt/rw*" +} + +log_assert "Verify basic read(2), write(2) and lseek(2)" + +log_onexit cleanup + +ioengine="--ioengine=sync" +mntpnt=$(get_prop mountpoint $TESTPOOL/$TESTFS) +dir="--directory=$mntpnt" + +set -A fio_arg -- "--sync=0" "--sync=1" "--direct=0" "--direct=1" + +for arg in ${fio_arg[@]}; do + log_must fio $dir $ioengine $arg $FIO_WRITE_ARGS + log_must fio $dir $ioengine $arg $FIO_READ_ARGS + log_must fio $dir $ioengine $arg $FIO_RANDWRITE_ARGS + log_must fio $dir $ioengine $arg $FIO_RANDREAD_ARGS + log_must rm -f "$mntpnt/rw*" +done + +log_pass "Verified basic read(2), write(2) and lseek(2)" |