| /linux/lib/kunit/ |
| H A D | Kconfig | 2 # KUnit base configuration 5 menuconfig KUNIT config 6 tristate "KUnit - Enable support for unit tests" 9 Enables support for kernel unit tests (KUnit), a lightweight unit 14 Documentation/dev-tools/kunit/. 16 if KUNIT 19 bool "KUnit - Enable /sys/kernel/debug/kunit debugfs representation" 23 Enable debugfs representation for kunit. Currently this consists 24 of /sys/kernel/debug/kunit/<test_suite>/results files for each 29 bool "Enable KUnit tests which print BUG stacktraces" [all …]
|
| H A D | device.c | 3 * KUnit-managed device implementation 6 * lifecycle is managed by KUnit. 15 #include <kunit/test.h> 16 #include <kunit/device.h> 17 #include <kunit/resource.h> 25 /* The root device for the KUnit bus, parent of all kunit_devices. */ 28 /* A device owned by a KUnit test. */ 31 /* The KUnit test which owns this device. */ 32 struct kunit *owner; 33 /* If the driver is managed by KUnit and unique to this device. */ [all …]
|
| H A D | kunit-test.c | 3 * KUnit test for core test infrastructure. 9 #include <kunit/test.h> 10 #include <kunit/test-bug.h> 11 #include <kunit/static_stub.h> 14 #include <kunit/device.h> 26 struct kunit *test = data; in kunit_test_successful_try() 34 struct kunit *test = data; in kunit_test_no_catch() 39 static void kunit_test_try_catch_successful_try_no_catch(struct kunit *test) in kunit_test_try_catch_successful_try_no_catch() 56 struct kunit *test = data; in kunit_test_unsuccessful_try() 66 struct kunit *test = data; in kunit_test_catch() [all …]
|
| H A D | platform-test.c | 3 * KUnit test for KUnit platform driver infrastructure. 8 #include <kunit/platform_device.h> 9 #include <kunit/test.h> 14 static void kunit_platform_device_alloc_test(struct kunit *test) in kunit_platform_device_alloc_test() 17 kunit_platform_device_alloc(test, "kunit-platform", 1)); in kunit_platform_device_alloc_test() 24 static void kunit_platform_device_add_test(struct kunit *test) in kunit_platform_device_add_test() 27 const char *name = "kunit-platform-add"; in kunit_platform_device_add_test() 43 static void kunit_platform_device_add_twice_fails_test(struct kunit *test) in kunit_platform_device_add_twice_fails_test() 46 const char *name = "kunit-platform-add-2"; in kunit_platform_device_add_twice_fails_test() 67 static void kunit_platform_device_add_cleans_up(struct kunit *test) in kunit_platform_device_add_cleans_up() [all …]
|
| /linux/Documentation/dev-tools/kunit/ |
| H A D | start.rst | 7 This page contains an overview of the kunit_tool and KUnit framework, 9 and covers common problems users face when using KUnit for the first time. 13 KUnit has the same dependencies as the Linux kernel. As long as you can 14 build the kernel, you can run KUnit. 24 ./tools/testing/kunit/kunit.py run 30 This happens because internally kunit.py specifies ``.kunit`` 46 Configuring KUnit Kernel ... 47 Building KUnit Kernel ... 48 Starting KUnit Kernel ... 54 the ``Building KUnit Kernel`` step may take a while. [all …]
|
| H A D | architecture.rst | 4 KUnit Architecture 7 The KUnit architecture is divided into two parts: 15 The kernel testing library supports KUnit tests written in C using 16 KUnit. These KUnit tests are kernel code. KUnit performs the following 26 The test case is the fundamental unit in KUnit. KUnit test cases are organised 27 into suites. A KUnit test case is a function with type signature 28 ``void (*)(struct kunit *test)``. These test case functions are wrapped in a 34 Each KUnit test case receives a ``struct kunit`` context object that tracks a 35 running test. The KUnit assertion macros and other KUnit utilities use the 36 ``struct kunit`` context object. As an exception, there are two fields: [all …]
|
| H A D | running_tips.rst | 4 Tips For Running KUnit Tests 7 Using ``kunit.py run`` ("kunit tool") 18 ( cd "$(git rev-parse --show-toplevel)" && ./tools/testing/kunit/kunit.py run "$@" ) 22 Early versions of ``kunit.py`` (before 5.6) didn't work unless run from 28 ``kunit.py run`` accepts an optional glob argument to filter tests. The format 35 $ echo -e 'CONFIG_KUNIT=y\nCONFIG_KUNIT_ALL_TESTS=y' > .kunit/.kunitconfig 36 $ ./tools/testing/kunit/kunit.py run 'sysctl*' 42 $ echo -e 'CONFIG_KUNIT=y\nCONFIG_KUNIT_ALL_TESTS=y' > .kunit/.kunitconfig 43 $ ./tools/testing/kunit/kunit.py run 'sysctl*.*write*' 55 ``kunit.py run`` (along with ``build``, and ``config``) supports a [all …]
|
| H A D | index.rst | 4 KUnit - Linux Kernel Unit Testing 26 KUnit (Kernel unit testing framework) provides a common framework for 27 unit tests within the Linux kernel. Using KUnit, you can define groups 29 if built-in, or load as a module. KUnit automatically flags and reports 35 KUnit tests are part of the kernel, written in the C (programming) 38 completion, KUnit can run around 100 tests in less than 10 seconds. 39 KUnit can test any kernel component, for example: file system, system 42 KUnit follows the white-box testing approach. The test has access to 43 internal system functionality. KUnit runs in kernel space and is not 46 In addition, KUnit has kunit_tool, a script (``tools/testing/kunit/kunit.py``) [all …]
|
| H A D | run_manual.rst | 9 include KUnit in any kernel, read out results, and parse manually. 11 .. note:: KUnit is not designed for use in a production system. It is 18 KUnit tests can run without kunit_tool. This can be useful, if: 25 KUnit is configured with the ``CONFIG_KUNIT`` option, and individual 27 ``.config``. KUnit tests usually (but don't always) have config options 38 KUnit can be enabled or disabled at boot time, and this behavior is 39 controlled by the kunit.enable kernel parameter. 40 By default, kunit.enable is set to 1 because KUNIT_DEFAULT_ENABLED is 42 verify that kunit.enable=1 at boot time. 61 KUnit can be accessed from userspace via the debugfs filesystem (See more [all …]
|
| /linux/drivers/gpu/drm/amd/display/amdgpu_dm/tests/ |
| H A D | amdgpu_dm_connector_test.c | 3 * KUnit tests for amdgpu_dm_connector.c 8 #include <kunit/test.h> 37 * @test: The KUnit test context 39 static void dm_test_subconnector_type_none(struct kunit *test) in dm_test_subconnector_type_none() 51 * @test: The KUnit test context 53 static void dm_test_subconnector_type_vga(struct kunit *test) in dm_test_subconnector_type_vga() 65 * @test: The KUnit test context 67 static void dm_test_subconnector_type_dvi_converter(struct kunit *test) in dm_test_subconnector_type_dvi_converter() 79 * @test: The KUnit test context 81 static void dm_test_subconnector_type_dvi_dongle(struct kunit *test) in dm_test_subconnector_type_dvi_dongle() [all …]
|
| H A D | amdgpu_dm_test.c | 3 * KUnit tests for amdgpu_dm.c 8 #include <kunit/test.h> 28 * @test: The KUnit test context 30 static void dm_test_is_idle(struct kunit *test) in dm_test_is_idle() 37 * @test: The KUnit test context 39 static void dm_test_wait_for_idle(struct kunit *test) in dm_test_wait_for_idle() 46 * @test: The KUnit test context 48 static void dm_test_soft_reset(struct kunit *test) in dm_test_soft_reset() 55 * @test: The KUnit test context 57 static void dm_test_set_clockgating_state(struct kunit *test) in dm_test_set_clockgating_state() [all …]
|
| H A D | amdgpu_dm_helpers_test.c | 3 * KUnit tests for amdgpu_dm_helpers.c 8 #include <kunit/test.h> 30 * @test: The KUnit test context 32 static void dm_test_edid_extract_panel_id_basic(struct kunit *test) in dm_test_edid_extract_panel_id_basic() 57 * @test: The KUnit test context 59 static void dm_test_edid_extract_panel_id_zeros(struct kunit *test) in dm_test_edid_extract_panel_id_zeros() 76 static struct edid *dm_test_edid_with_panel_id(struct kunit *test, u32 panel_id) in dm_test_edid_with_panel_id() 95 static struct dc_link *dm_test_quirk_link(struct kunit *test) in dm_test_quirk_link() 111 * @test: The KUnit test context 113 static void dm_test_apply_edid_quirks_dpcd_poweroff_delay(struct kunit *test) in dm_test_apply_edid_quirks_dpcd_poweroff_delay() [all …]
|
| H A D | amdgpu_dm_irq_test.c | 3 * KUnit tests for amdgpu_dm_irq.c 8 #include <kunit/test.h> 277 static struct dc *dm_test_alloc_dc_with_irq_service(struct kunit *test, in dm_test_alloc_dc_with_irq_service() 376 * @test: The KUnit test context 378 static void dm_test_hpd_to_dal_irq_source_hpd1(struct kunit *test) in dm_test_hpd_to_dal_irq_source_hpd1() 386 * @test: The KUnit test context 388 static void dm_test_hpd_to_dal_irq_source_hpd2(struct kunit *test) in dm_test_hpd_to_dal_irq_source_hpd2() 396 * @test: The KUnit test context 398 static void dm_test_hpd_to_dal_irq_source_hpd3(struct kunit *test) in dm_test_hpd_to_dal_irq_source_hpd3() 406 * @test: The KUnit test context [all …]
|
| H A D | amdgpu_dm_crtc_test.c | 3 * KUnit tests for amdgpu_dm_crtc.c 8 #include <kunit/test.h> 28 * @test: The KUnit test context 30 static void dm_test_crtc_modeset_required_active_mode_changed(struct kunit *test) in dm_test_crtc_modeset_required_active_mode_changed() 43 * @test: The KUnit test context 45 static void dm_test_crtc_modeset_required_active_active_changed(struct kunit *test) in dm_test_crtc_modeset_required_active_active_changed() 58 * @test: The KUnit test context 60 static void dm_test_crtc_modeset_required_active_connectors_changed(struct kunit *test) in dm_test_crtc_modeset_required_active_connectors_changed() 73 * @test: The KUnit test context 75 static void dm_test_crtc_modeset_required_inactive(struct kunit *test) in dm_test_crtc_modeset_required_inactive() [all …]
|
| /linux/Documentation/dev-tools/kunit/api/ |
| H A D | index.rst | 17 This page documents the KUnit kernel testing API. It is divided into the 20 Core KUnit API 23 Documentation/dev-tools/kunit/api/test.rst 27 Documentation/dev-tools/kunit/api/resource.rst 29 - Documents the KUnit resource API 31 Documentation/dev-tools/kunit/api/functionredirection.rst 33 - Documents the KUnit Function Redirection API 35 Driver KUnit API 38 Documentation/dev-tools/kunit/api/clk.rst 40 - Documents the KUnit clk API [all …]
|
| /linux/sound/soc/ |
| H A D | soc-topology-test.c | 12 #include <kunit/device.h> 13 #include <kunit/test.h> 25 static int snd_soc_tplg_test_init(struct kunit *test) in snd_soc_tplg_test_init() 35 static void snd_soc_tplg_test_exit(struct kunit *test) in snd_soc_tplg_test_exit() 42 * component probe, we need to pass struct kunit somehow to probe function, so 46 struct kunit *kunit; member 58 KUNIT_EXPECT_EQ_MSG(kunit_comp->kunit, kunit_comp->expect, ret, in d_probe() 70 KUNIT_EXPECT_EQ(kunit_comp->kunit, 0, ret); in d_remove() 82 .name = "KUNIT Audi [all...] |
| /linux/Documentation/translations/zh_CN/rust/ |
| H A D | testing.rst | 17 - KUnit 测试 21 KUnit 测试 24 这些测试来自 Rust 文档中的示例。它们会被转换为 KUnit 测试。 29 这些测试可以通过 KUnit 运行。例如,在命令行中使用 ``kunit_tool`` ( ``kunit.py`` ):: 31 ./tools/testing/kunit/kunit.py run --make_options LLVM=1 --arch x86_64 --kconfig_add CONFIG_RUST=y 33 或者,KUnit 也可以在内核启动时以内置方式运行。获取更多 KUnit 信息,请参阅 34 Documentation/dev-tools/kunit/index.rst。 35 关于内核内置与命令行测试的详细信息,请参阅 Documentation/dev-tools/kunit/architecture.rst。 37 要使用这些 KUnit 文档测试,需要在内核配置中启用以下选项:: 40 Kernel hacking -> Kernel Testing and Coverage -> KUnit - Enable support for unit tests [all …]
|
| /linux/tools/testing/kunit/ |
| H A D | kunit_tool_test.py | 4 # A collection of tests for tools/testing/kunit/kunit.py 28 import kunit 119 self.assertContains('# Subtest: kunit-resource-test', result) 127 self.assertContains('ok 1 - kunit-resource-test', result) 128 self.assertContains('foo bar # non-kunit output', result) 129 self.assertContains('# Subtest: kunit-try-catch-test', result) 135 self.assertContains('ok 2 - kunit-try-catch-test', result) 287 self.assertEqual('kunit-resource-test', result.subtests[0].name) 295 self.assertEqual('kunit [all...] |
| /linux/drivers/gpu/drm/xe/tests/ |
| H A D | xe_kunit_helpers.c | 6 #include <kunit/test.h> 7 #include <kunit/static_stub.h> 8 #include <kunit/visibility.h> 20 * xe_kunit_helper_alloc_xe_device - Allocate a &xe_device for a KUnit test. 21 * @test: the &kunit where this &xe_device will be used 33 struct xe_device *xe_kunit_helper_alloc_xe_device(struct kunit *test, in xe_kunit_helper_alloc_xe_device() 48 struct kunit *test = kunit_get_current_test(); in kunit_action_restore_priv() 54 * xe_kunit_helper_xe_device_test_init - Prepare a &xe_device for a KUnit test. 55 * @test: the &kunit where this fake &xe_device will be used 58 * pointer as &kunit.priv to allow the test code to access it. [all …]
|
| H A D | xe_guc_relay_test.c | 6 #include <kunit/static_stub.h> 7 #include <kunit/test.h> 8 #include <kunit/test-bug.h> 25 static int relay_test_init(struct kunit *test) in relay_test_init() 65 struct kunit *test = kunit_get_current_test(); in replacement_xe_guc_ct_send_recv_always_fails() 78 struct kunit *test = kunit_get_current_test(); in replacement_xe_guc_ct_send_recv_expects_pf2guc_relay() 120 static void pf_rejects_guc2pf_too_short(struct kunit *test) in pf_rejects_guc2pf_too_short() 129 static void pf_rejects_guc2pf_too_long(struct kunit *test) in pf_rejects_guc2pf_too_long() 138 static void pf_rejects_guc2pf_no_payload(struct kunit *test) in pf_rejects_guc2pf_no_payload() 147 static void pf_fails_no_payload(struct kunit *test) in pf_fails_no_payload() [all …]
|
| /linux/lib/ |
| H A D | Kconfig.debug | 1963 source "lib/kunit/Kconfig" 2277 tristate "KUnit test for cpumask" if !KUNIT_ALL_TESTS 2278 depends on KUNIT 2283 For more information on KUnit and unit tests in general, please refer 2284 to the KUnit documentation in Documentation/dev-tools/kunit/. 2290 depends on KUNIT 2301 depends on KUNIT 2331 depends on KUNIT 2345 depends on KUNIT 2359 depends on KUNIT=y [all …]
|
| /linux/include/kunit/ |
| H A D | device.h | 3 * KUnit basic device implementation 5 * Helpers for creating and managing fake devices for KUnit tests. 16 #include <kunit/test.h> 29 * Return: a stub struct device_driver, managed by KUnit, with the name @name. 31 struct device_driver *kunit_driver_create(struct kunit *test, const char *name); 34 * kunit_device_register() - Create a struct device for use in KUnit tests 47 struct device *kunit_device_register(struct kunit *test, const char *name); 50 * kunit_device_register_with_driver() - Create a struct device for use in KUnit tests 58 * wish KUnit to create and manage a driver for you. 63 struct device *kunit_device_register_with_driver(struct kunit *test, [all …]
|
| H A D | clk.h | 10 struct kunit; 13 clk_get_kunit(struct kunit *test, struct device *dev, const char *con_id); 15 of_clk_get_kunit(struct kunit *test, struct device_node *np, int index); 18 clk_hw_get_clk_kunit(struct kunit *test, struct clk_hw *hw, const char *con_id); 20 clk_hw_get_clk_prepared_enabled_kunit(struct kunit *test, struct clk_hw *hw, 23 int clk_prepare_enable_kunit(struct kunit *test, struct clk *clk); 25 int clk_hw_register_kunit(struct kunit *test, struct device *dev, struct clk_hw *hw); 26 int of_clk_hw_register_kunit(struct kunit *test, struct device_node *node, 29 int of_clk_add_hw_provider_kunit(struct kunit *test, struct device_node *np,
|
| /linux/rust/kernel/ |
| H A D | kunit.rs | 3 //! KUnit-based macros for Rust unit tests. 5 //! C header: [`include/kunit/test.h`](srctree/include/kunit/test.h) 7 //! Reference: <https://docs.kernel.org/dev-tools/kunit/index.html> 12 /// Prints a KUnit error-level message. 14 /// Public but hidden since it should only be used from KUnit generated code. 32 /// Prints a KUnit info-level message. 34 /// Public but hidden since it should only be used from KUnit generated code. 56 /// Unlike the one in `core`, this one does not panic; instead, it is mapped to the KUnit 75 // The assertion failed but this task is not running a KUnit tes 203 kunit_case( name: &'static kernel::str::CStr, run_case: unsafe extern "C" fn(*mut kernel::bindings::kunit), ) -> kernel::bindings::kunit_case kunit_case() argument [all...] |
| /linux/security/apparmor/ |
| H A D | policy_unpack_test.c | 3 * KUnit tests for AppArmor's policy unpack. 6 #include <kunit/test.h> 7 #include <kunit/visibility.h> 57 struct kunit *test, size_t buf_size) in build_aa_ext_struct() 113 static int policy_unpack_test_init(struct kunit *test) in policy_unpack_test_init() 128 static void policy_unpack_test_inbounds_when_inbounds(struct kunit *test) in policy_unpack_test_inbounds_when_inbounds() 137 static void policy_unpack_test_inbounds_when_out_of_bounds(struct kunit *test) in policy_unpack_test_inbounds_when_out_of_bounds() 144 static void policy_unpack_test_unpack_array_with_null_name(struct kunit *test) in policy_unpack_test_unpack_array_with_null_name() 157 static void policy_unpack_test_unpack_array_with_name(struct kunit *test) in policy_unpack_test_unpack_array_with_name() 171 static void policy_unpack_test_unpack_array_out_of_bounds(struct kunit *test) in policy_unpack_test_unpack_array_out_of_bounds() [all …]
|