Add "tc" paramter for "block" testsuite which enables the testsuite
to run test cases separately. The default value of tc is 0 which
preserves the original behaviour and runs all the available test cases.

A user space shell script "run.sh" is also added which helps to run
the test cases in kernel space.

Signed-off-by: Márton Németh <nm...@freemail.hu>
diff -uprN ltp.orig/testcases/kernel/device-drivers/block/kernel_space/Makefile ltp/testcases/kernel/device-drivers/block/kernel_space/Makefile
--- ltp.orig/testcases/kernel/device-drivers/block/kernel_space/Makefile	2009-01-16 07:36:17.000000000 +0100
+++ ltp/testcases/kernel/device-drivers/block/kernel_space/Makefile	2009-01-16 07:29:16.000000000 +0100
@@ -13,6 +13,7 @@ modules:
 
 clean:
 	$(MAKE) -C $(KDIR) SUBDIRS=$(PWD) clean
+	rm -f modules.order
 
 help:
 	$(MAKE) -C $(KDIR) SUBDIRS=$(PWD) help
diff -uprN ltp.orig/testcases/kernel/device-drivers/block/kernel_space/run.sh ltp/testcases/kernel/device-drivers/block/kernel_space/run.sh
--- ltp.orig/testcases/kernel/device-drivers/block/kernel_space/run.sh	1970-01-01 01:00:00.000000000 +0100
+++ ltp/testcases/kernel/device-drivers/block/kernel_space/run.sh	2009-01-16 07:27:15.000000000 +0100
@@ -0,0 +1,47 @@
+#!/bin/sh
+
+# Tell the system to flush write buffers in order to minimize data loss in
+# case of a crash.
+sync
+
+echo Running Test Cases of "block" testsuite one by one.
+echo The test results are printed to "dmesg".
+echo
+
+#
+# Valid test cases (should run stable)
+#
+echo Test Case 1
+insmod ./test_block.ko tc=1
+rmmod test_block
+
+echo Test Case 2
+insmod ./test_block.ko tc=2
+rmmod test_block
+
+echo Test Case 5
+insmod ./test_block.ko tc=5
+rmmod test_block
+
+#
+# Invalid testcases (more probable to crash the module under test)
+#
+echo Test Case 3
+insmod ./test_block.ko tc=3
+rmmod test_block
+
+echo Test Case 4
+insmod ./test_block.ko tc=4
+rmmod test_block
+
+echo Test Case 6
+insmod ./test_block.ko tc=6
+rmmod test_block
+
+echo Test Case 7
+insmod ./test_block.ko tc=7
+rmmod test_block
+
+echo Test Case 10
+insmod ./test_block.ko tc=10
+rmmod test_block
diff -uprN ltp.orig/testcases/kernel/device-drivers/block/kernel_space/test_block.c ltp/testcases/kernel/device-drivers/block/kernel_space/test_block.c
--- ltp.orig/testcases/kernel/device-drivers/block/kernel_space/test_block.c	2009-01-16 07:36:22.000000000 +0100
+++ ltp/testcases/kernel/device-drivers/block/kernel_space/test_block.c	2009-01-16 07:16:06.000000000 +0100
@@ -10,12 +10,21 @@
  *   3. insmod ./test_block.ko
  *   4. Check the test results in "dmesg"
  *   5. rmmod test_block
+ *
+ * Changes:
+ * 16 Jan 2009  0.2  Added "tc" parameter to run test cases separately
+ * 11 Jan 2009  0.1  First release
  */
 
 
 #include <linux/module.h>
 #include <linux/fs.h>
 
+static unsigned int __initdata tc;
+module_param_named(tc, tc, int, 0);
+MODULE_PARM_DESC(tc, "Test Case to run. Default is 0 which means that run all tests.");
+
+
 MODULE_AUTHOR("Márton Németh <nm...@freemail.hu>");
 MODULE_DESCRIPTION("Test block drivers");
 MODULE_LICENSE("GPL");
@@ -249,15 +258,30 @@ static void tc10(void) {
 static int test_init_module(void)
 {
 	printk(KERN_INFO "Starting test_block module\n");
-	tc01();
-	tc02();
-	tc03();
-	tc04();
-	tc05();
-	tc06();
-	tc07();
 
-	tc10();
+	if (tc == 0 || tc == 1)
+		tc01();
+
+	if (tc == 0 || tc == 2)
+		tc02();
+
+	if (tc == 0 || tc == 3)
+		tc03();
+
+	if (tc == 0 || tc == 4)
+		tc04();
+
+	if (tc == 0 || tc == 5)
+		tc05();
+
+	if (tc == 0 || tc == 6)
+		tc06();
+
+	if (tc == 0 || tc == 7)
+		tc07();
+
+	if (tc == 0 || tc == 10)
+		tc10();
 
 	return 0;
 }
------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to