2015-11-17 14:34:34

by Bamvor Zhang Jian

[permalink] [raw]
Subject: [PATCH V2 0/2] Create specific kconfig for kselftest

There is a discussion about improving the usability of kselftest by
creating test-specific kconfig in recent kernel Summit. Furthormore,
there are different approaches to do it:

1) keep test-specific kconfig fragments inside each selftest so that
merge_configs.sh could build up a kernel that can test the specific
or all feature(s).

2) In the main menu, have an additional option/flag for each feature
that should be enabled when ksefltests are wanted. Similar to the
CONFIG_COMPILE_TEST flag.

Patch 1/2: do option 1. Hope it is a good start for discussion.

Patch 2/2: add config option(kselftest-mergeconfig) in make file as a
helper to merge all the test config dependecies to .config.

Changes since v1[1]:
1. Add kselftest-mergeconfig in scripts/kconfig/Makefile according
to the suggestion from Michael.

[1] http://www.spinics.net/lists/linux-api/msg15533.html

Bamvor Jian Zhang (2):
selftests: create test-specific kconfig fragments
scripts/kconfig/Makefile: add kselftest-mergeconfig

scripts/kconfig/Makefile | 9 +++++++++
tools/testing/selftests/cpu-hotplug/config | 2 ++
tools/testing/selftests/firmware/config | 1 +
tools/testing/selftests/ftrace/config | 1 +
tools/testing/selftests/ipc/config | 2 ++
tools/testing/selftests/memory-hotplug/config | 4 ++++
tools/testing/selftests/mount/config | 2 ++
tools/testing/selftests/net/config | 3 +++
tools/testing/selftests/pstore/config | 4 ++++
tools/testing/selftests/seccomp/config | 2 ++
tools/testing/selftests/static_keys/config | 1 +
tools/testing/selftests/user/config | 1 +
tools/testing/selftests/vm/config | 1 +
tools/testing/selftests/zram/config | 2 ++
14 files changed, 35 insertions(+)
create mode 100644 tools/testing/selftests/cpu-hotplug/config
create mode 100644 tools/testing/selftests/firmware/config
create mode 100644 tools/testing/selftests/ftrace/config
create mode 100644 tools/testing/selftests/ipc/config
create mode 100644 tools/testing/selftests/memory-hotplug/config
create mode 100644 tools/testing/selftests/mount/config
create mode 100644 tools/testing/selftests/net/config
create mode 100644 tools/testing/selftests/pstore/config
create mode 100644 tools/testing/selftests/seccomp/config
create mode 100644 tools/testing/selftests/static_keys/config
create mode 100644 tools/testing/selftests/user/config
create mode 100644 tools/testing/selftests/vm/config
create mode 100644 tools/testing/selftests/zram/config

--
1.8.4.5


2015-11-17 14:34:38

by Bamvor Zhang Jian

[permalink] [raw]
Subject: [PATCH V2 1/2] selftests: create test-specific kconfig fragments

Create the config file in each directory of testcase which need
more kernel configuration than the default defconfig. User could
use these configs with merge_config.sh script:

