The following series of patches create and populate the toplevel tests/ directory. This will henceforth be the place where all in-kernel tests live. All patches against 2.6.25-rc1 and are just code movement without any change in functionality. Ananth --
From: Ananth N Mavinakayanahalli <ananth@in.ibm.com> Create a toplevel tests/ directory to house in-kernel subsystem specific tests. Thanks to Sam Ravnborg for the Makefile corrections. Signed-off-by: Ananth N Mavinakayanahalli <ananth@in.ibm.com> Acked-by: Sam Ravnborg <sam@ravnborg.org> --- Makefile | 1 + lib/Kconfig.debug | 2 ++ tests/Kconfig | 10 ++++++++++ tests/Makefile | 3 +++ 4 files changed, 16 insertions(+) Index: linux-2.6.25-rc1/Makefile =================================================================== --- linux-2.6.25-rc1.orig/Makefile +++ linux-2.6.25-rc1/Makefile @@ -603,6 +603,7 @@ export mod_strip_cmd ifeq ($(KBUILD_EXTMOD),) core-y += kernel/ mm/ fs/ ipc/ security/ crypto/ block/ +core-$(CONFIG_KERNEL_TESTS) += tests/ vmlinux-dirs := $(patsubst %/,%,$(filter %/, $(init-y) $(init-m) \ $(core-y) $(core-m) $(drivers-y) $(drivers-m) \ Index: linux-2.6.25-rc1/lib/Kconfig.debug =================================================================== --- linux-2.6.25-rc1.orig/lib/Kconfig.debug +++ linux-2.6.25-rc1/lib/Kconfig.debug @@ -618,3 +618,5 @@ config PROVIDE_OHCI1394_DMA_INIT See Documentation/debugging-via-ohci1394.txt for more information. source "samples/Kconfig" + +source "tests/Kconfig" Index: linux-2.6.25-rc1/tests/Kconfig =================================================================== --- /dev/null +++ linux-2.6.25-rc1/tests/Kconfig @@ -0,0 +1,10 @@ +# tests/Kconfig + +menuconfig KERNEL_TESTS + bool "Kernel subsystem tests" + help + You can build kernel subsystem specific tests. + +if KERNEL_TESTS + +endif # KERNEL_TESTS Index: linux-2.6.25-rc1/tests/Makefile =================================================================== --- /dev/null +++ linux-2.6.25-rc1/tests/Makefile @@ -0,0 +1,3 @@ +# +# Makefile for kernel subsystem specific tests +# --
From: Ananth N Mavinakayanahalli <ananth@in.ibm.com> Move the locking-selftest infrastructure to tests/ Signed-off-by: Ananth N Mavinakayanahalli <ananth@in.ibm.com> --- lib/locking-selftest-hardirq.h | 9 lib/locking-selftest-mutex.h | 11 lib/locking-selftest-rlock-hardirq.h | 2 lib/locking-selftest-rlock-softirq.h | 2 lib/locking-selftest-rlock.h | 14 lib/locking-selftest-rsem.h | 14 lib/locking-selftest-softirq.h | 9 lib/locking-selftest-spin-hardirq.h | 2 lib/locking-selftest-spin-softirq.h | 2 lib/locking-selftest-spin.h | 11 lib/locking-selftest-wlock-hardirq.h | 2 lib/locking-selftest-wlock-softirq.h | 2 lib/locking-selftest-wlock.h | 14 lib/locking-selftest-wsem.h | 14 lib/locking-selftest.c | 1218 --------------------------------- lib/Kconfig.debug | 11 lib/Makefile | 1 tests/Kconfig | 11 tests/Makefile | 2 tests/locking-selftest-hardirq.h | 9 tests/locking-selftest-mutex.h | 11 tests/locking-selftest-rlock-hardirq.h | 2 tests/locking-selftest-rlock-softirq.h | 2 tests/locking-selftest-rlock.h | 14 tests/locking-selftest-rsem.h | 14 tests/locking-selftest-softirq.h | 9 tests/locking-selftest-spin-hardirq.h | 2 tests/locking-selftest-spin-softirq.h | 2 tests/locking-selftest-spin.h | 11 tests/locking-selftest-wlock-hardirq.h | 2 tests/locking-selftest-wlock-softirq.h | 2 tests/locking-selftest-wlock.h | 14 tests/locking-selftest-wsem.h | 14 tests/locking-selftest.c | 1218 +++++++++++++++++++++++++++++++++ 34 files changed, 1339 insertions(+), 1338 deletions(-) Index: ...
From: Ananth N Mavinakayanahalli <ananth@in.ibm.com> Move the rcutorture infrastructure to tests/ Signed-off-by: Ananth N Mavinakayanahalli <ananth@in.ibm.com> Acked-by: Josh Triplett <josh@freedesktop.org> Acked-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com> --- kernel/rcutorture.c | 995 ---------------------------------------------------- kernel/Makefile | 1 lib/Kconfig.debug | 13 tests/Kconfig | 13 tests/Makefile | 1 tests/rcutorture.c | 995 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 1009 insertions(+), 1009 deletions(-) Index: linux-2.6.25-rc1/kernel/Makefile =================================================================== --- linux-2.6.25-rc1.orig/kernel/Makefile +++ linux-2.6.25-rc1/kernel/Makefile @@ -56,7 +56,6 @@ obj-$(CONFIG_KPROBES) += kprobes.o obj-$(CONFIG_DETECT_SOFTLOCKUP) += softlockup.o obj-$(CONFIG_GENERIC_HARDIRQS) += irq/ obj-$(CONFIG_SECCOMP) += seccomp.o -obj-$(CONFIG_RCU_TORTURE_TEST) += rcutorture.o obj-$(CONFIG_CLASSIC_RCU) += rcuclassic.o obj-$(CONFIG_PREEMPT_RCU) += rcupreempt.o ifeq ($(CONFIG_PREEMPT_RCU),y) Index: linux-2.6.25-rc1/kernel/rcutorture.c =================================================================== --- linux-2.6.25-rc1.orig/kernel/rcutorture.c +++ /dev/null @@ -1,995 +0,0 @@ -/* - * Read-Copy Update module-based torture test facility - * - * 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; either version 2 of the License, or - * (at your option) any later version. - * - * 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 ...
From: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
Move the rtmutex-tester infrastructure to tests/
Signed-off-by: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
---
kernel/rtmutex-tester.c | 442 ------------------------------------------------
kernel/Makefile | 1
lib/Kconfig.debug | 6
tests/Kconfig | 6
tests/Makefile | 1
tests/rtmutex-tester.c | 442 ++++++++++++++++++++++++++++++++++++++++++++++++
6 files changed, 449 insertions(+), 449 deletions(-)
Index: linux-2.6.25-rc1/kernel/Makefile
===================================================================
--- linux-2.6.25-rc1.orig/kernel/Makefile
+++ linux-2.6.25-rc1/kernel/Makefile
@@ -25,7 +25,6 @@ obj-$(CONFIG_FUTEX) += futex_compat.o
endif
obj-$(CONFIG_RT_MUTEXES) += rtmutex.o
obj-$(CONFIG_DEBUG_RT_MUTEXES) += rtmutex-debug.o
-obj-$(CONFIG_RT_MUTEX_TESTER) += rtmutex-tester.o
obj-$(CONFIG_GENERIC_ISA_DMA) += dma.o
obj-$(CONFIG_SMP) += cpu.o spinlock.o
obj-$(CONFIG_DEBUG_SPINLOCK) += spinlock.o
Index: linux-2.6.25-rc1/kernel/rtmutex-tester.c
===================================================================
--- linux-2.6.25-rc1.orig/kernel/rtmutex-tester.c
+++ /dev/null
@@ -1,442 +0,0 @@
-/*
- * RT-Mutex-tester: scriptable tester for rt mutexes
- *
- * started by Thomas Gleixner:
- *
- * Copyright (C) 2006, Timesys Corp., Thomas Gleixner <tglx@timesys.com>
- *
- */
-#include <linux/kthread.h>
-#include <linux/module.h>
-#include <linux/sched.h>
-#include <linux/smp_lock.h>
-#include <linux/spinlock.h>
-#include <linux/sysdev.h>
-#include <linux/timer.h>
-#include <linux/freezer.h>
-
-#include "rtmutex.h"
-
-#define MAX_RT_TEST_THREADS 8
-#define MAX_RT_TEST_MUTEXES 8
-
-static spinlock_t rttest_lock;
-static atomic_t rttest_event;
-
-struct test_thread_data {
- int opcode;
- int opdata;
- int mutexes[MAX_RT_TEST_MUTEXES];
- int bkl;
- int event;
- struct sys_device sysdev;
-};
-
-static struct test_thread_data ...From: Ananth N Mavinakayanahalli <ananth@in.ibm.com> Move the lkdtm infrastructure to tests/ Signed-off-by: Ananth N Mavinakayanahalli <ananth@in.ibm.com> Acked-by: Ankita Garg <ankita@in.ibm.com> --- drivers/misc/lkdtm.c | 345 -------------------------------------------------- drivers/misc/Makefile | 1 lib/Kconfig.debug | 15 -- tests/Kconfig | 15 ++ tests/Makefile | 1 tests/lkdtm.c | 345 ++++++++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 361 insertions(+), 361 deletions(-) Index: linux-2.6.25-rc1/drivers/misc/Makefile =================================================================== --- linux-2.6.25-rc1.orig/drivers/misc/Makefile +++ linux-2.6.25-rc1/drivers/misc/Makefile @@ -11,7 +11,6 @@ obj-$(CONFIG_ASUS_LAPTOP) += asus-la obj-$(CONFIG_ATMEL_PWM) += atmel_pwm.o obj-$(CONFIG_ATMEL_SSC) += atmel-ssc.o obj-$(CONFIG_TC1100_WMI) += tc1100-wmi.o -obj-$(CONFIG_LKDTM) += lkdtm.o obj-$(CONFIG_TIFM_CORE) += tifm_core.o obj-$(CONFIG_TIFM_7XX1) += tifm_7xx1.o obj-$(CONFIG_PHANTOM) += phantom.o Index: linux-2.6.25-rc1/drivers/misc/lkdtm.c =================================================================== --- linux-2.6.25-rc1.orig/drivers/misc/lkdtm.c +++ /dev/null @@ -1,345 +0,0 @@ -/* - * Kprobe module for testing crash dumps - * - * 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; either version 2 of the License, or - * (at your option) any later version. - * - * 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 - * ...
From: Ananth N Mavinakayanahalli <ananth@in.ibm.com> Move kprobe smoke tests to tests/ Signed-off-by: Ananth N Mavinakayanahalli <ananth@in.ibm.com> --- kernel/test_kprobes.c | 228 -------------------------------------------------- kernel/Makefile | 1 lib/Kconfig.debug | 12 -- tests/Kconfig | 12 ++ tests/Makefile | 1 tests/test_kprobes.c | 228 ++++++++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 241 insertions(+), 241 deletions(-) Index: linux-2.6.25-rc1/kernel/Makefile =================================================================== --- linux-2.6.25-rc1.orig/kernel/Makefile +++ linux-2.6.25-rc1/kernel/Makefile @@ -47,7 +47,6 @@ obj-$(CONFIG_PID_NS) += pid_namespace.o obj-$(CONFIG_IKCONFIG) += configs.o obj-$(CONFIG_RESOURCE_COUNTERS) += res_counter.o obj-$(CONFIG_STOP_MACHINE) += stop_machine.o -obj-$(CONFIG_KPROBES_SANITY_TEST) += test_kprobes.o obj-$(CONFIG_AUDIT) += audit.o auditfilter.o obj-$(CONFIG_AUDITSYSCALL) += auditsc.o obj-$(CONFIG_AUDIT_TREE) += audit_tree.o Index: linux-2.6.25-rc1/kernel/test_kprobes.c =================================================================== --- linux-2.6.25-rc1.orig/kernel/test_kprobes.c +++ /dev/null @@ -1,228 +0,0 @@ -/* - * test_kprobes.c - simple sanity test for *probes - * - * Copyright IBM Corp. 2008 - * - * 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; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it would 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. - */ - -#include <linux/kernel.h> -#include <linux/kprobes.h> -#include <linux/random.h> - -#define div_factor 3 - -static u32 rand1, ...
From: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
Move backtrace selftests to tests/
Signed-off-by: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
---
kernel/backtracetest.c | 48 ------------------------------------------------
kernel/Makefile | 1 -
lib/Kconfig.debug | 12 ------------
tests/Kconfig | 12 ++++++++++++
tests/Makefile | 1 +
tests/backtracetest.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
6 files changed, 61 insertions(+), 61 deletions(-)
Index: linux-2.6.25-rc1/kernel/Makefile
===================================================================
--- linux-2.6.25-rc1.orig/kernel/Makefile
+++ linux-2.6.25-rc1/kernel/Makefile
@@ -35,7 +35,6 @@ obj-$(CONFIG_KALLSYMS) += kallsyms.o
obj-$(CONFIG_PM) += power/
obj-$(CONFIG_BSD_PROCESS_ACCT) += acct.o
obj-$(CONFIG_KEXEC) += kexec.o
-obj-$(CONFIG_BACKTRACE_SELF_TEST) += backtracetest.o
obj-$(CONFIG_COMPAT) += compat.o
obj-$(CONFIG_CGROUPS) += cgroup.o
obj-$(CONFIG_CGROUP_DEBUG) += cgroup_debug.o
Index: linux-2.6.25-rc1/kernel/backtracetest.c
===================================================================
--- linux-2.6.25-rc1.orig/kernel/backtracetest.c
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * 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 ...On Mon, 11 Feb 2008 16:21:45 +0530 Thanks for doing this work! Acked-by: Arjan van de Ven <arjan@linux.intel.com> -- If you want to reach me at my work email, use arjan@linux.intel.com For development, discussion and tips for power savings, visit http://www.lesswatts.org --
From: Ananth N Mavinakayanahalli <ananth@in.ibm.com> Move RODATA and NX testcases to tests/ Signed-off-by: Ananth N Mavinakayanahalli <ananth@in.ibm.com> --- arch/x86/kernel/test_nx.c | 173 ------------------------------------------ arch/x86/kernel/test_rodata.c | 86 -------------------- arch/x86/Kconfig.debug | 16 --- arch/x86/kernel/Makefile | 2 tests/Kconfig | 16 +++ tests/Makefile | 2 tests/test_nx.c | 173 ++++++++++++++++++++++++++++++++++++++++++ tests/test_rodata.c | 86 ++++++++++++++++++++ 8 files changed, 277 insertions(+), 277 deletions(-) Index: linux-2.6.25-rc1/arch/x86/Kconfig.debug =================================================================== --- linux-2.6.25-rc1.orig/arch/x86/Kconfig.debug +++ linux-2.6.25-rc1/arch/x86/Kconfig.debug @@ -64,22 +64,6 @@ config DEBUG_RODATA data. This is recommended so that we can catch kernel bugs sooner. If in doubt, say "Y". -config DEBUG_RODATA_TEST - bool "Testcase for the DEBUG_RODATA feature" - depends on DEBUG_RODATA - help - This option enables a testcase for the DEBUG_RODATA - feature as well as for the change_page_attr() infrastructure. - If in doubt, say "N" - -config DEBUG_NX_TEST - tristate "Testcase for the NX non-executable stack feature" - depends on DEBUG_KERNEL && m - help - This option enables a testcase for the CPU NX capability - and the software setup of this feature. - If in doubt, say "N" - config 4KSTACKS bool "Use 4Kb for kernel stacks instead of 8Kb" depends on DEBUG_KERNEL Index: linux-2.6.25-rc1/arch/x86/kernel/Makefile =================================================================== --- linux-2.6.25-rc1.orig/arch/x86/kernel/Makefile +++ linux-2.6.25-rc1/arch/x86/kernel/Makefile @@ -65,8 +65,6 @@ obj-$(CONFIG_HPET_TIMER) += hpet.o obj-$(CONFIG_K8_NB) += k8.o obj-$(CONFIG_MGEODE_LX) += geode_32.o mfgpt_32.o -obj-$(CONFIG_DEBUG_RODATA_TEST) += ...
i'm not sure this is the proper place for it - it's highly x86 specific. arch/x86/tests sounds like the better place for it. Ingo --
Right. I wasn't sure of it and so made these depend on CONFIG_X86. But yes, it makes more sense for them to live someplace arch specific. Ananth --
On Mon, 11 Feb 2008 16:22:29 +0530 for the NX test I can see this; for RODATA... that one is not really stand alone, but integrated with the rest of the rodata code. -- If you want to reach me at my work email, use arjan@linux.intel.com For development, discussion and tips for power savings, visit http://www.lesswatts.org --
Hi, As Linus wrote on a recent sh pull request: "Please use "git diff -M --stat --summary" to generate the diffstat: the -M enables rename detection, and the summary enables a summary of new/deleted or renamed files." --- ~Randy --
Argh, you probably didn't use git, so please ignore my comment. --- ~Randy --
ACK to patches 1-7, and I agree with Ingo that the x86-specific test should stay under arch/x86. --
On Tue, 12 Feb 2008 11:44:52 -0500 OK. But now is basically the worst time for me (or anyone else) to merge large code-motion changes like this, because they need to be carried for two months or more. And even though git can track renames, putting them into a git tree (say, git-kbuild) won't help, because if some other git tree tries to modify a file in its original place, I get to fix up the fallout. Which I _could_ do, and would do if the patches were particularly risky or added/changed functionality or whatever. But they don't do that, and there is little advantage in maintaining them for the >2 months. So. Please redo and resend the patches when we hit 2.6.25-rc6 or so? Thanks. (linux-next will largely fix all this: git will take care of the renames and I'll just base the -mm queue on the consolidated linux-next. But we aren't there yet). --
alternatively, since it's just code motion and nothing more, it could just be done in 2.6.25-rc; in fact doing motion patches in the -rc2 window makes sense to me, that's the point where all external trees are the smallest, and it should be provably the same result.. so safe. --
Hi Linus.
Will you consider such a primary code-movement for -rc1
or shall we wait until next merge window?
Had we hit -rc2 I would not have sent this pull req and
feel free to flame me anyway.
The rationale to get it merged is obviously to avoid
merge conflicts and the only reason I ask is that I consider
it a low risk patch.
I have not included 8/8 since it was questioned and it
will wait until next merge window. But the first 7 was
straightforward.
You can pull from:
ssh://master.kernel.org/pub/scm/linux/kernel/git/sam/tests.git
diffstat and shortlog below.
I also included mail last with a few of the merge related comments.
Sam
Makefile | 1 +
drivers/misc/Makefile | 1 -
kernel/Makefile | 4 -
lib/Kconfig.debug | 71 +--------------------
lib/Makefile | 1 -
tests/Kconfig | 79 +++++++++++++++++++++++
tests/Makefile | 10 +++
{kernel => tests}/backtracetest.c | 0
{drivers/misc => tests}/lkdtm.c | 12 ++--
{lib => tests}/locking-selftest-hardirq.h | 0
{lib => tests}/locking-selftest-mutex.h | 0
{lib => tests}/locking-selftest-rlock-hardirq.h | 0
{lib => tests}/locking-selftest-rlock-softirq.h | 0
{lib => tests}/locking-selftest-rlock.h | 0
{lib => tests}/locking-selftest-rsem.h | 0
{lib => tests}/locking-selftest-softirq.h | 0
{lib => tests}/locking-selftest-spin-hardirq.h | 0
{lib => tests}/locking-selftest-spin-softirq.h | 0
{lib => tests}/locking-selftest-spin.h | 0
{lib => tests}/locking-selftest-wlock-hardirq.h | 0
{lib => tests}/locking-selftest-wlock-softirq.h | 0
{lib => tests}/locking-selftest-wlock.h | 0
{lib => tests}/locking-selftest-wsem.h ...we could make it even lower risk and not move the Kconfig now. Moving the Kconfig is fine for .26; it doesn't really impact anything else --
Acked-by: Ingo Molnar <mingo@elte.hu> Ingo --
Hi Anath. Linus did not pull this in the -rc1 to -rc2 timeframe so please resubmit the patch serie one week into the next merge window (when most of the trees has hit linus' tree and Andrew has made his first merge). IF you need an extra eye balling then you can submit a few weeks before the merge window opens. Thats typical after an -rc with only a few patches. Thanks, Sam --
Isn't this set a good candidate for linux-next? If so, we could request Stephen to pull in the patchset. --
Stephen, The patchset in question is just a major code movement - basically to move all in-kernel tests to live under a toplevel tests/ directory. As such, all the stakeholders have acked the patchset, but it does look like this is a big enough change to be deferred to the next merge window. Given that there is general agreement about the patchset, could you please pull in the changes into the linux-next tree? Sam has setup a git tree for this and you can pull from: ssh://master.kernel.org/pub/scm/linux/kernel/git/sam/tests.git Link to the thread: http://lkml.org/lkml/2008/2/11/97 Thanks, --
Hi Ananth, On Fri, 22 Feb 2008 09:12:31 +0530 Ananth N Mavinakayanahalli <ananth@in.ib= I will include this in the next linux-tree. It looks like it should not cause to many problems (it merges OK on top of the about to be announce next-20080222), but if I get a hard to resolve merge problem with it, I will drop it first, OK. I have noted you as the contact. --=20 Cheers, Stephen Rothwell sfr@canb.auug.org.au
Sure! Thanks Stephen. Ananth --
