This patch series makes two changes to how KUnit test suites are stored
and executed:
- The .kunit_test_suites section is now used for tests in modules (in
lieu of a module_init funciton), as well as for built-in tests. The
module loader will now trigger test execution. This frees up the
module_init function for other uses.
- Instead of storing an array of arrays of suites, have the
kunit_test_suite() and kunit_test_suites() macros append to one global
(or per-module) list of test suites. This removes a needless layer of
indirection, and removes the need to NULL-terminate suite_sets.
The upshot of this is that it should now be possible to use the
kunit_test_suite() and kunit_test_suites() macros to register test
suites even from within modules which otherwise had module_init
functions. This was proving to be quite a common issue, resulting in
several modules calling into KUnit's private suite execution functions
to run their tests (often introducing incompatibilities with the KUnit
tooling).
This series also fixes the thunderbolt, nitro_enclaves, and
sdhci-of-aspeed tests to use kunit_test_suite() now that it works. This
is required, as otherwise the first two patches may break these tests
entirely.
Huge thanks to Jeremy Kerr, who designed and implemented the module
loader changes, and to Daniel Latypov for pushing the simplification of
the nested arrays in .kunit_test_suites.
I've tested this series both with builtin tests, and with modules on
x86_64, but there's always the possibility that there's something subtle
and nasty on another architecture, so please test!
Cheers,
-- David
Changes since v1:
https://lore.kernel.org/linux-kselftest/20220618090310.1174932-1-davidgow@g…
- Fix a compile issue when CONFIG_KUNIT=m (Thanks Christophe)
- No longer NULL-terminate suite_sets.
- Move the thunderbird Kconfig to the correct patch (Thanks Andra)
- Add all the Tested-by and Acked-by tags.
---
Daniel Latypov (1):
kunit: flatten kunit_suite*** to kunit_suite** in .kunit_test_suites
David Gow (3):
thunderbolt: test: Use kunit_test_suite() macro
nitro_enclaves: test: Use kunit_test_suite() macro
mmc: sdhci-of-aspeed: test: Use kunit_test_suite() macro
Jeremy Kerr (1):
kunit: unify module and builtin suite definitions
drivers/mmc/host/Kconfig | 5 +-
drivers/mmc/host/sdhci-of-aspeed-test.c | 8 +-
drivers/mmc/host/sdhci-of-aspeed.c | 27 ----
drivers/thunderbolt/Kconfig | 5 +-
drivers/thunderbolt/domain.c | 3 -
drivers/thunderbolt/tb.h | 8 -
drivers/thunderbolt/test.c | 12 +-
drivers/virt/nitro_enclaves/Kconfig | 5 +-
drivers/virt/nitro_enclaves/ne_misc_dev.c | 27 ----
.../virt/nitro_enclaves/ne_misc_dev_test.c | 5 +-
include/kunit/test.h | 60 ++------
include/linux/module.h | 5 +
kernel/module/main.c | 6 +
lib/kunit/executor.c | 115 ++++----------
lib/kunit/executor_test.c | 144 +++++-------------
lib/kunit/test.c | 54 ++++++-
16 files changed, 152 insertions(+), 337 deletions(-)
--
2.37.0.rc0.104.g0611611a94-goog
Hardware would directly write x2APIC ICR register instead of software
emulation in some circumstances, e.g when Intel IPI virtualization is
enabled. This behavior requires normal reserved bits checking to ensure
them input as zero, otherwise it will cause #GP. So we need mask out
those reserved bits from the data written to vICR register.
Remove Delivery Status bit emulation in test case as this flag
is invalid and not needed in x2APIC mode. KVM may ignore clearing
it during interrupt dispatch which will lead to fake test failure.
Opportunstically correct vector number for test sending IPI to
non-existent vCPUs.
Signed-off-by: Zeng Guang <guang.zeng(a)intel.com>
---
.../selftests/kvm/x86_64/xapic_state_test.c | 20 ++++++++++++++++---
1 file changed, 17 insertions(+), 3 deletions(-)
diff --git a/tools/testing/selftests/kvm/x86_64/xapic_state_test.c b/tools/testing/selftests/kvm/x86_64/xapic_state_test.c
index 0792334ba243..062d2e1adeb7 100644
--- a/tools/testing/selftests/kvm/x86_64/xapic_state_test.c
+++ b/tools/testing/selftests/kvm/x86_64/xapic_state_test.c
@@ -70,13 +70,27 @@ static void ____test_icr(struct kvm_vm *vm, struct kvm_vcpu *vcpu, uint64_t val)
vcpu_ioctl(vm, vcpu->id, KVM_GET_LAPIC, &xapic);
icr = (u64)(*((u32 *)&xapic.regs[APIC_ICR])) |
(u64)(*((u32 *)&xapic.regs[APIC_ICR2])) << 32;
- if (!vcpu->is_x2apic)
+ if (!vcpu->is_x2apic) {
val &= (-1u | (0xffull << (32 + 24)));
- ASSERT_EQ(icr, val & ~APIC_ICR_BUSY);
+ ASSERT_EQ(icr, val & ~APIC_ICR_BUSY);
+ } else {
+ ASSERT_EQ(icr, val);
+ }
}
+#define X2APIC_RSVED_BITS_MASK (GENMASK_ULL(31,20) | \
+ GENMASK_ULL(17,16) | \
+ GENMASK_ULL(13,13))
+
static void __test_icr(struct kvm_vm *vm, struct kvm_vcpu *vcpu, uint64_t val)
{
+ if (vcpu->is_x2apic) {
+ /* Hardware writing vICR register requires reserved bits 31:20,
+ * 17:16 and 13 kept as zero to avoid #GP exception. Data value
+ * written to vICR should mask out those bits above.
+ */
+ val &= ~X2APIC_RSVED_BITS_MASK;
+ }
____test_icr(vm, vcpu, val | APIC_ICR_BUSY);
____test_icr(vm, vcpu, val & ~(u64)APIC_ICR_BUSY);
}
@@ -100,7 +114,7 @@ static void test_icr(struct kvm_vm *vm, struct kvm_vcpu *vcpu)
icr = APIC_INT_ASSERT | 0xff;
for (i = vcpu->id + 1; i < 0xff; i++) {
for (j = 0; j < 8; j++)
- __test_icr(vm, vcpu, i << (32 + 24) | APIC_INT_ASSERT | (j << 8));
+ __test_icr(vm, vcpu, i << (32 + 24) | icr | (j << 8));
}
/* And again with a shorthand destination for all types of IPIs. */
--
2.27.0
Dzień dobry,
jakiś czas temu zgłosiła się do nas firma, której strona internetowa nie pozycjonowała się wysoko w wyszukiwarce Google.
Na podstawie wykonanego przez nas audytu SEO zoptymalizowaliśmy treści na stronie pod kątem wcześniej opracowanych słów kluczowych. Nasz wewnętrzny system codziennie analizuje prawidłowe działanie witryny. Dzięki indywidualnej strategii, firma zdobywa coraz więcej Klientów.
Czy chcieliby Państwo zwiększyć liczbę osób odwiedzających stronę internetową firmy? Mógłbym przedstawić ofertę?
Pozdrawiam serdecznie,
Wiktor Zielonko
Add a colon in the "Optional" test usage message to ensure consistency
with the "Default" test usage message.
Signed-off-by: Gautam Menghani <gautammenghani201(a)gmail.com>
---
tools/testing/selftests/kselftest_deps.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/testing/selftests/kselftest_deps.sh b/tools/testing/selftests/kselftest_deps.sh
index 00e60d6eb16b..708cb5429633 100755
--- a/tools/testing/selftests/kselftest_deps.sh
+++ b/tools/testing/selftests/kselftest_deps.sh
@@ -26,7 +26,7 @@ echo " main Makefile when optional -p is specified."
echo "- Prints pass/fail dependency check for each tests/sub-test."
echo "- Prints pass/fail targets and libraries."
echo "- Default: runs dependency checks on all tests."
-echo "- Optional test name can be specified to check dependencies for it."
+echo "- Optional: test name can be specified to check dependencies for it."
exit 1
}
--
2.34.1
Hi Linus,
Please pull the following Kselftest fixes update for Linux 5.19-rc4
This Kselftest fixes update for Linux 5.19-rc4 consists of compile
time fixes and run-time resources leaks.
-- Fix clang cross compilation
-- Fix resource leak when return error
-- fix compile error for dma_map_benchmark
-- Fix regression - make use of GUP_TEST_FILE macro
diff is attached.
thanks,
-- Shuah
----------------------------------------------------------------
The following changes since commit f2906aa863381afb0015a9eb7fefad885d4e5a56:
Linux 5.19-rc1 (2022-06-05 17:18:54 -0700)
are available in the Git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest tags/linux-kselftest-fixes-5.19-rc4
for you to fetch changes up to 9b4d5c01eb234f66a15a746b1c73e10209edb199:
selftests: make use of GUP_TEST_FILE macro (2022-06-16 17:05:50 -0600)
----------------------------------------------------------------
linux-kselftest-fixes-5.19-rc4
This Kselftest fixes update for Linux 5.19-rc4 consists of compile
time fixes and run-time resources leaks.
-- Fix clang cross compilation
-- Fix resource leak when return error
-- fix compile error for dma_map_benchmark
-- Fix regression - make use of GUP_TEST_FILE macro
----------------------------------------------------------------
Ding Xiang (1):
selftests: vm: Fix resource leak when return error
Joel Savitz (1):
selftests: make use of GUP_TEST_FILE macro
Mark Brown (1):
selftests: Fix clang cross compilation
Yu Liao (1):
selftests dma: fix compile error for dma_map_benchmark
tools/testing/selftests/dma/Makefile | 1 +
tools/testing/selftests/dma/dma_map_benchmark.c | 2 +-
tools/testing/selftests/lib.mk | 25 +++++++++++++++++++++++--
tools/testing/selftests/vm/gup_test.c | 4 ++--
tools/testing/selftests/vm/ksm_tests.c | 2 ++
5 files changed, 29 insertions(+), 5 deletions(-)
----------------------------------------------------------------
Hi everyone,
Here is the v2 of the conversion of DRM selftests to KUnit. Some style changes
were made to align to the drm_format_helper series [1] and the documentation [2],
as renaming the kunit_suite and the test cases to use underscores as suggested,
changing the filenames and using a generic symbol to group all tests at the
config menu.
Moreover, in the previous version of the series, the drm_cmdline_parser tests
were broken into multiple test functions. As pointed out by Shuan Khan, it made
the tests harder to comprehend. So, the refactoring was dropped and
straightforward conversion of the tests was made without any functional changes.
Thanks for your attention and any feedback is welcomed!
Best Regards,
- Maíra Canal
v1 -> v2: https://lore.kernel.org/dri-devel/20220615135824.15522-1-maira.canal@usp.br…
- The suites no longer end in _tests (David Gow).
- Remove the TODO entry involving the conversion of selftests to KUnit (Javier Martinez Canillas).
- Change the filenames to match the documentation: use *_test.c (Javier Martinez Canillas).
- Add MODULE_LICENSE to all tests (kernel test robot).
- Make use of a generic symbol to group all tests - DRM_KUNIT_TEST (Javier Martinez Canillas).
- Add .kunitconfig on the first patch (it was on the second patch of the series).
- Straightforward conversion of the drm_cmdline_parser tests without functional changes (Shuah Khan)
- Add David's Tested-by tags
[1] https://lore.kernel.org/dri-devel/20220620160640.3790-1-jose.exposito89@gma…
[2] https://www.kernel.org/doc/html/latest/dev-tools/kunit/style.html
Arthur Grillo (1):
drm: selftest: convert drm_mm selftest to KUnit
Maíra Canal (8):
drm: selftest: convert drm_damage_helper selftest to KUnit
drm: selftest: convert drm_cmdline_parser selftest to KUnit
drm: selftest: convert drm_rect selftest to KUnit
drm: selftest: convert drm_format selftest to KUnit
drm: selftest: convert drm_plane_helper selftest to KUnit
drm: selftest: convert drm_dp_mst_helper selftest to KUnit
drm: selftest: convert drm_framebuffer selftest to KUnit
drm: selftest: convert drm_buddy selftest to KUnit
Documentation/gpu/todo.rst | 11 -
drivers/gpu/drm/Kconfig | 15 +-
drivers/gpu/drm/Makefile | 2 +-
drivers/gpu/drm/selftests/Makefile | 8 -
.../gpu/drm/selftests/drm_buddy_selftests.h | 15 -
.../gpu/drm/selftests/drm_cmdline_selftests.h | 68 -
drivers/gpu/drm/selftests/drm_mm_selftests.h | 28 -
.../gpu/drm/selftests/drm_modeset_selftests.h | 40 -
drivers/gpu/drm/selftests/drm_selftest.c | 109 --
drivers/gpu/drm/selftests/drm_selftest.h | 41 -
drivers/gpu/drm/selftests/test-drm_buddy.c | 994 --------------
.../drm/selftests/test-drm_cmdline_parser.c | 1141 -----------------
.../drm/selftests/test-drm_damage_helper.c | 667 ----------
drivers/gpu/drm/selftests/test-drm_format.c | 280 ----
.../drm/selftests/test-drm_modeset_common.c | 32 -
.../drm/selftests/test-drm_modeset_common.h | 52 -
drivers/gpu/drm/tests/.kunitconfig | 3 +
drivers/gpu/drm/tests/Makefile | 6 +
drivers/gpu/drm/tests/drm_buddy_test.c | 748 +++++++++++
.../gpu/drm/tests/drm_cmdline_parser_test.c | 1078 ++++++++++++++++
.../gpu/drm/tests/drm_damage_helper_test.c | 633 +++++++++
.../drm_dp_mst_helper_test.c} | 84 +-
drivers/gpu/drm/tests/drm_format_test.c | 284 ++++
.../drm_framebuffer_test.c} | 25 +-
.../test-drm_mm.c => tests/drm_mm_test.c} | 1135 +++++++---------
.../drm_plane_helper_test.c} | 103 +-
.../test-drm_rect.c => tests/drm_rect_test.c} | 124 +-
27 files changed, 3395 insertions(+), 4331 deletions(-)
delete mode 100644 drivers/gpu/drm/selftests/Makefile
delete mode 100644 drivers/gpu/drm/selftests/drm_buddy_selftests.h
delete mode 100644 drivers/gpu/drm/selftests/drm_cmdline_selftests.h
delete mode 100644 drivers/gpu/drm/selftests/drm_mm_selftests.h
delete mode 100644 drivers/gpu/drm/selftests/drm_modeset_selftests.h
delete mode 100644 drivers/gpu/drm/selftests/drm_selftest.c
delete mode 100644 drivers/gpu/drm/selftests/drm_selftest.h
delete mode 100644 drivers/gpu/drm/selftests/test-drm_buddy.c
delete mode 100644 drivers/gpu/drm/selftests/test-drm_cmdline_parser.c
delete mode 100644 drivers/gpu/drm/selftests/test-drm_damage_helper.c
delete mode 100644 drivers/gpu/drm/selftests/test-drm_format.c
delete mode 100644 drivers/gpu/drm/selftests/test-drm_modeset_common.c
delete mode 100644 drivers/gpu/drm/selftests/test-drm_modeset_common.h
create mode 100644 drivers/gpu/drm/tests/.kunitconfig
create mode 100644 drivers/gpu/drm/tests/Makefile
create mode 100644 drivers/gpu/drm/tests/drm_buddy_test.c
create mode 100644 drivers/gpu/drm/tests/drm_cmdline_parser_test.c
create mode 100644 drivers/gpu/drm/tests/drm_damage_helper_test.c
rename drivers/gpu/drm/{selftests/test-drm_dp_mst_helper.c => tests/drm_dp_mst_helper_test.c} (73%)
create mode 100644 drivers/gpu/drm/tests/drm_format_test.c
rename drivers/gpu/drm/{selftests/test-drm_framebuffer.c => tests/drm_framebuffer_test.c} (96%)
rename drivers/gpu/drm/{selftests/test-drm_mm.c => tests/drm_mm_test.c} (58%)
rename drivers/gpu/drm/{selftests/test-drm_plane_helper.c => tests/drm_plane_helper_test.c} (62%)
rename drivers/gpu/drm/{selftests/test-drm_rect.c => tests/drm_rect_test.c} (53%)
--
2.36.1
--
Hi,
Are you currently open to work as our executive company representative
on contractual basis working remotely? If yes, we will be happy to
share more details. Looking forward to your response.
Regards,
The XSAVE feature set supports the saving and restoring of xstate components.
XSAVE feature has been used for process context switching. XSAVE components
include x87 state for FP execution environment, SSE state, AVX state and so on.
In order to ensure that XSAVE works correctly, add XSAVE most basic test for
XSAVE architecture functionality.
This patch tests "FP, SSE(XMM), AVX2(YMM), AVX512_OPMASK/AVX512_ZMM_Hi256/
AVX512_Hi16_ZMM and PKRU parts" xstates with following cases:
1. The contents of these xstates in the process should not change after the
signal handling.
2. The contents of these xstates in the child process should be the same as
the contents of the xstate in the parent process after the fork syscall.
3. The contents of xstates in the parent process should not change after
the context switch.
Because xstate like XMM will not be preserved across function calls, fork() and
raise() are implemented and inlined.
To prevent GCC from generating any FP/SSE(XMM)/AVX/PKRU code, add
"-mno-sse -mno-mmx -mno-sse2 -mno-avx -mno-pku" compiler arguments. stdlib.h
can not be used because of the "-mno-sse" option.
Thanks Dave, Hansen for the above suggestion!
Thanks Chen Yu; Shuah Khan; Chatre Reinette and Tony Luck's comments!
Thanks to Bae, Chang Seok for a bunch of comments!
========
- Change from v9 to v10
- Remove the small function if the function will be called once and there
is no good reason. (Shuah Khan)
- Change from v8 to v9
- Use function pointers to make it more structured. (Hansen, Dave)
- Improve the function name: xstate_tested -> xstate_in_test. (Chang S. Bae)
- Break this test up into two pieces: keep the xstate key test steps with
"-mno-sse" and no stdlib.h, keep others in xstate.c file. (Hansen, Dave)
- Use kselftest infrastructure for xstate.c file. (Hansen, Dave)
- Use instruction back to populate fp xstate buffer. (Hansen, Dave)
- Will skip the test if cpu could not support xsave. (Chang S. Bae)
- Use __cpuid_count() helper in kselftest.h. (Reinette, Chatre)
- Change from v7 to v8
Many thanks to Bae, Chang Seok for a bunch of comments as follow:
- Use the filling buffer way to prepare the xstate buffer, and use xrstor
instruction way to load the tested xstates.
- Remove useless dump_buffer, compare_buffer functions.
- Improve the struct of xstate_info.
- Added AVX512_ZMM_Hi256 and AVX512_Hi16_ZMM components in xstate test.
- Remove redundant xstate_info.xstate_mask, xstate_flag[], and
xfeature_test_mask, use xstate_info.mask instead.
- Check if xfeature is supported outside of fill_xstate_buf() , this change
is easier to read and understand.
- Remove useless wrpkru, only use filling all tested xstate buffer in
fill_xstates_buf().
- Improve a bunch of function names and variable names.
- Improve test steps flow for readability.
- Change from v6 to v7:
- Added the error number and error description of the reason for the
failure, thanks Shuah Khan's suggestion.
- Added a description of what these tests are doing in the head comments.
- Added changes update in the head comments.
- Added description of the purpose of the function. thanks Shuah Khan.
- Change from v5 to v6:
- In order to prevent GCC from generating any FP code by mistake,
"-mno-sse -mno-mmx -mno-sse2 -mno-avx -mno-pku" compiler parameter was
added, it's referred to the parameters for compiling the x86 kernel. Thanks
Dave Hansen's suggestion.
- Removed the use of "kselftest.h", because kselftest.h included <stdlib.h>,
and "stdlib.h" would use sse instructions in it's libc, and this *XSAVE*
test needed to be compiled without libc sse instructions(-mno-sse).
- Improved the description in commit header, thanks Chen Yu's suggestion.
- Becasue test code could not use buildin xsave64 in libc without sse, added
xsave function by instruction way.
- Every key test action would not use libc(like printf) except syscall until
it's failed or done. If it's failed, then it would print the failed reason.
- Used __cpuid_count() instead of native_cpuid(), becasue __cpuid_count()
was a macro definition function with one instruction in libc and did not
change xstate. Thanks Chatre Reinette, Shuah Khan.
https://lore.kernel.org/linux-sgx/8b7c98f4-f050-bc1c-5699-fa598ecc66a2@linu…
- Change from v4 to v5:
- Moved code files into tools/testing/selftests/x86.
- Delete xsave instruction test, becaue it's not related to kernel.
- Improved case description.
- Added AVX512 opmask change and related XSAVE content verification.
- Added PKRU part xstate test into instruction and signal handling test.
- Added XSAVE process swich test for FPU, AVX2, AVX512 opmask and PKRU part.
- Change from v3 to v4:
- Improve the comment in patch 1.
- Change from v2 to v3:
- Improve the description of patch 2 git log.
- Change from v1 to v2:
- Improve the cover-letter. Thanks Dave Hansen's suggestion.
Pengfei Xu (2):
selftests/x86/xstate: Add xstate signal handling test for XSAVE
feature
selftests/x86/xstate: Add xstate fork test for XSAVE feature
tools/testing/selftests/x86/.gitignore | 1 +
tools/testing/selftests/x86/Makefile | 11 +-
tools/testing/selftests/x86/xstate.c | 208 +++++++++++++++
tools/testing/selftests/x86/xstate.h | 262 +++++++++++++++++++
tools/testing/selftests/x86/xstate_helpers.c | 209 +++++++++++++++
tools/testing/selftests/x86/xstate_helpers.h | 10 +
6 files changed, 699 insertions(+), 2 deletions(-)
create mode 100644 tools/testing/selftests/x86/xstate.c
create mode 100644 tools/testing/selftests/x86/xstate.h
create mode 100644 tools/testing/selftests/x86/xstate_helpers.c
create mode 100644 tools/testing/selftests/x86/xstate_helpers.h
--
2.31.1
The default kselftest timeout is 45 seconds per test after which
run_kselftest marks the test case as failure.
Some mqueue perf tests take more than 100s to complete; especially in qemu
environment. Increase the timeout to 180 seconds for mqueue.
Signed-off-by: Vijai Kumar K <Vijaikumar_Kanagarajan(a)mentor.com>
---
tools/testing/selftests/mqueue/settings | 1 +
1 file changed, 1 insertion(+)
create mode 100644 tools/testing/selftests/mqueue/settings
diff --git a/tools/testing/selftests/mqueue/settings b/tools/testing/selftests/mqueue/settings
new file mode 100644
index 000000000000..a953c96aa16e
--- /dev/null
+++ b/tools/testing/selftests/mqueue/settings
@@ -0,0 +1 @@
+timeout=180
--
2.25.1