Enable config for specific testcases:
(export ARCH=xxx #for cross compiling)
./scripts/kconfig/merge_config.sh .config \
tools/testing/selftests/xxx/config

Enable configs for all testcases:
(export ARCH=xxx #for cross compiling)
./scripts/kconfig/merge_config.sh .config \
tools/testing/selftests/*/config

Signed-off-by: Bamvor Jian Zhang <[email protected]>
---
tools/testing/selftests/cpu-hotplug/config | 2 ++
tools/testing/selftests/firmware/config | 1 +
tools/testing/selftests/ftrace/config | 1 +
tools/testing/selftests/ipc/config | 2 ++
tools/testing/selftests/memory-hotplug/config | 4 ++++
tools/testing/selftests/mount/config | 2 ++
tools/testing/selftests/net/config | 3 +++
tools/testing/selftests/pstore/config | 4 ++++
tools/testing/selftests/seccomp/config | 2 ++
tools/testing/selftests/static_keys/config | 1 +
tools/testing/selftests/user/config | 1 +
tools/testing/selftests/vm/config | 1 +
tools/testing/selftests/zram/config | 2 ++
13 files changed, 26 insertions(+)
create mode 100644 tools/testing/selftests/cpu-hotplug/config
create mode 100644 tools/testing/selftests/firmware/config
create mode 100644 tools/testing/selftests/ftrace/config
create mode 100644 tools/testing/selftests/ipc/config
create mode 100644 tools/testing/selftests/memory-hotplug/config
create mode 100644 tools/testing/selftests/mount/config
create mode 100644 tools/testing/selftests/net/config
create mode 100644 tools/testing/selftests/pstore/config
create mode 100644 tools/testing/selftests/seccomp/config
create mode 100644 tools/testing/selftests/static_keys/config
create mode 100644 tools/testing/selftests/user/config
create mode 100644 tools/testing/selftests/vm/config
create mode 100644 tools/testing/selftests/zram/config

diff --git a/tools/testing/selftests/cpu-hotplug/config b/tools/testing/selftests/cpu-hotplug/config
new file mode 100644
index 0000000..e6ab090
--- /dev/null
+++ b/tools/testing/selftests/cpu-hotplug/config
@@ -0,0 +1,2 @@
+CONFIG_NOTIFIER_ERROR_INJECTION=y
+CONFIG_CPU_NOTIFIER_ERROR_INJECT=m
diff --git a/tools/testing/selftests/firmware/config b/tools/testing/selftests/firmware/config
new file mode 100644
index 0000000..c8137f7
--- /dev/null
+++ b/tools/testing/selftests/firmware/config
@@ -0,0 +1 @@
+CONFIG_TEST_FIRMWARE=y
diff --git a/tools/testing/selftests/ftrace/config b/tools/testing/selftests/ftrace/config
new file mode 100644
index 0000000..ef82146
--- /dev/null
+++ b/tools/testing/selftests/ftrace/config
@@ -0,0 +1 @@
+CONFIG_FTRACE=y
diff --git a/tools/testing/selftests/ipc/config b/tools/testing/selftests/ipc/config
new file mode 100644
index 0000000..0702447
--- /dev/null
+++ b/tools/testing/selftests/ipc/config
@@ -0,0 +1,2 @@
+CONFIG_EXPERT=y
+CONFIG_CHECKPOINT_RESTORE=y
diff --git a/tools/testing/selftests/memory-hotplug/config b/tools/testing/selftests/memory-hotplug/config
new file mode 100644
index 0000000..2fde301
--- /dev/null
+++ b/tools/testing/selftests/memory-hotplug/config
@@ -0,0 +1,4 @@
+CONFIG_MEMORY_HOTPLUG=y
+CONFIG_MEMORY_HOTPLUG_SPARSE=y
+CONFIG_NOTIFIER_ERROR_INJECTION=y
+CONFIG_MEMORY_NOTIFIER_ERROR_INJECT=m
diff --git a/tools/testing/selftests/mount/config b/tools/testing/selftests/mount/config
new file mode 100644
index 0000000..b5d881e
--- /dev/null
+++ b/tools/testing/selftests/mount/config
@@ -0,0 +1,2 @@
+CONFIG_USER_NS=y
+CONFIG_DEVPTS_MULTIPLE_INSTANCES=y
diff --git a/tools/testing/selftests/net/config b/tools/testing/selftests/net/config
new file mode 100644
index 0000000..e57b4ac
--- /dev/null
+++ b/tools/testing/selftests/net/config
@@ -0,0 +1,3 @@
+CONFIG_USER_NS=y
+CONFIG_BPF_SYSCALL=y
+CONFIG_TEST_BPF=m
diff --git a/tools/testing/selftests/pstore/config b/tools/testing/selftests/pstore/config
new file mode 100644
index 0000000..6a8e5a9
--- /dev/null
+++ b/tools/testing/selftests/pstore/config
@@ -0,0 +1,4 @@
+CONFIG_MISC_FILESYSTEMS=y
+CONFIG_PSTORE=y
+CONFIG_PSTORE_PMSG=y
+CONFIG_PSTORE_CONSOLE=y
diff --git a/tools/testing/selftests/seccomp/config b/tools/testing/selftests/seccomp/config
new file mode 100644
index 0000000..db1e11b
--- /dev/null
+++ b/tools/testing/selftests/seccomp/config
@@ -0,0 +1,2 @@
+CONFIG_SECCOMP=y
+CONFIG_SECCOMP_FILTER=y
diff --git a/tools/testing/selftests/static_keys/config b/tools/testing/selftests/static_keys/config
new file mode 100644
index 0000000..d538fb7
--- /dev/null
+++ b/tools/testing/selftests/static_keys/config
@@ -0,0 +1 @@
+CONFIG_TEST_STATIC_KEYS=m
diff --git a/tools/testing/selftests/user/config b/tools/testing/selftests/user/config
new file mode 100644
index 0000000..784ed84
--- /dev/null
+++ b/tools/testing/selftests/user/config
@@ -0,0 +1 @@
+CONFIG_TEST_USER_COPY=m
diff --git a/tools/testing/selftests/vm/config b/tools/testing/selftests/vm/config
new file mode 100644
index 0000000..698c7ed
--- /dev/null
+++ b/tools/testing/selftests/vm/config
@@ -0,0 +1 @@
+CONFIG_USERFAULTFD=y
diff --git a/tools/testing/selftests/zram/config b/tools/testing/selftests/zram/config
new file mode 100644
index 0000000..e0cc47e
--- /dev/null
+++ b/tools/testing/selftests/zram/config
@@ -0,0 +1,2 @@
+CONFIG_ZSMALLOC=y
+CONFIG_ZRAM=m
--
1.8.4.5

2015-11-17 14:34:45

by Bamvor Zhang Jian

[permalink] [raw]
Subject: [PATCH V2 2/2] scripts/kconfig/Makefile: add kselftest-mergeconfig

Add kselftest-mergeconfig to enable the dependencies of kernel
config for all the kselftest testcases. User could call it after
create the kernel configuration(.config), eg:

$ make kselftest-mergeconfig

Signed-off-by: Bamvor Jian Zhang <[email protected]>
---
scripts/kconfig/Makefile | 9 +++++++++
1 file changed, 9 insertions(+)

diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile
index d79cba4..5896092 100644
--- a/scripts/kconfig/Makefile
+++ b/scripts/kconfig/Makefile
@@ -126,6 +126,14 @@ PHONY += tinyconfig
tinyconfig:
$(Q)$(MAKE) -f $(srctree)/Makefile allnoconfig tiny.config

+PHONY += kselftest-mergeconfig
+kselftest-mergeconfig: $(obj)/conf
+ $(if $(wildcard $(srctree)/.config),, $(error No .config exists, config your kernel first!))
+ $(Q)$(CONFIG_SHELL) $(srctree)/scripts/kconfig/merge_config.sh \
+ -m -O $(objtree) $(srctree)/.config \
+ $(srctree)/tools/testing/selftests/*/config
+ +$(Q)$(MAKE) -f $(srctree)/Makefile olddefconfig
+
# Help text used by make help
help:
@echo ' config - Update current config utilising a line-oriented program'
@@ -151,6 +159,7 @@ help:
@echo ' kvmconfig - Enable additional options for kvm guest kernel support'
@echo ' xenconfig - Enable additional options for xen dom0 and guest kernel support'
@echo ' tinyconfig - Configure the tiniest possible kernel'
+ @echo ' kselftest-mergeconfig - Merge all the config dependencies of kselftest to .config'

# lxdialog stuff
check-lxdialog := $(srctree)/$(src)/lxdialog/check-lxdialog.sh
--
1.8.4.5

2015-11-23 20:35:52

by Shuah Khan

[permalink] [raw]
Subject: Re: [PATCH V2 0/2] Create specific kconfig for kselftest

On 11/17/2015 07:34 AM, Bamvor Jian Zhang wrote:
> There is a discussion about improving the usability of kselftest by
> creating test-specific kconfig in recent kernel Summit. Furthormore,
> there are different approaches to do it:
>
> 1) keep test-specific kconfig fragments inside each selftest so that
> merge_configs.sh could build up a kernel that can test the specific
> or all feature(s).
>
> 2) In the main menu, have an additional option/flag for each feature
> that should be enabled when ksefltests are wanted. Similar to the
> CONFIG_COMPILE_TEST flag.
>
> Patch 1/2: do option 1. Hope it is a good start for discussion.
>
> Patch 2/2: add config option(kselftest-mergeconfig) in make file as a
> helper to merge all the test config dependecies to .config.
>
> Changes since v1[1]:
> 1. Add kselftest-mergeconfig in scripts/kconfig/Makefile according
> to the suggestion from Michael.
>
> [1] http://www.spinics.net/lists/linux-api/msg15533.html
>
> Bamvor Jian Zhang (2):
> selftests: create test-specific kconfig fragments
> scripts/kconfig/Makefile: add kselftest-mergeconfig
>

Both patches applied to linux-kseltftest next for 4.5-rc1

thanks,
-- Shuah

Shuah Khan
Sr. Linux Kernel Developer
Open Source Innovation Group
Samsung Research America (Silicon Valley)
[email protected] | (970) 217-8978