xref: /linux/tools/testing/selftests/ublk/test_loop_01.sh (revision e31fd36da9c41f9f664e51a35860e9f606e81ef4)
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
9if ! _have_program fio; then
10	exit "$UBLK_SKIP_CODE"
11fi
12
13_prep_test "loop" "write and verify test"
14
15backfile_0=$(_create_backfile 256M)
16
17dev_id=$(_add_ublk_dev -t loop "$backfile_0")
18_check_add_dev $TID $? "${backfile_0}"
19
20# run fio over the ublk disk
21_run_fio_verify_io --filename=/dev/ublkb"${dev_id}" --size=256M
22ERR_CODE=$?
23
24_cleanup_test "loop"
25
26_remove_backfile "$backfile_0"
27
28_show_result $TID $ERR_CODE
29