Skip to content

Commit a755da0

Browse files
ps-ushankaraxboe
authored andcommitted
selftests: ublk: add test to verify that feat_map is complete
Add a test that verifies that the currently running kernel does not report support for any features that are unrecognized by kublk. This should catch cases where features are added without updating kublk's feat_map accordingly, which has happened multiple times in the past (see [1], [2]). Note that this new test may fail if the test suite is older than the kernel, and the newer kernel contains a newly introduced feature. I believe this is not a use case we currently care about - we only care about newer test suites passing on older kernels. [1] https://lore.kernel.org/linux-block/20250606214011.2576398-1-csander@purestorage.com/t/#u [2] https://lore.kernel.org/linux-block/2a370ab1-d85b-409d-b762-f9f3f6bdf705@nvidia.com/t/#m1c520a058448d594fd877f07804e69b28908533f Signed-off-by: Uday Shankar <ushankar@purestorage.com> Reviewed-by: Ming Lei <ming.lei@redhat.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 742bcc1 commit a755da0

2 files changed

Lines changed: 21 additions & 0 deletions

File tree

tools/testing/selftests/ublk/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ TEST_PROGS += test_generic_09.sh
2020
TEST_PROGS += test_generic_10.sh
2121
TEST_PROGS += test_generic_11.sh
2222
TEST_PROGS += test_generic_12.sh
23+
TEST_PROGS += test_generic_13.sh
2324

2425
TEST_PROGS += test_null_01.sh
2526
TEST_PROGS += test_null_02.sh
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/bin/bash
2+
# SPDX-License-Identifier: GPL-2.0
3+
4+
. "$(cd "$(dirname "$0")" && pwd)"/test_common.sh
5+
6+
TID="generic_13"
7+
ERR_CODE=0
8+
9+
_prep_test "null" "check that feature list is complete"
10+
11+
if ${UBLK_PROG} features | grep -q unknown; then
12+
echo "# unknown feature detected!"
13+
echo "# did you add a feature and forget to update feat_map in kublk?"
14+
echo "# this failure is expected if running an older test suite against"
15+
echo "# a newer kernel with new features added"
16+
ERR_CODE=255
17+
fi
18+
19+
_cleanup_test "null"
20+
_show_result $TID $ERR_CODE

0 commit comments

Comments
 (0)