2 * Simple stack backtrace regression test module
4 * (C) Copyright 2008 Intel Corporation
5 * Author: Arjan van de Ven <arjan@linux.intel.com>
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; version 2
13 #include <linux/delay.h>
14 #include <linux/module.h>
15 #include <linux/sched.h>
16 #include <linux/stacktrace.h>
18 static struct timer_list backtrace_timer
;
20 static void backtrace_test_timer(unsigned long data
)
22 printk("Testing a backtrace from irq context.\n");
23 printk("The following trace is a kernel self test and not a bug!\n");
27 #ifdef CONFIG_STACKTRACE
28 static void backtrace_test_saved(void)
30 struct stack_trace trace
;
31 unsigned long entries
[8];
33 printk("Testing a saved backtrace.\n");
34 printk("The following trace is a kernel self test and not a bug!\n");
37 trace
.max_entries
= ARRAY_SIZE(entries
);
38 trace
.entries
= entries
;
41 save_stack_trace(&trace
);
42 print_stack_trace(&trace
, 0);
45 static void backtrace_test_saved(void)
47 printk("Saved backtrace test skipped.\n");
51 static int backtrace_regression_test(void)
53 printk("====[ backtrace testing ]===========\n");
54 printk("Testing a backtrace from process context.\n");
55 printk("The following trace is a kernel self test and not a bug!\n");
58 backtrace_test_saved();
60 init_timer(&backtrace_timer
);
61 backtrace_timer
.function
= backtrace_test_timer
;
62 mod_timer(&backtrace_timer
, jiffies
+ 10);
65 printk("====[ end of backtrace testing ]====\n");
69 static void exitf(void)
73 module_init(backtrace_regression_test
);
75 MODULE_LICENSE("GPL");
76 MODULE_AUTHOR("Arjan van de Ven <arjan@linux.intel.com>");