tests/dm: add dm-dust general functionality test
Subsystems (2)
PATCH 1/1 tests/dm: add dm-dust general functionality test
Add a general functionality test for the dm-dust device-mapper test target. Test the addition of bad blocks, and the clearing of bad blocks after a write is performed to the test device.
--- tests/dm/002 | 40 ++++++++++++++++++++++++++++++++++++++++ tests/dm/002.out | 10 ++++++++++ 2 files changed, 50 insertions(+) create mode 100755 tests/dm/002 create mode 100644 tests/dm/002.out
tests/dm/002 new file +40 -0
@@ -0,0 +1,40 @@ +#!/bin/bash +# SPDX-License-Identifier: GPL-3.0+ +# Copyright (C) 2024 Red Hat, Inc. +# + +. tests/dm/rc + +DESCRIPTION="dm-dust general functionality test" +QUICK=1 + +requires() { + _have_driver dm_dust +} + + +test_device() { + echo "Running ${TEST_NAME}" + + TEST_DEV_SZ=$(blockdev --getsz "$TEST_DEV") + dmsetup create dust1 --table "0 $TEST_DEV_SZ dust $TEST_DEV 0 512" + dmsetup message dust1 0 addbadblock 60 + dmsetup message dust1 0 addbadblock 67 + dmsetup message dust1 0 addbadblock 72 + dmsetup message dust1 0 countbadblocks + dmsetup message dust1 0 listbadblocks + dmsetup message dust1 0 clearbadblocks + dmsetup message dust1 0 countbadblocks + dmsetup message dust1 0 addbadblock 60 + dmsetup message dust1 0 addbadblock 67 + dmsetup message dust1 0 addbadblock 72 + dmsetup message dust1 0 countbadblocks + dmsetup message dust1 0 enable + dd if=/dev/zero of=/dev/mapper/dust1 bs=512 count=128 oflag=direct >/dev/null 2>&1 || return $? + sync + dmsetup message dust1 0 countbadblocks + sync + dmsetup remove dust1 + + echo "Test complete" +}
tests/dm/002.out new file +10 -0
@@ -0,0 +1,10 @@ +Running dm/002 +countbadblocks: 3 badblock(s) found +60 +67 +72 +dust_clear_badblocks: badblocks cleared +countbadblocks: 0 badblock(s) found +countbadblocks: 3 badblock(s) found +countbadblocks: 0 badblock(s) found +Test complete
Signature · 1 line
2.45.0
Quoted 5 lines · Bryan Gurney
Add a general functionality test for the dm-dust device-mapper test target. Test the addition of bad blocks, and the clearing of bad blocks after a write is performed to the test device.
Signed-off-by Bryan Gurney <[email protected]>
Hi Bryan, thank you for this blktests patch. It looks good to me. I ran the the new test case on my test node and result looks good too :)
Before applying it, I will leave it for several days in case anyone have some more comments.
Shinichiro Kawasaki
AppliedQuoted 5 lines · Shinichiro Kawasaki
Quoted 4 lines · Bryan Gurney
Add a general functionality test for the dm-dust device-mapper test target. Test the addition of bad blocks, and the clearing of bad blocks after a write is performed to the test device.
Quoted 7 lines
Quoted 1 line
Signed-off-by Bryan Gurney <[email protected]>Hi Bryan, thank you for this blktests patch. It looks good to me. I ran the the new test case on my test node and result looks good too :)
Before applying it, I will leave it for several days in case anyone have some more comments.
I've applied it. Thanks!