summaryrefslogtreecommitdiff
path: root/tests/generic
diff options
context:
space:
mode:
authorFilipe Manana <fdmanana@suse.com>2023-01-09 10:34:15 +0000
committerZorro Lang <zlang@kernel.org>2023-01-14 21:43:44 +0800
commitfde636203ffdc796f4044234f83700c8d160a8ad (patch)
tree6bacbcdeac3074fd2f6cf6cb1c6752d62d9fb24a /tests/generic
parent2151aae2e0382bd8843cc22fc726b3ffc7fb4426 (diff)
generic: test lseek with seek data mode on a one byte file
Test that seeking for data on a 1 byte file works correctly, the returned offset should be 0 if the start offset is 0. This is a regression test motivated by a btrfs bug introduced in kernel 6.1, which got recently fixed by the following kernel commit: 2f2e84ca6066 ("btrfs: fix off-by-one in delalloc search during lseek") Signed-off-by: Filipe Manana <fdmanana@suse.com> Reviewed-by: David Disseldorp <ddiss@suse.de> Signed-off-by: Zorro Lang <zlang@kernel.org>
Diffstat (limited to 'tests/generic')
-rwxr-xr-xtests/generic/70636
-rw-r--r--tests/generic/706.out2
2 files changed, 38 insertions, 0 deletions
diff --git a/tests/generic/706 b/tests/generic/706
new file mode 100755
index 00000000..b3e7aa7c
--- /dev/null
+++ b/tests/generic/706
@@ -0,0 +1,36 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (C) 2023 SUSE Linux Products GmbH. All Rights Reserved.
+#
+# FS QA Test 706
+#
+# Test that seeking for data on a 1 byte file works correctly, the returned
+# offset should be 0 if the start offset is 0.
+#
+. ./common/preamble
+_begin_fstest auto quick seek
+
+[ $FSTYP == "btrfs" ] &&
+ _fixed_by_kernel_commit 2f2e84ca6066 \
+ "btrfs: fix off-by-one in delalloc search during lseek"
+
+_supported_fs generic
+_require_test
+_require_seek_data_hole
+_require_test_program "seek_sanity_test"
+
+test_file=$TEST_DIR/seek_sanity_testfile.$seq
+
+_cleanup()
+{
+ cd /
+ rm -f $tmp.*
+ rm -f $test_file
+}
+
+_run_seek_sanity_test -s 22 -e 22 $test_file > $seqres.full 2>&1 ||
+ _fail "seek sanity check failed!"
+
+echo "Silence is golden"
+status=0
+exit
diff --git a/tests/generic/706.out b/tests/generic/706.out
new file mode 100644
index 00000000..577697c6
--- /dev/null
+++ b/tests/generic/706.out
@@ -0,0 +1,2 @@
+QA output created by 706
+Silence is golden