From dc53ea12cc09dafa5bef893ca805386e4ce8965c Mon Sep 17 00:00:00 2001 From: Bill Peck Date: Mon, 15 Apr 2013 14:52:17 -0400 Subject: test case for 949568 --- kernel/modules/949568/Makefile | 73 +++++++++++++++++++++++++++++++++ kernel/modules/949568/PURPOSE | 1 + kernel/modules/949568/module0/Makefile | 8 ++++ kernel/modules/949568/module0/module0.c | 22 ++++++++++ kernel/modules/949568/module1/Makefile | 8 ++++ kernel/modules/949568/module1/module1.c | 22 ++++++++++ kernel/modules/949568/module2/Makefile | 8 ++++ kernel/modules/949568/module2/module2.c | 16 ++++++++ kernel/modules/949568/runtest.sh | 29 +++++++++++++ 9 files changed, 187 insertions(+) create mode 100644 kernel/modules/949568/Makefile create mode 100644 kernel/modules/949568/PURPOSE create mode 100644 kernel/modules/949568/module0/Makefile create mode 100644 kernel/modules/949568/module0/module0.c create mode 100644 kernel/modules/949568/module1/Makefile create mode 100644 kernel/modules/949568/module1/module1.c create mode 100644 kernel/modules/949568/module2/Makefile create mode 100644 kernel/modules/949568/module2/module2.c create mode 100755 kernel/modules/949568/runtest.sh diff --git a/kernel/modules/949568/Makefile b/kernel/modules/949568/Makefile new file mode 100644 index 0000000..6fec495 --- /dev/null +++ b/kernel/modules/949568/Makefile @@ -0,0 +1,73 @@ +# Copyright (c) 2006 Red Hat, Inc. All rights reserved. This copyrighted material +# is made available to anyone wishing to use, modify, copy, or +# redistribute it subject to the terms and conditions of the GNU General +# Public License v.2. +# +# This program is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# +# Author: Chao Ye + +# The toplevel namespace within which the test lives. +TOPLEVEL_NAMESPACE=/kernel + +# The name of the package under test: +PACKAGE_NAME=modules + +# The path of the test below the package: +RELATIVE_PATH=949568 + +# Version of the Test. Used with make tag. +export TESTVERSION=1.0 + +# The combined namespace of the test. +export TEST=/$(TOPLEVEL_NAMESPACE)/$(PACKAGE_NAME)/$(RELATIVE_PATH) + + +# A phony target is one that is not really the name of a file. +# It is just a name for some commands to be executed when you +# make an explicit request. There are two reasons to use a +# phony target: to avoid a conflict with a file of the same +# name, and to improve performance. +.PHONY: all install download clean + +# executables to be built should be added here, they will be generated on the system under test. +BUILT_FILES= + +# data files, .c files, scripts anything needed to either compile the test and/or run it. +FILES=$(METADATA) runtest.sh Makefile PURPOSE module0/module0.c module1/module1.c\ + module2/module2.c + +run: $(FILES) build + ./runtest.sh + +build: $(BUILT_FILES) + chmod a+x ./runtest.sh + +clean: + rm -f *~ *.rpm $(BUILT_FILES) + +# You may need to add other targets e.g. to build executables from source code +# Add them here: + + +# Include Common Makefile +include /usr/share/rhts/lib/rhts-make.include + +# Generate the testinfo.desc here: +$(METADATA): Makefile + @touch $(METADATA) + @echo "Owner: Bill Peck " > $(METADATA) + @echo "Name: $(TEST)" >> $(METADATA) + @echo "Path: $(TEST_DIR)" >> $(METADATA) + @echo "License: GPLv3" >> $(METADATA) + @echo "TestVersion: $(TESTVERSION)" >> $(METADATA) + @echo "Description: Regression test for Bug 949568">> $(METADATA) + @echo "TestTime: 5m" >> $(METADATA) + @echo "RunFor: $(PACKAGE_NAME)" >> $(METADATA) + @echo "Requires: $(PACKAGE_NAME)" >> $(METADATA) diff --git a/kernel/modules/949568/PURPOSE b/kernel/modules/949568/PURPOSE new file mode 100644 index 0000000..f83c5ed --- /dev/null +++ b/kernel/modules/949568/PURPOSE @@ -0,0 +1 @@ +Regression test for Bug 602033. This test is not 100% automation, you need you check console output to get the result. diff --git a/kernel/modules/949568/module0/Makefile b/kernel/modules/949568/module0/Makefile new file mode 100644 index 0000000..60003b5 --- /dev/null +++ b/kernel/modules/949568/module0/Makefile @@ -0,0 +1,8 @@ +obj-m := module0.o +KERNELDIR ?= /lib/modules/$(shell uname -r)/build +PWD := $(shell pwd) + +default: + $(MAKE) -C $(KERNELDIR) M=$(PWD) modules +clean: + $(MAKE) -C $(KERNELDIR) M=$(PWD) clean diff --git a/kernel/modules/949568/module0/module0.c b/kernel/modules/949568/module0/module0.c new file mode 100644 index 0000000..b721dd7 --- /dev/null +++ b/kernel/modules/949568/module0/module0.c @@ -0,0 +1,22 @@ +#include +#include + +MODULE_LICENSE("Dual BSD/GPL"); + +static int module0_init(void) +{ + int code = 0; + printk(KERN_INFO "Module0 loaded!\n"); + code = request_module("module1"); + if (code != 0) + printk(KERN_ERR "Request module1 failed\n"); + else + printk(KERN_INFO "Request module1 successed\n"); + return 0; +} +static void module0_exit(void) +{ + printk(KERN_ALERT "module0 removed\n"); +} +module_init(module0_init); +module_exit(module0_exit); diff --git a/kernel/modules/949568/module1/Makefile b/kernel/modules/949568/module1/Makefile new file mode 100644 index 0000000..12e2918 --- /dev/null +++ b/kernel/modules/949568/module1/Makefile @@ -0,0 +1,8 @@ +obj-m := module1.o +KERNELDIR ?= /lib/modules/$(shell uname -r)/build +PWD := $(shell pwd) + +default: + $(MAKE) -C $(KERNELDIR) M=$(PWD) modules +clean: + $(MAKE) -C $(KERNELDIR) M=$(PWD) clean diff --git a/kernel/modules/949568/module1/module1.c b/kernel/modules/949568/module1/module1.c new file mode 100644 index 0000000..f01e9dc --- /dev/null +++ b/kernel/modules/949568/module1/module1.c @@ -0,0 +1,22 @@ +#include +#include + +MODULE_LICENSE("Dual BSD/GPL"); + +static int module1_init(void) +{ + int code = 0; + printk(KERN_INFO "module1 loaded!\n"); + code = request_module("module2"); + if (code != 0) + printk(KERN_ERR "Request module2 failed\n"); + else + printk(KERN_INFO "Request module2 successed\n"); + return 0; +} +static void module1_exit(void) +{ + printk(KERN_ALERT "module1 removed\n"); +} +module_init(module1_init); +module_exit(module1_exit); diff --git a/kernel/modules/949568/module2/Makefile b/kernel/modules/949568/module2/Makefile new file mode 100644 index 0000000..0a7a5f3 --- /dev/null +++ b/kernel/modules/949568/module2/Makefile @@ -0,0 +1,8 @@ +obj-m := module2.o +KERNELDIR ?= /lib/modules/$(shell uname -r)/build +PWD := $(shell pwd) + +default: + $(MAKE) -C $(KERNELDIR) M=$(PWD) modules +clean: + $(MAKE) -C $(KERNELDIR) M=$(PWD) clean diff --git a/kernel/modules/949568/module2/module2.c b/kernel/modules/949568/module2/module2.c new file mode 100644 index 0000000..3f22de1 --- /dev/null +++ b/kernel/modules/949568/module2/module2.c @@ -0,0 +1,16 @@ +#include +#include + +MODULE_LICENSE("Dual BSD/GPL"); + +static int module2_init(void) +{ + printk(KERN_INFO "module2 loaded!\n"); + return 0; +} +static void module2_exit(void) +{ + printk(KERN_ALERT "module2 removed\n"); +} +module_init(module2_init); +module_exit(module2_exit); diff --git a/kernel/modules/949568/runtest.sh b/kernel/modules/949568/runtest.sh new file mode 100755 index 0000000..9841a13 --- /dev/null +++ b/kernel/modules/949568/runtest.sh @@ -0,0 +1,29 @@ +#!/bin/sh + +# Copyright (c) 2006 Red Hat, Inc. All rights reserved. This copyrighted material +# is made available to anyone wishing to use, modify, copy, or +# redistribute it subject to the terms and conditions of the GNU General +# Public License v.2. +# +# This program is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# +# Author: Bill Peck + +# Source the common test script helpers +. /usr/bin/rhts_environment.sh + +make -C module0 +make -C module1 +make -C module2 +cp module0/module0.ko /lib/modules/$(uname -r) +cp module1/module1.ko /lib/modules/$(uname -r) +cp module2/module2.ko /lib/modules/$(uname -r) +depmod -a +modprobe module0 +report_result "${TEST}" "PASS" -- cgit