[PATCH blktests v2] tests/dm: add a regression test

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

 



From: Yu Kuai <yukuai3@xxxxxxxxxx>

Verify that reload a dm with maps to itself will fail.

Signed-off-by: Yu Kuai <yukuai3@xxxxxxxxxx>
---
 tests/dm/001     | 29 +++++++++++++++++++++++++++++
 tests/dm/001.out |  2 ++
 tests/dm/rc      | 13 +++++++++++++
 3 files changed, 44 insertions(+)
 create mode 100644 tests/dm/001
 create mode 100644 tests/dm/001.out
 create mode 100644 tests/dm/rc

diff --git a/tests/dm/001 b/tests/dm/001
new file mode 100644
index 0000000..6deab1f
--- /dev/null
+++ b/tests/dm/001
@@ -0,0 +1,29 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-3.0+
+# Copyright (C) 2023 Yu Kuai
+#
+# Regression test for commit 077a4033541f ("block: don't allow a disk link
+# holder to itself")
+
+. tests/dm/rc
+
+DESCRIPTION="reload a dm with maps to itself"
+QUICK=1
+
+requires() {
+	_have_kver 6 2
+}
+
+test_device() {
+	echo "Running ${TEST_NAME}"
+
+	dmsetup create test --table "0 8192 linear ${TEST_DEV} 0"
+	dmsetup suspend test
+	dmsetup reload test --table "0 8192 linear /dev/mapper/test 0" &> /dev/null
+	if [ $? -eq 0 ]; then
+		echo "reload a dm with maps to itself succeed."
+	fi
+	dmsetup remove test
+
+	echo "Test complete"
+}
diff --git a/tests/dm/001.out b/tests/dm/001.out
new file mode 100644
index 0000000..4bd2c08
--- /dev/null
+++ b/tests/dm/001.out
@@ -0,0 +1,2 @@
+Running dm/001
+Test complete
diff --git a/tests/dm/rc b/tests/dm/rc
new file mode 100644
index 0000000..0486db0
--- /dev/null
+++ b/tests/dm/rc
@@ -0,0 +1,13 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-3.0+
+# Copyright (C) 2023 Yu Kuai
+#
+# Tests for device-mapper
+
+. common/rc
+
+group_requires() {
+	_have_root
+	_have_program dmsetup
+	_have_driver dm-mod
+}
-- 
2.39.2

--
dm-devel mailing list
dm-devel@xxxxxxxxxx
https://listman.redhat.com/mailman/listinfo/dm-devel




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

  Powered by Linux