This series extends the kselftests for the vDSO library making sure: that
they compile correctly on non x86 platforms, that they can be cross
compiled and introducing new tests that verify the correctness of the
library.
The so extended vDSO kselftests have been verified on all the platforms
supported by the unified vDSO library [1].
The only new patch that this series introduces is the first one, patch 2 and
patch 3 have already been reviewed in past as part of other series [2] [3].
[1] https://lore.kernel.org/lkml/20190621095252.32307-1-vincenzo.frascino@arm.c…
[2] https://lore.kernel.org/lkml/20190621095252.32307-26-vincenzo.frascino@arm.…
[3] https://lore.kernel.org/lkml/20190523112116.19233-4-vincenzo.frascino@arm.c…
Changes:
--------
v2:
- Addressed review comments from Andy.
- Rebased on 5.7-rc3.
Cc: Shuah Khan <shuah(a)kernel.org>
Cc: Thomas Gleixner <tglx(a)linutronix.de>
Cc: Andy Lutomirski <luto(a)kernel.org>
Signed-off-by: Vincenzo Frascino <vincenzo.frascino(a)arm.com>
Vincenzo Frascino (4):
kselftest: Enable vDSO test on non x86 platforms
kselftest: Extend vDSO selftest
kselftest: Extend vDSO selftest to clock_getres
kselftest: Move test_vdso to the vDSO test suite
tools/testing/selftests/Makefile | 1 +
tools/testing/selftests/vDSO/Makefile | 16 +-
.../selftests/vDSO/vdso_clock_getres.c | 124 +++++++++
tools/testing/selftests/vDSO/vdso_config.h | 90 +++++++
.../vdso_correctness_test_x86.c} | 0
tools/testing/selftests/vDSO/vdso_full_test.c | 244 ++++++++++++++++++
tools/testing/selftests/x86/Makefile | 2 +-
7 files changed, 472 insertions(+), 5 deletions(-)
create mode 100644 tools/testing/selftests/vDSO/vdso_clock_getres.c
create mode 100644 tools/testing/selftests/vDSO/vdso_config.h
rename tools/testing/selftests/{x86/test_vdso.c => vDSO/vdso_correctness_test_x86.c} (100%)
create mode 100644 tools/testing/selftests/vDSO/vdso_full_test.c
--
2.25.2
Hi,
This patchset will try to enable as many KUnit test fragments as
possible for the current .config file.
This will make it easier for both developers that tests their specific
feature and also for test-systems that would like to get as much as
possible for their current .config file.
I will send a separate KCSAN KUnit patch after this patchset since that
isn't in mainline yet.
Since v1:
Marco commented to split up the patches, and change a "." to a ",".
Cheers,
Anders
Anders Roxell (6):
kunit: Kconfig: enable a KUNIT_RUN_ALL fragment
kunit: default KUNIT_* fragments to KUNIT_RUN_ALL
lib: Kconfig.debug: default KUNIT_* fragments to KUNIT_RUN_ALL
drivers: base: default KUNIT_* fragments to KUNIT_RUN_ALL
fs: ext4: default KUNIT_* fragments to KUNIT_RUN_ALL
security: apparmor: default KUNIT_* fragments to KUNIT_RUN_ALL
drivers/base/Kconfig | 3 ++-
drivers/base/test/Kconfig | 3 ++-
fs/ext4/Kconfig | 3 ++-
lib/Kconfig.debug | 6 ++++--
lib/kunit/Kconfig | 15 ++++++++++++---
security/apparmor/Kconfig | 3 ++-
6 files changed, 24 insertions(+), 9 deletions(-)
--
2.20.1
Make it easier to enable all KUnit fragments. This is needed for kernel
test-systems, so its easy to get all KUnit tests enabled and if new gets
added they will be enabled as well. Fragments that has to be builtin
will be missed if CONFIG_KUNIT_RUN_ALL is set as a module.
Adding 'if !KUNIT_RUN_ALL' so individual test can be turned of if
someone wants that even though KUNIT_RUN_ALL is enabled.
Signed-off-by: Anders Roxell <anders.roxell(a)linaro.org>
---
drivers/base/Kconfig | 3 ++-
drivers/base/test/Kconfig | 3 ++-
fs/ext4/Kconfig | 3 ++-
lib/Kconfig.debug | 6 ++++--
lib/Kconfig.kcsan | 3 ++-
lib/kunit/Kconfig | 15 ++++++++++++---
security/apparmor/Kconfig | 3 ++-
7 files changed, 26 insertions(+), 10 deletions(-)
diff --git a/drivers/base/Kconfig b/drivers/base/Kconfig
index 5f0bc74d2409..c48e6e4ef367 100644
--- a/drivers/base/Kconfig
+++ b/drivers/base/Kconfig
@@ -149,8 +149,9 @@ config DEBUG_TEST_DRIVER_REMOVE
test this functionality.
config PM_QOS_KUNIT_TEST
- bool "KUnit Test for PM QoS features"
+ bool "KUnit Test for PM QoS features" if !KUNIT_RUN_ALL
depends on KUNIT=y
+ default KUNIT_RUN_ALL
config HMEM_REPORTING
bool
diff --git a/drivers/base/test/Kconfig b/drivers/base/test/Kconfig
index 305c7751184a..0d662d689f6b 100644
--- a/drivers/base/test/Kconfig
+++ b/drivers/base/test/Kconfig
@@ -9,5 +9,6 @@ config TEST_ASYNC_DRIVER_PROBE
If unsure say N.
config KUNIT_DRIVER_PE_TEST
- bool "KUnit Tests for property entry API"
+ bool "KUnit Tests for property entry API" if !KUNIT_RUN_ALL
depends on KUNIT=y
+ default KUNIT_RUN_ALL
diff --git a/fs/ext4/Kconfig b/fs/ext4/Kconfig
index 2a592e38cdfe..76785143259d 100644
--- a/fs/ext4/Kconfig
+++ b/fs/ext4/Kconfig
@@ -103,9 +103,10 @@ config EXT4_DEBUG
echo 1 > /sys/module/ext4/parameters/mballoc_debug
config EXT4_KUNIT_TESTS
- tristate "KUnit tests for ext4"
+ tristate "KUnit tests for ext4" if !KUNIT_RUN_ALL
select EXT4_FS
depends on KUNIT
+ default KUNIT_RUN_ALL
help
This builds the ext4 KUnit tests.
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index 8e4aded46281..993e0c5549bc 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -2123,8 +2123,9 @@ config TEST_SYSCTL
If unsure, say N.
config SYSCTL_KUNIT_TEST
- tristate "KUnit test for sysctl"
+ tristate "KUnit test for sysctl" if !KUNIT_RUN_ALL
depends on KUNIT
+ default KUNIT_RUN_ALL
help
This builds the proc sysctl unit test, which runs on boot.
Tests the API contract and implementation correctness of sysctl.
@@ -2134,8 +2135,9 @@ config SYSCTL_KUNIT_TEST
If unsure, say N.
config LIST_KUNIT_TEST
- tristate "KUnit Test for Kernel Linked-list structures"
+ tristate "KUnit Test for Kernel Linked-list structures" if !KUNIT_RUN_ALL
depends on KUNIT
+ default KUNIT_RUN_ALL
help
This builds the linked list KUnit test suite.
It tests that the API and basic functionality of the list_head type
diff --git a/lib/Kconfig.kcsan b/lib/Kconfig.kcsan
index ea28245c6c1d..91398300a1bc 100644
--- a/lib/Kconfig.kcsan
+++ b/lib/Kconfig.kcsan
@@ -46,8 +46,9 @@ config KCSAN_SELFTEST
works as intended.
config KCSAN_TEST
- tristate "KCSAN test for integrated runtime behaviour"
+ tristate "KCSAN test for integrated runtime behaviour" if !KUNIT_RUN_ALL
depends on TRACEPOINTS && KUNIT
+ default KUNIT_RUN_ALL
select TORTURE_TEST
help
KCSAN test focusing on behaviour of the integrated runtime. Tests
diff --git a/lib/kunit/Kconfig b/lib/kunit/Kconfig
index 95d12e3d6d95..d6a912779816 100644
--- a/lib/kunit/Kconfig
+++ b/lib/kunit/Kconfig
@@ -15,7 +15,8 @@ menuconfig KUNIT
if KUNIT
config KUNIT_DEBUGFS
- bool "KUnit - Enable /sys/kernel/debug/kunit debugfs representation"
+ bool "KUnit - Enable /sys/kernel/debug/kunit debugfs representation" if !KUNIT_RUN_ALL
+ default KUNIT_RUN_ALL
help
Enable debugfs representation for kunit. Currently this consists
of /sys/kernel/debug/kunit/<test_suite>/results files for each
@@ -23,7 +24,8 @@ config KUNIT_DEBUGFS
run that occurred.
config KUNIT_TEST
- tristate "KUnit test for KUnit"
+ tristate "KUnit test for KUnit" if !KUNIT_RUN_ALL
+ default KUNIT_RUN_ALL
help
Enables the unit tests for the KUnit test framework. These tests test
the KUnit test framework itself; the tests are both written using
@@ -32,7 +34,8 @@ config KUNIT_TEST
expected.
config KUNIT_EXAMPLE_TEST
- tristate "Example test for KUnit"
+ tristate "Example test for KUnit" if !KUNIT_RUN_ALL
+ default KUNIT_RUN_ALL
help
Enables an example unit test that illustrates some of the basic
features of KUnit. This test only exists to help new users understand
@@ -41,4 +44,10 @@ config KUNIT_EXAMPLE_TEST
is intended for curious hackers who would like to understand how to
use KUnit for kernel development.
+config KUNIT_RUN_ALL
+ tristate "KUnit run all test"
+ help
+ Enables all KUnit tests. If they can be enabled.
+ That depends on if KUnit is enabled as a module or builtin.
+
endif # KUNIT
diff --git a/security/apparmor/Kconfig b/security/apparmor/Kconfig
index 0fe336860773..c4648426ea5d 100644
--- a/security/apparmor/Kconfig
+++ b/security/apparmor/Kconfig
@@ -70,8 +70,9 @@ config SECURITY_APPARMOR_DEBUG_MESSAGES
the kernel message buffer.
config SECURITY_APPARMOR_KUNIT_TEST
- bool "Build KUnit tests for policy_unpack.c"
+ bool "Build KUnit tests for policy_unpack.c" if !KUNIT_RUN_ALL
depends on KUNIT=y && SECURITY_APPARMOR
+ default KUNIT_RUN_ALL
help
This builds the AppArmor KUnit tests.
--
2.20.1
When the required module for the test does not exist, use
exit_unsupported instead of exit_unresolved to indicate this test is
not supported.
By doing this we can make test behaviour in sync with the
irqsoff_tracer.tc test in preemptirq, which is also treating module
existence in this way. Moreover, the test won't exit with a non-zero
return value if the module does not exist.
Fixes: 646f01ccdd59 ("ftrace/selftest: Add tests to test register_ftrace_direct()")
Fixes: 4d23e9b4fd2e ("selftests/ftrace: Add trace_printk sample module test")
Fixes: 7bc026d6c032 ("selftests/ftrace: Add function filter on module testcase")
Fixes: af2a0750f374 ("selftests/ftrace: Improve kprobe on module testcase to load/unload module")
Signed-off-by: Po-Hsu Lin <po-hsu.lin(a)canonical.com>
---
tools/testing/selftests/ftrace/test.d/direct/ftrace-direct.tc | 2 +-
tools/testing/selftests/ftrace/test.d/direct/kprobe-direct.tc | 2 +-
tools/testing/selftests/ftrace/test.d/event/trace_printk.tc | 2 +-
tools/testing/selftests/ftrace/test.d/ftrace/func_mod_trace.tc | 2 +-
tools/testing/selftests/ftrace/test.d/kprobe/kprobe_module.tc | 2 +-
5 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/tools/testing/selftests/ftrace/test.d/direct/ftrace-direct.tc b/tools/testing/selftests/ftrace/test.d/direct/ftrace-direct.tc
index d75a869..3d6189e 100644
--- a/tools/testing/selftests/ftrace/test.d/direct/ftrace-direct.tc
+++ b/tools/testing/selftests/ftrace/test.d/direct/ftrace-direct.tc
@@ -5,7 +5,7 @@
rmmod ftrace-direct ||:
if ! modprobe ftrace-direct ; then
echo "No ftrace-direct sample module - please make CONFIG_SAMPLE_FTRACE_DIRECT=m"
- exit_unresolved;
+ exit_unsupported;
fi
echo "Let the module run a little"
diff --git a/tools/testing/selftests/ftrace/test.d/direct/kprobe-direct.tc b/tools/testing/selftests/ftrace/test.d/direct/kprobe-direct.tc
index 801ecb6..3d0e3ca 100644
--- a/tools/testing/selftests/ftrace/test.d/direct/kprobe-direct.tc
+++ b/tools/testing/selftests/ftrace/test.d/direct/kprobe-direct.tc
@@ -5,7 +5,7 @@
rmmod ftrace-direct ||:
if ! modprobe ftrace-direct ; then
echo "No ftrace-direct sample module - please build with CONFIG_SAMPLE_FTRACE_DIRECT=m"
- exit_unresolved;
+ exit_unsupported;
fi
if [ ! -f kprobe_events ]; then
diff --git a/tools/testing/selftests/ftrace/test.d/event/trace_printk.tc b/tools/testing/selftests/ftrace/test.d/event/trace_printk.tc
index b02550b..dd8b10d 100644
--- a/tools/testing/selftests/ftrace/test.d/event/trace_printk.tc
+++ b/tools/testing/selftests/ftrace/test.d/event/trace_printk.tc
@@ -5,7 +5,7 @@
rmmod trace-printk ||:
if ! modprobe trace-printk ; then
echo "No trace-printk sample module - please make CONFIG_SAMPLE_TRACE_PRINTK=m"
- exit_unresolved;
+ exit_unsupported;
fi
echo "Waiting for irq work"
diff --git a/tools/testing/selftests/ftrace/test.d/ftrace/func_mod_trace.tc b/tools/testing/selftests/ftrace/test.d/ftrace/func_mod_trace.tc
index 1a4b4a4..26dc06a 100644
--- a/tools/testing/selftests/ftrace/test.d/ftrace/func_mod_trace.tc
+++ b/tools/testing/selftests/ftrace/test.d/ftrace/func_mod_trace.tc
@@ -13,7 +13,7 @@ echo '*:mod:trace_printk' > set_ftrace_filter
if ! modprobe trace-printk ; then
echo "No trace-printk sample module - please make CONFIG_SAMPLE_TRACE_PRINTK=
m"
- exit_unresolved;
+ exit_unsupported;
fi
: "Wildcard should be resolved after loading module"
diff --git a/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_module.tc b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_module.tc
index d861bd7..4e07c69 100644
--- a/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_module.tc
+++ b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_module.tc
@@ -8,7 +8,7 @@ rmmod trace-printk ||:
if ! modprobe trace-printk ; then
echo "No trace-printk sample module - please make CONFIG_SAMPLE_TRACE_PRINTK=
m"
- exit_unresolved;
+ exit_unsupported;
fi
MOD=trace_printk
--
2.7.4
When running the ftrace selftests, 2 failures and 6 unresolved
cases were observed. The failures can be avoided by setting
a sysctl prior to test execution (fixed in patch 1) and by
having unresolved cases not return 0 from ftracetest by default
since they indicate an absence of testing modules/programs
rather than ftrace issues (patch 2).
The latter are classified as "unresolved" tests, which operate
differently from "unsupported" tests. For unsupported tests,
we note the unsupported count but do not consider the tests
as having failed, whereas with unresolved the test run is
considered to have failed so returns "not ok" when run via
kselftest ("make -C tools/testing/selftest/ftrace run_tests").
Patch 2 aligns the unresolved behaviour with the unsupported;
by default, unresolved outcomes do not trigger overall failure,
but they can if --fail-unresolved is specified.
Changes since v1:
- updated patch 1 to use /proc path instead of sysctl (Masami)
- updated patch 2 to modify unresolved handling in ftracetest
rather than change individual unresolved -> unsupported (Masami)
Alan Maguire (2):
ftrace/selftests: workaround cgroup RT scheduling issues
ftrace/selftest: make unresolved cases cause failure if
--fail-unresolved set
tools/testing/selftests/ftrace/ftracetest | 30 +++++++++++++++++++++++++++++-
1 file changed, 29 insertions(+), 1 deletion(-)
--
1.8.3.1
Problem: Many skips while running kselftest
example: skip to all lkdtm tests ie 70 off 70 skips.
Steps I follow while running kselftest:
1.I downloaded kernel from kernel.org and extracted it.
2.As per the kselftest executing steps, I execute the tests.
I get lots of skips.
So my question's are:
1.Am I going wrong somewhere while running test?
2.Is there any need to configure the kernel in such a way that it can
execute the tests?
Example: enabling debug filesystem in kernel configuration for debugging.
Thankyou.
Hi Shuah,
Hope you're happy with this version that I only touch KVM's Makefile.
I attempted to build KVM selftests on a specified dir, unfortunately
neither "make O=/path/to/mydir TARGETS=kvm" in tools/testing/selftests, nor
"make OUTPUT=/path/to/mydir" in tools/testing/selftests/kvm work.
This series aims to fix them.
Patch 1 and Patch 3 are the fix patch, please see the seperate for details.
While Patch 2 is more or less an fix for the future issue, since it works
without Patch 2 currently.
Changes in v3:
- Drop all the patches that touch things out of KVM
- Create OUTPUT dir in KVM's Makefile
- Correct the INSTALL_HDR_PATH in KVM's Makefile
Changes in v2:
https://lore.kernel.org/kvm/20200325140133.103236-1-xiaoyao.li@intel.com/
- fix the no directory issue in lib.mk
- make kvm fixes seperate patch
- Add the patch to fix linux src tree not clean issue
v1:
https://lore.kernel.org/kvm/20200315093425.33600-1-xiaoyao.li@intel.com/
Xiaoyao Li (3):
kvm: selftests: Fix no directory error when OUTPUT specified
kvm: selftests: Use the right INSTALL_HDR_PATH when OUTPUT specified
and MAKELEVEL is 0
kvm: selftests: Fix header path when built from parent level with O
specified
tools/testing/selftests/kvm/Makefile | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
--
2.20.1
From: Vincent Cheng <vincent.cheng.xh(a)renesas.com>
This series adds adjust phase to the PTP Hardware Clock device interface.
Some PTP hardware clocks have a write phase mode that has
a built-in hardware filtering capability. The write phase mode
utilizes a phase offset control word instead of a frequency offset
control word. Add adjust phase function to take advantage of this
capability.
Vincent Cheng (3):
ptp: Add adjphase function to support phase offset control.
ptp: Add adjust_phase to ptp_clock_caps capability.
ptp: ptp_clockmatrix: Add adjphase() to support PHC write phase mode.
drivers/ptp/ptp_chardev.c | 1 +
drivers/ptp/ptp_clock.c | 2 +
drivers/ptp/ptp_clockmatrix.c | 123 ++++++++++++++++++++++++++++++++++
drivers/ptp/ptp_clockmatrix.h | 11 ++-
include/linux/ptp_clock_kernel.h | 6 +-
include/uapi/linux/ptp_clock.h | 4 +-
tools/testing/selftests/ptp/testptp.c | 6 +-
7 files changed, 147 insertions(+), 6 deletions(-)
--
2.7.4