forked from osandov/blktests
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add tests for support for segments smaller than the page size
Signed-off-by: Bart Van Assche <[email protected]>
- Loading branch information
1 parent
5033ef5
commit 0730d05
Showing
5 changed files
with
126 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
#!/bin/bash | ||
# SPDX-License-Identifier: GPL-2.0 | ||
# Copyright 2022 Google LLC | ||
# | ||
# Test support for segment sizes less than 4096 bytes. | ||
|
||
. tests/block/rc | ||
. common/null_blk | ||
|
||
DESCRIPTION="do IO on null-blk with 512 byte segments" | ||
TIMED=1 | ||
|
||
requires() { | ||
_have_fio | ||
_have_null_blk | ||
_have_sub_page_limit_support | ||
} | ||
|
||
test() { | ||
local bs=4096 | ||
|
||
echo "Running ${TEST_NAME}" | ||
|
||
if ! _init_null_blk nr_devices=0; then | ||
echo "Loading null_blk failed" | ||
return 1 | ||
fi | ||
if ! grep -qw max_segment_size /sys/kernel/config/nullb/features; then | ||
SKIP_REASONS+=("max_segment_size parameter is not supported") | ||
return 1 | ||
fi | ||
local nullb_params=( | ||
blocksize="$bs" # bytes | ||
completion_nsec=0 | ||
max_segment_size=512 # bytes | ||
memory_backed=1 | ||
size=1 # MiB | ||
submit_queues=1 | ||
power=1 | ||
) | ||
if ! _configure_null_blk nullb0 "${nullb_params[@]}"; then | ||
echo "Configuring null_blk failed" | ||
return 1 | ||
fi | ||
fio --verify=md5 --rw=randwrite --bs=$bs --ioengine=psync --thread \ | ||
--group_reporting --sync=1 --direct=1 \ | ||
--name=block-099 --filename=/dev/nullb0 \ | ||
--output="${RESULTS_DIR}/block/fio-output-block-099.txt" \ | ||
>>"$FULL" | ||
local fio_status=$? | ||
rmdir /sys/kernel/config/nullb/nullb0 | ||
_exit_null_blk | ||
case $fio_status in | ||
0) echo "Passed";; | ||
*) echo "Failed (fio status = $fio_status)";; | ||
esac | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Running block/099 | ||
Passed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
#!/bin/bash | ||
# SPDX-License-Identifier: GPL-2.0 | ||
# Copyright 2022 Google LLC | ||
# | ||
# Test support for segment sizes less than 4096 bytes. | ||
|
||
. tests/block/rc | ||
. common/scsi_debug | ||
|
||
DESCRIPTION="do IO on scsi_debug with 512 byte segments" | ||
TIMED=1 | ||
|
||
requires() { | ||
_have_fio | ||
_have_scsi_debug | ||
_have_sub_page_limit_support | ||
} | ||
|
||
test() { | ||
local bs=4096 | ||
|
||
echo "Running ${TEST_NAME}" | ||
local scsi_debug_params=( | ||
add_host=1 | ||
clustering=1 | ||
delay=0 | ||
sector_size="$bs" # bytes | ||
) | ||
if _have_module_param scsi_debug max_segment_size; then | ||
scsi_debug_params+=(max_segment_size=512) # bytes | ||
echo "Segment size = 512" >>"$FULL" | ||
fi | ||
if ! _init_scsi_debug "${scsi_debug_params[@]}"; then | ||
echo "Initializing scsi_debug failed" | ||
return 1 | ||
fi | ||
local blkdev=/dev/${SCSI_DEBUG_DEVICES[0]} | ||
[ -b "$blkdev" ] || return 1 | ||
local ioengine | ||
for ioengine in psync sg; do | ||
echo "$ioengine" | ||
fio --verify=md5 --rw=randwrite --bs=$bs --ioengine=$ioengine \ | ||
--thread --group_reporting --sync=1 --direct=1 \ | ||
--name=scsi-099 --filename="$blkdev" \ | ||
--output="${RESULTS_DIR}/block/fio-output-scsi-099-$ioengine.txt" \ | ||
>>"$FULL" | ||
local fio_status=$? | ||
[ $fio_status = 0 ] || break | ||
done | ||
_exit_scsi_debug | ||
case $fio_status in | ||
0) echo "Passed";; | ||
*) echo "Failed (fio status = $fio_status)";; | ||
esac | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Running scsi/099 | ||
psync | ||
sg | ||
Passed |