xref: /freebsd/sys/contrib/openzfs/tests/zfs-tests/tests/functional/io/io_uring.ksh (revision 3747329b7864d0f98a0e34dda0113804ab3a2dce)
1#! /bin/ksh -p
2# SPDX-License-Identifier: CDDL-1.0
3#
4# CDDL HEADER START
5#
6# The contents of this file are subject to the terms of the
7# Common Development and Distribution License (the "License").
8# You may not use this file except in compliance with the License.
9#
10# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
11# or https://opensource.org/licenses/CDDL-1.0.
12# See the License for the specific language governing permissions
13# and limitations under the License.
14#
15# When distributing Covered Code, include this CDDL HEADER in each
16# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
17# If applicable, add the following below this CDDL HEADER, with the
18# fields enclosed by brackets "[]" replaced with your own identifying
19# information: Portions Copyright [yyyy] [name of copyright owner]
20#
21# CDDL HEADER END
22#
23
24#
25# Copyright (c) 2018 by Lawrence Livermore National Security, LLC.
26#
27
28. $STF_SUITE/include/libtest.shlib
29. $STF_SUITE/tests/functional/io/io.cfg
30
31#
32# DESCRIPTION:
33#	Verify Linux io_uring.
34#
35# STRATEGY:
36#	1. Use fio(1) in verify mode to perform write, read,
37#	   random read, and random write workloads.
38#	2. Repeat the test with additional fio(1) options.
39#
40
41verify_runnable "global"
42
43
44if ! $(grep -q "CONFIG_IO_URING=y" /boot/config-$(uname -r)); then
45	log_unsupported "Requires io_uring support within Kernel"
46fi
47
48fio --ioengine=io_uring --parse-only || log_unsupported "fio io_uring support required"
49
50function cleanup
51{
52	log_must rm -f "$mntpnt/rw*"
53}
54
55log_assert "Verify Linux io_uring"
56
57log_onexit cleanup
58
59ioengine="--ioengine=io_uring"
60mntpnt=$(get_prop mountpoint $TESTPOOL/$TESTFS)
61dir="--directory=$mntpnt"
62
63set -A fio_arg -- "--sync=0" "--sync=1" "--direct=0" "--direct=1"
64
65for arg in "${fio_arg[@]}"; do
66	log_must fio $dir $ioengine $arg $FIO_WRITE_ARGS
67	log_must fio $dir $ioengine $arg $FIO_READ_ARGS
68	log_must fio $dir $ioengine $arg $FIO_RANDWRITE_ARGS
69	log_must fio $dir $ioengine $arg $FIO_RANDREAD_ARGS
70	log_must rm -f "$mntpnt/rw*"
71done
72
73log_pass "Verified Linux io_uring"
74