From 884367fdde7eb9232dab47998c4cad44c28591a1 Mon Sep 17 00:00:00 2001 From: compudj Date: Wed, 29 Mar 2006 16:28:46 +0000 Subject: [PATCH] add tests git-svn-id: http://ltt.polymtl.ca/svn@1727 04897980-b3bd-0310-b5e0-8ef037075253 --- tests/kernel/Makefile | 24 ++++++++++++++++++++++++ tests/kernel/module-template.c | 29 +++++++++++++++++++++++++++++ tests/kernel/test-time-probe.c | 29 +++++++++++++++++++++++++++++ 3 files changed, 82 insertions(+) create mode 100644 tests/kernel/Makefile create mode 100644 tests/kernel/module-template.c create mode 100644 tests/kernel/test-time-probe.c diff --git a/tests/kernel/Makefile b/tests/kernel/Makefile new file mode 100644 index 00000000..e971a885 --- /dev/null +++ b/tests/kernel/Makefile @@ -0,0 +1,24 @@ +ifneq ($(KERNELRELEASE),) +ifneq ($(CONFIG_LTT),) + obj-m := test-time-probe.o test-l1-hit-probe.o test-int-response.o test-instrument-size-small.o test-instrument-size-med.o test-instrument-size-big.o test-time-precision.o +endif + +else + KERNELDIR ?= /lib/modules/$(shell uname -r)/build + PWD := $(shell pwd) + KERNELRELEASE = $(shell cat $(KERNELDIR)/$(KBUILD_OUTPUT)/include/linux/version.h | sed -n 's/.*UTS_RELEASE.*\"\(.*\)\".*/\1/p') +ifneq ($(INSTALL_MOD_PATH),) + DEPMOD_OPT := -b $(INSTALL_MOD_PATH) +endif + +default: + $(MAKE) -C $(KERNELDIR) M=$(PWD) modules + +modules_install: + $(MAKE) -C $(KERNELDIR) M=$(PWD) modules_install + if [ -f $(KERNELDIR)/$(KBUILD_OUTPUT)/System.map ] ; then /sbin/depmod -ae -F $(KERNELDIR)/$(KBUILD_OUTPUT)/System.map $(DEPMOD_OPT) $(KERNELRELEASE) ; fi + + +clean: + $(MAKE) -C $(KERNELDIR) M=$(PWD) clean +endif diff --git a/tests/kernel/module-template.c b/tests/kernel/module-template.c new file mode 100644 index 00000000..29f870b3 --- /dev/null +++ b/tests/kernel/module-template.c @@ -0,0 +1,29 @@ +/* test-time-probe.c + * + * Test time spent in a LTTng instrumentation probe. + */ + + +#include +#include +#include + +static int ltt_test_init(void) +{ + printk(KERN_ALERT "test init\n"); + + return 0; +} + +static void ltt_test_exit(void) +{ + printk(KERN_ALERT "test exit\n"); +} + +module_init(ltt_test_init) +module_exit(ltt_test_exit) + +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Mathieu Desnoyers"); +MODULE_DESCRIPTION("Linux Trace Toolkit Test"); + diff --git a/tests/kernel/test-time-probe.c b/tests/kernel/test-time-probe.c new file mode 100644 index 00000000..29f870b3 --- /dev/null +++ b/tests/kernel/test-time-probe.c @@ -0,0 +1,29 @@ +/* test-time-probe.c + * + * Test time spent in a LTTng instrumentation probe. + */ + + +#include +#include +#include + +static int ltt_test_init(void) +{ + printk(KERN_ALERT "test init\n"); + + return 0; +} + +static void ltt_test_exit(void) +{ + printk(KERN_ALERT "test exit\n"); +} + +module_init(ltt_test_init) +module_exit(ltt_test_exit) + +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Mathieu Desnoyers"); +MODULE_DESCRIPTION("Linux Trace Toolkit Test"); + -- 2.34.1