xref: /linux/tools/testing/selftests/ublk/test_loop_01.sh (revision 91928e0d3cc29789f4483bffee5f36218f23942b)
1#!/bin/bash
2# SPDX-License-Identifier: GPL-2.0
3
4. "$(cd "$(dirname "$0")" && pwd)"/test_common.sh
5
6TID="loop_01"
7ERR_CODE=0
8
9_prep_test "loop" "write and verify test"
10
11backfile_0=$(_create_backfile 256M)
12
13dev_id=$(_add_ublk_dev -t loop "$backfile_0")
14_check_add_dev $TID $? "${backfile_0}"
15
16# run fio over the ublk disk
17fio --name=write_and_verify \
18    --filename=/dev/ublkb"${dev_id}" \
19    --ioengine=libaio --iodepth=16 \
20    --rw=write \
21    --size=256M \
22    --direct=1 \
23    --verify=crc32c \
24    --do_verify=1 \
25    --bs=4k > /dev/null 2>&1
26ERR_CODE=$?
27
28_cleanup_test "loop"
29
30_remove_backfile "$backfile_0"
31
32_show_result $TID $ERR_CODE
33