summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAnanth N Mavinakayanahalli <ananth@in.ibm.com>2008-02-11 16:21:45 +0530
committerSam Ravnborg <sam@ravnborg.org>2008-02-12 23:29:18 +0100
commit1caff9ba52970a3492bfe8a1b9e26291d34259c5 (patch)
tree7db6467c1556d373def59a0d11a66866e166e0b4 /tests
parentf8773002e2c0e5bd232d5f56abeca9fe1d906984 (diff)
Move backtrace tests to tests/
Move backtrace selftests to tests/ Signed-off-by: Ananth N Mavinakayanahalli <ananth@in.ibm.com> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/Kconfig12
-rw-r--r--tests/Makefile1
-rw-r--r--tests/backtracetest.c48
3 files changed, 61 insertions, 0 deletions
diff --git a/tests/Kconfig b/tests/Kconfig
index 8deefaa2cd2c..b0a9e8ef295d 100644
--- a/tests/Kconfig
+++ b/tests/Kconfig
@@ -64,4 +64,16 @@ config KPROBES_SANITY_TEST
Say N if you are unsure.
+config BACKTRACE_SELF_TEST
+ tristate "Self test for the backtrace code"
+ depends on DEBUG_KERNEL
+ default n
+ help
+ This option provides a kernel module that can be used to test
+ the kernel stack backtrace code. This option is not useful
+ for distributions or general kernels, but only for kernel
+ developers working on architecture code.
+
+ Say N if you are unsure.
+
endif # KERNEL_TESTS
diff --git a/tests/Makefile b/tests/Makefile
index 455cd12c607c..1d56a9ea5993 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -7,3 +7,4 @@ obj-$(CONFIG_RCU_TORTURE_TEST) += rcutorture.o
obj-$(CONFIG_RT_MUTEX_TESTER) += rtmutex-tester.o
obj-$(CONFIG_LKDTM) += lkdtm.o
obj-$(CONFIG_KPROBES_SANITY_TEST) += test_kprobes.o
+obj-$(CONFIG_BACKTRACE_SELF_TEST) += backtracetest.o
diff --git a/tests/backtracetest.c b/tests/backtracetest.c
new file mode 100644
index 000000000000..d1a7605c5b8f
--- /dev/null
+++ b/tests/backtracetest.c
@@ -0,0 +1,48 @@
+/*
+ * Simple stack backtrace regression test module
+ *
+ * (C) Copyright 2008 Intel Corporation
+ * Author: Arjan van de Ven <arjan@linux.intel.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; version 2
+ * of the License.
+ */
+
+#include <linux/module.h>
+#include <linux/sched.h>
+#include <linux/delay.h>
+
+static struct timer_list backtrace_timer;
+
+static void backtrace_test_timer(unsigned long data)
+{
+ printk("Testing a backtrace from irq context.\n");
+ printk("The following trace is a kernel self test and not a bug!\n");
+ dump_stack();
+}
+static int backtrace_regression_test(void)
+{
+ printk("====[ backtrace testing ]===========\n");
+ printk("Testing a backtrace from process context.\n");
+ printk("The following trace is a kernel self test and not a bug!\n");
+ dump_stack();
+
+ init_timer(&backtrace_timer);
+ backtrace_timer.function = backtrace_test_timer;
+ mod_timer(&backtrace_timer, jiffies + 10);
+
+ msleep(10);
+ printk("====[ end of backtrace testing ]====\n");
+ return 0;
+}
+
+static void exitf(void)
+{
+}
+
+module_init(backtrace_regression_test);
+module_exit(exitf);
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("Arjan van de Ven <arjan@linux.intel.com>");