linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Yu Kuai <yukuai1@huaweicloud.com>
To: linux-block@vger.kernel.org, shinichiro.kawasaki@wdc.com,
	hch@infradead.org
Cc: yukuai3@huawei.com, yangerkun@huawei.com, yi.zhang@huawei.com
Subject: [PATCH blktests] dm: add a regression test
Date: Fri, 30 Dec 2022 14:54:24 +0800	[thread overview]
Message-ID: <20221230065424.19998-1-yukuai1@huaweicloud.com> (raw)

From: Yu Kuai <yukuai3@huawei.com>

Verify that reload a dm with itself won't crash the kernel.

Signed-off-by: Yu Kuai <yukuai3@huawei.com>
---
 tests/dm/001     | 27 +++++++++++++++++++++++++++
 tests/dm/001.out |  4 ++++
 tests/dm/rc      | 11 +++++++++++
 3 files changed, 42 insertions(+)
 create mode 100755 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 100755
index 0000000..55e07f3
--- /dev/null
+++ b/tests/dm/001
@@ -0,0 +1,27 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-3.0+
+# Copyright (C) 2022 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 itself"
+QUICK=1
+
+requires() {
+	_have_program dmsetup && _have_driver dm-mod
+}
+
+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"
+	dmsetup resume test
+	dmsetup remove test
+
+	echo "Test complete"
+}
diff --git a/tests/dm/001.out b/tests/dm/001.out
new file mode 100644
index 0000000..23cf1f0
--- /dev/null
+++ b/tests/dm/001.out
@@ -0,0 +1,4 @@
+Running dm/001
+device-mapper: reload ioctl on test failed: Invalid argument
+Command failed
+Test complete
diff --git a/tests/dm/rc b/tests/dm/rc
new file mode 100644
index 0000000..e1ad6c6
--- /dev/null
+++ b/tests/dm/rc
@@ -0,0 +1,11 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-3.0+
+# Copyright (C) 2022 Yu Kuai
+#
+# TODO: provide a brief description of the group here.
+
+. common/rc
+
+group_requires() {
+	_have_root
+}
-- 
2.31.1


             reply	other threads:[~2022-12-30  6:34 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-30  6:54 Yu Kuai [this message]
2022-12-30 22:24 ` [PATCH blktests] dm: add a regression test kernel test robot
2023-01-12  1:05 ` Shinichiro Kawasaki
2023-04-25  8:22   ` Yu Kuai
2023-04-25 12:15     ` Shin'ichiro Kawasaki
2023-04-25 17:24       ` Mike Snitzer
2023-04-26  8:42         ` Chaitanya Kulkarni
2023-04-26 12:13           ` Shin'ichiro 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=20221230065424.19998-1-yukuai1@huaweicloud.com \
    --to=yukuai1@huaweicloud.com \
    --cc=hch@infradead.org \
    --cc=linux-block@vger.kernel.org \
    --cc=shinichiro.kawasaki@wdc.com \
    --cc=yangerkun@huawei.com \
    --cc=yi.zhang@huawei.com \
    --cc=yukuai3@huawei.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).