From: Lv Zheng <lv.zheng@intel.com>
To: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>,
Len Brown <len.brown@intel.com>, Corey Minyard <minyard@acm.org>,
Zhao Yakui <yakui.zhao@intel.com>
Cc: Lv Zheng <lv.zheng@intel.com>, <linux-kernel@vger.kernel.org>,
linux-acpi@vger.kernel.org,
openipmi-developer@lists.sourceforge.net
Subject: [PATCH 12/13] Testing: Add module load/unload test suite
Date: Tue, 23 Jul 2013 16:10:36 +0800 [thread overview]
Message-ID: <b4ea2d9d566206e14e33ddceeb39a2fa3fa541e1.1374566394.git.lv.zheng@intel.com> (raw)
In-Reply-To: <cover.1374566394.git.lv.zheng@intel.com>
This patch contains two test scripts for module load/unload race testing.
Follow the following steps to use this test suite:
1. Run several instances invoking endless_cat.sh to access the sysfs files
that exported by the module.
2. Run endless_mod.sh to load/unload the module frequently to see if races
will happen.
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
---
tools/testing/module-unloading/endless_cat.sh | 32 ++++++++++
tools/testing/module-unloading/endless_mod.sh | 81 +++++++++++++++++++++++++
2 files changed, 113 insertions(+)
create mode 100755 tools/testing/module-unloading/endless_cat.sh
create mode 100755 tools/testing/module-unloading/endless_mod.sh
diff --git a/tools/testing/module-unloading/endless_cat.sh b/tools/testing/module-unloading/endless_cat.sh
new file mode 100755
index 0000000..72e035c
--- /dev/null
+++ b/tools/testing/module-unloading/endless_cat.sh
@@ -0,0 +1,32 @@
+#!/bin/sh
+
+fatal() {
+ echo $1
+ exit 1
+}
+
+usage() {
+ echo "Usage: `basename $0` <file>"
+ echo "Where:"
+ echo " file: file to cat"
+}
+
+fatal_usage() {
+ usage
+ exit 1
+}
+
+if [ "x$1" = "x" ]; then
+ echo "Missing <file> paraemter."
+ fatal_usage
+fi
+if [ ! -f $1 ]; then
+ echo "$1 is not an accessible file."
+ fatal_usage
+fi
+
+while :
+do
+ cat $1
+ echo "-----------------------------------"
+done
diff --git a/tools/testing/module-unloading/endless_mod.sh b/tools/testing/module-unloading/endless_mod.sh
new file mode 100755
index 0000000..359b0c0
--- /dev/null
+++ b/tools/testing/module-unloading/endless_mod.sh
@@ -0,0 +1,81 @@
+#!/bin/sh
+
+fatal() {
+ echo $1
+ exit 1
+}
+
+usage() {
+ echo "Usage: `basename $0` [-t second] <module>"
+ echo "Where:"
+ echo " second: seconds to sleep between module actions"
+ echo " module: name of module to test"
+}
+
+fatal_usage() {
+ usage
+ exit 1
+}
+
+SLEEPSEC=10
+
+while getopts "t:" opt
+do
+ case $opt in
+ t) SLEEPSEC=$OPTARG;;
+ ?) echo "Invalid argument $opt"
+ fatal_usage;;
+ esac
+done
+shift $(($OPTIND - 1))
+
+if [ "x$1" = "x" ]; then
+ echo "Missing <module> paraemter."
+ fatal_usage
+fi
+
+find_module() {
+ curr_modules=`lsmod | cut -d " " -f1`
+
+ for m in $curr_modules; do
+ if [ "x$m" = "x$1" ]; then
+ return 0
+ fi
+ done
+ return 1
+}
+
+remove_module() {
+ while :
+ do
+ find_module $1
+ if [ $? -eq 0 ]; then
+ rmmod $1
+ echo "Removing $1 ..."
+ else
+ break
+ fi
+ done
+}
+
+insert_module() {
+ while :
+ do
+ find_module $1
+ if [ ! $? -eq 0 ]; then
+ modprobe $1
+ echo "Inserting $1 ..."
+ else
+ break
+ fi
+ done
+}
+
+while :
+do
+ echo "-----------------------------------"
+ insert_module $1
+ sleep $SLEEPSEC
+ remove_module $1
+ sleep $SLEEPSEC
+done
--
1.7.10
next prev parent reply other threads:[~2013-07-23 8:10 UTC|newest]
Thread overview: 46+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <cover.1370652213.git.lv.zheng@intel.com>
2013-07-23 8:08 ` [PATCH 00/13] ACPI/IPMI: Fix several issues in the current codes Lv Zheng
2013-07-23 8:08 ` [PATCH 01/13] ACPI/IPMI: Fix potential response buffer overflow Lv Zheng
2013-07-23 14:54 ` Greg KH
2013-07-24 0:21 ` Zheng, Lv
2013-07-24 0:44 ` Zheng, Lv
2013-07-23 8:09 ` [PATCH 02/13] ACPI/IPMI: Fix atomic context requirement of ipmi_msg_handler() Lv Zheng
2013-07-23 8:09 ` [PATCH 03/13] ACPI/IPMI: Fix race caused by the unprotected ACPI IPMI transfers Lv Zheng
2013-07-24 23:38 ` Rafael J. Wysocki
2013-07-25 3:09 ` Zheng, Lv
2013-07-25 12:06 ` Rafael J. Wysocki
2013-07-25 18:12 ` Corey Minyard
2013-07-25 19:32 ` Rafael J. Wysocki
2013-07-26 0:18 ` Zheng, Lv
2013-07-26 0:16 ` Zheng, Lv
2013-07-26 0:48 ` Corey Minyard
2013-07-26 1:30 ` Zheng, Lv
2013-07-26 0:09 ` Zheng, Lv
2013-07-23 8:09 ` [PATCH 04/13] ACPI/IPMI: Fix race caused by the unprotected ACPI IPMI user Lv Zheng
2013-07-25 21:59 ` Rafael J. Wysocki
2013-07-26 1:17 ` Zheng, Lv
2013-07-23 8:09 ` [PATCH 05/13] ACPI/IPMI: Fix issue caused by the per-device registration of the IPMI operation region handler Lv Zheng
2013-07-23 8:09 ` [PATCH 06/13] ACPI/IPMI: Add reference counting for ACPI operation region handlers Lv Zheng
2013-07-25 20:27 ` Rafael J. Wysocki
2013-07-26 0:47 ` Zheng, Lv
2013-07-26 8:09 ` Zheng, Lv
2013-07-26 14:00 ` Rafael J. Wysocki
2013-07-29 1:43 ` Zheng, Lv
2013-07-25 21:29 ` Rafael J. Wysocki
2013-07-26 1:54 ` Zheng, Lv
2013-07-26 8:15 ` Zheng, Lv
2013-07-26 14:49 ` Rafael J. Wysocki
2013-07-29 1:56 ` Zheng, Lv
2013-07-23 8:09 ` [PATCH 07/13] ACPI/IPMI: Add reference counting for ACPI IPMI transfers Lv Zheng
2013-07-25 22:23 ` Rafael J. Wysocki
2013-07-26 1:21 ` Zheng, Lv
2013-07-26 13:41 ` Rafael J. Wysocki
2013-07-23 8:10 ` [PATCH 08/13] ACPI/IPMI: Cleanup several acpi_ipmi_device members Lv Zheng
2013-07-25 22:25 ` Rafael J. Wysocki
2013-07-26 1:25 ` Zheng, Lv
2013-07-26 13:38 ` Rafael J. Wysocki
2013-07-29 1:12 ` Zheng, Lv
2013-07-23 8:10 ` [PATCH 09/13] ACPI/IPMI: Cleanup some initialization codes Lv Zheng
2013-07-23 8:10 ` [PATCH 10/13] ACPI/IPMI: Cleanup some inclusion codes Lv Zheng
2013-07-23 8:10 ` [PATCH 11/13] ACPI/IPMI: Cleanup some Kconfig codes Lv Zheng
2013-07-23 8:10 ` Lv Zheng [this message]
2013-07-23 8:10 ` [PATCH 13/13] ACPI/IPMI: Add IPMI operation region test device driver Lv Zheng
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=b4ea2d9d566206e14e33ddceeb39a2fa3fa541e1.1374566394.git.lv.zheng@intel.com \
--to=lv.zheng@intel.com \
--cc=len.brown@intel.com \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=minyard@acm.org \
--cc=openipmi-developer@lists.sourceforge.net \
--cc=rafael.j.wysocki@intel.com \
--cc=yakui.zhao@intel.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
all inboxes | Powered by JetHome®