From: Yu Kuai <yukuai1@huaweicloud.com>
To: shinichiro@fastmail.com, snitzer@kernel.org,
linux-block@vger.kernel.org, dm-devel@redhat.com
Subject: [PATCH blktests v2] tests/dm: add a regression test
Date: Thu, 27 Apr 2023 10:41:26 +0800 [thread overview]
Message-ID: <20230427024126.1417646-1-yukuai1@huaweicloud.com> (raw)
From: Yu Kuai <yukuai3@huawei.com>
Verify that reload a dm with maps to itself will fail.
Signed-off-by: Yu Kuai <yukuai3@huawei.com>
---
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
WARNING: multiple messages have this Message-ID (diff)
From: Yu Kuai <yukuai1@huaweicloud.com>
To: shinichiro@fastmail.com, snitzer@kernel.org,
linux-block@vger.kernel.org, dm-devel@redhat.com
Subject: [dm-devel] [PATCH blktests v2] tests/dm: add a regression test
Date: Thu, 27 Apr 2023 10:41:26 +0800 [thread overview]
Message-ID: <20230427024126.1417646-1-yukuai1@huaweicloud.com> (raw)
From: Yu Kuai <yukuai3@huawei.com>
Verify that reload a dm with maps to itself will fail.
Signed-off-by: Yu Kuai <yukuai3@huawei.com>
---
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@redhat.com
https://listman.redhat.com/mailman/listinfo/dm-devel
next reply other threads:[~2023-04-27 2:43 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-27 2:41 Yu Kuai [this message]
2023-04-27 2:41 ` [dm-devel] [PATCH blktests v2] tests/dm: add a regression test Yu Kuai
2023-04-29 14:27 ` kernel test robot
2023-04-29 14:27 ` [dm-devel] " kernel test robot
2023-05-01 4:34 ` Shinichiro Kawasaki
2023-05-01 4:34 ` [dm-devel] " Shinichiro Kawasaki
2023-05-04 3:18 ` Yu Kuai
2023-05-04 3:18 ` [dm-devel] " Yu Kuai
2023-05-05 7:22 ` Shinichiro Kawasaki
2023-05-05 7:22 ` [dm-devel] " Shinichiro Kawasaki
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230427024126.1417646-1-yukuai1@huaweicloud.com \
--to=yukuai1@huaweicloud.com \
--cc=dm-devel@redhat.com \
--cc=linux-block@vger.kernel.org \
--cc=shinichiro@fastmail.com \
--cc=snitzer@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.