Skip to content

Commit 88e5023

Browse files
committed
scsi/010: Add an F2FS data lifetime support test
Test whether write hint information is passed to block devices. Signed-off-by: Bart Van Assche <[email protected]>
1 parent b011769 commit 88e5023

File tree

2 files changed

+66
-0
lines changed

2 files changed

+66
-0
lines changed

tests/scsi/010

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
#!/bin/bash
2+
# SPDX-License-Identifier: GPL-3.0+
3+
# Copyright (C) 2025 Google LLC
4+
5+
. tests/scsi/rc
6+
. common/null_blk
7+
. common/scsi_debug
8+
9+
DESCRIPTION="test F2FS data lifetime support"
10+
QUICK=1
11+
12+
requires() {
13+
_have_fio
14+
_have_driver f2fs
15+
_have_program mkfs.f2fs
16+
_have_scsi_debug_group_number_stats
17+
}
18+
19+
test() {
20+
set -e
21+
22+
echo "Running ${TEST_NAME}"
23+
24+
local mount_dir="$TMPDIR/mnt"
25+
26+
local scsi_debug_params=(
27+
delay=0
28+
dev_size_mb=1024
29+
sector_size=4096
30+
)
31+
_configure_scsi_debug "${scsi_debug_params[@]}"
32+
local dev="/dev/${SCSI_DEBUG_DEVICES[0]}" fail
33+
ls -ld "${dev}" >>"${FULL}"
34+
mkfs.f2fs "${dev}" >>"${FULL}" 2>&1
35+
mkdir -p "${mount_dir}"
36+
mount -t f2fs "${dev}" "${mount_dir}"
37+
local fio_args=(
38+
--size=1M
39+
--directory="${mount_dir}"
40+
--time_based
41+
--runtime=10
42+
)
43+
set +e
44+
_run_fio_verify_io "${fio_args[@]}" >>"${FULL}" 2>&1 ||
45+
fail=true
46+
47+
umount "${mount_dir}" >>"${FULL}" 2>&1
48+
head -n 999 /sys/bus/pseudo/drivers/scsi_debug/group_number_stats >> "${FULL}"
49+
while read -r group count; do
50+
if [ "$count" -gt 0 ]; then echo "$group"; fi
51+
done < /sys/bus/pseudo/drivers/scsi_debug/group_number_stats
52+
_exit_scsi_debug
53+
54+
if [ -z "$fail" ]; then
55+
echo "Test complete"
56+
else
57+
echo "Test failed"
58+
return 1
59+
fi
60+
}

tests/scsi/010.out

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Running scsi/010
2+
0
3+
1
4+
2
5+
3
6+
Test complete

0 commit comments

Comments
 (0)