[PATCH] tests/dm: add dm-dust general functionality test

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <bgurney@xxxxxxxxxx>
---
 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

diff --git a/tests/dm/002 b/tests/dm/002
new file mode 100755
index 0000000..6635c43
--- /dev/null
+++ b/tests/dm/002
@@ -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"
+}
diff --git a/tests/dm/002.out b/tests/dm/002.out
new file mode 100644
index 0000000..f348fe4
--- /dev/null
+++ b/tests/dm/002.out
@@ -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
-- 
2.45.0





[Index of Archives]     [DM Crypt]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Packaging]     [Fedora SELinux]     [Yosemite Discussion]     [KDE Users]     [Fedora Docs]

  Powered by Linux