Home
last modified time | relevance | path

Searched +full:kunit +full:- +full:base (Results 1 – 25 of 60) sorted by relevance

123

/linux/drivers/gpu/drm/xe/tests/
H A Dxe_sriov_pf_service_kunit.c1 // SPDX-License-Identifier: GPL-2.0 AND MIT
3 * Copyright © 2024-2025 Intel Corporation
6 #include <kunit/test.h>
12 static int pf_service_test_init(struct kunit *test) in pf_service_test_init()
21 test->priv = &fake; in pf_service_test_init()
24 xe = test->priv; in pf_service_test_init()
30 * - all supported platforms VF/PF ABI versions must be defined in pf_service_test_init()
31 * - base version can't be newer than latest in pf_service_test_init()
33 KUNIT_ASSERT_NE(test, 0, xe->sriov.pf.service.version.base.major); in pf_service_test_init()
34 KUNIT_ASSERT_NE(test, 0, xe->sriov.pf.service.version.latest.major); in pf_service_test_init()
[all …]
H A Dxe_test.h1 /* SPDX-License-Identifier: GPL-2.0 AND MIT */
12 #include <kunit/test.h>
13 #include <kunit/test-bug.h>
16 * Each test that provides a kunit private test structure, place a test id
17 * here and point the kunit->priv to an embedded struct xe_test_priv.
25 * struct xe_test_priv - Base class for test private info
36 * xe_cur_kunit_priv - Obtain the struct xe_test_priv pointed to by
37 * current->kunit->priv if it exists and is embedded in the expected subclass.
40 * Return: NULL if the process is not a kunit test, and NULL if the
41 * current kunit->priv pointer is not pointing to an object of the expected
[all …]
H A Dxe_bo.c1 // SPDX-License-Identifier: GPL-2.0 AND MIT
6 #include <kunit/test.h>
7 #include <kunit/visibility.h>
9 #include <linux/iosys-map.h>
26 struct kunit *test) in ccs_test_migrate()
46 fence = xe_migrate_clear(tile->migrate, bo, bo->ttm.resource, in ccs_test_migrate()
56 return -ETIME; in ccs_test_migrate()
70 timeout = dma_resv_wait_timeout(bo->ttm.base.resv, in ccs_test_migrate()
76 return -ETIME; in ccs_test_migrate()
84 ttm = bo->ttm.ttm; in ccs_test_migrate()
[all …]
H A Dxe_guc_buf_kunit.c1 // SPDX-License-Identifier: GPL-2.0 AND MIT
6 #include <kunit/static_stub.h>
7 #include <kunit/test.h>
8 #include <kunit/test-bug.h>
23 struct kunit *test = kunit_get_current_test(); in replacement_xe_managed_bo_create_pin_map()
27 bo = drmm_kzalloc(&xe->drm, sizeof(*bo), GFP_KERNEL); in replacement_xe_managed_bo_create_pin_map()
30 buf = drmm_kzalloc(&xe->drm, size, GFP_KERNEL); in replacement_xe_managed_bo_create_pin_map()
33 bo->tile = tile; in replacement_xe_managed_bo_create_pin_map()
34 bo->ttm.bdev = &xe->ttm; in replacement_xe_managed_bo_create_pin_map()
35 bo->ttm.base.size = size; in replacement_xe_managed_bo_create_pin_map()
[all …]
/linux/drivers/gpu/drm/scheduler/tests/
H A Dsched_tests.h1 /* SPDX-License-Identifier: GPL-2.0 */
7 #include <kunit/test.h>
10 #include <linux/dma-fence.h>
31 * struct drm_mock_scheduler - implements a trivial mock GPU execution engine
33 * @base: DRM scheduler base class
34 * @test: Backpointer to owning the kunit test case
46 struct drm_gpu_scheduler base; member
48 struct kunit *test;
61 * struct drm_mock_sched_entity - implements a mock GPU sched entity
63 * @base: DRM scheduler entity base class
[all …]
H A Dmock_scheduler.c1 // SPDX-License-Identifier: GPL-2.0
14 * drm_mock_sched_entity_new - Create a new mock scheduler entity
16 * @test: KUnit test owning the entity
23 drm_mock_sched_entity_new(struct kunit *test, in drm_mock_sched_entity_new()
34 drm_sched = &sched->base; in drm_mock_sched_entity_new()
35 ret = drm_sched_entity_init(&entity->base, in drm_mock_sched_entity_new()
41 entity->test = test; in drm_mock_sched_entity_new()
47 * drm_mock_sched_entity_free - Destroys a mock scheduler entity
55 drm_sched_entity_destroy(&entity->base); in drm_mock_sched_entity_free()
61 drm_sched_to_mock_sched(job->base.sched); in drm_mock_sched_job_complete()
[all …]
H A Dtests_basic.c1 // SPDX-License-Identifier: GPL-2.0
17 static int drm_sched_basic_init(struct kunit *test) in drm_sched_basic_init()
19 test->priv = drm_mock_sched_new(test, MAX_SCHEDULE_TIMEOUT); in drm_sched_basic_init()
24 static void drm_sched_basic_exit(struct kunit *test) in drm_sched_basic_exit()
26 struct drm_mock_scheduler *sched = test->priv; in drm_sched_basic_exit()
31 static int drm_sched_timeout_init(struct kunit *test) in drm_sched_timeout_init()
33 test->priv = drm_mock_sched_new(test, MOCK_TIMEOUT); in drm_sched_timeout_init()
38 static void drm_sched_basic_submit(struct kunit *test) in drm_sched_basic_submit()
40 struct drm_mock_scheduler *sched = test->priv; in drm_sched_basic_submit()
102 .description = "Multiple inter-dependent job queues",
[all …]
/linux/drivers/gpu/drm/tests/
H A Ddrm_connector_test.c1 // SPDX-License-Identifier: GPL-2.0
3 * Kunit test for drm_modes functions
18 #include <kunit/test.h>
60 static int drm_test_connector_init(struct kunit *test) in drm_test_connector_init()
74 strscpy(priv->ddc.name, "dummy-connector-ddc", sizeof(priv->ddc.name)); in drm_test_connector_init()
75 priv->ddc.owner = THIS_MODULE; in drm_test_connector_init()
76 priv->ddc.algo = &dummy_ddc_algorithm; in drm_test_connector_init()
77 priv->ddc.dev.parent = dev; in drm_test_connector_init()
79 ret = i2c_add_adapter(&priv->ddc); in drm_test_connector_init()
82 ret = kunit_add_action_or_reset(test, i2c_del_adapter_wrapper, &priv->ddc); in drm_test_connector_init()
[all …]
H A Ddrm_gem_shmem_test.c1 // SPDX-License-Identifier: GPL-2.0
3 * KUnit test suite for GEM objects backed by shmem buffers
10 #include <linux/dma-buf.h>
11 #include <linux/iosys-map.h>
14 #include <kunit/test.h>
43 static void drm_gem_shmem_test_obj_create(struct kunit *test) in drm_gem_shmem_test_obj_create()
45 struct drm_device *drm_dev = test->priv; in drm_gem_shmem_test_obj_create()
50 KUNIT_EXPECT_EQ(test, shmem->base.size, TEST_SIZE); in drm_gem_shmem_test_obj_create()
51 KUNIT_EXPECT_NOT_NULL(test, shmem->base.filp); in drm_gem_shmem_test_obj_create()
52 KUNIT_EXPECT_NOT_NULL(test, shmem->base.funcs); in drm_gem_shmem_test_obj_create()
[all …]
H A Ddrm_framebuffer_test.c1 // SPDX-License-Identifier: GPL-2.0
8 #include <kunit/device.h>
9 #include <kunit/test.h>
52 .handles = { 1, 0, 0 }, .pitches = { 4 * MAX_WIDTH - 1, 0, 0 },
82 .handles = { 1, 0, 0 }, .offsets = { UINT_MAX - 1, 0, 0 },
94 * All entries in members that represents per-plane values (@modifier, @handles,
155 .handles = { 1, 1, 0 }, .pitches = { MAX_WIDTH, MAX_WIDTH - 1, 0 },
164 { .buffer_created = 0, .name = "NV12 different modifier per-plane",
224 .handles = { 1, 1, 1 }, .pitches = { MAX_WIDTH, DIV_ROUND_UP(MAX_WIDTH, 2) - 1,
308 .handles = { 1, 0, 0 }, .pitches = { 2 * MAX_WIDTH - 1, 0, 0 }
[all …]
/linux/drivers/gpu/drm/ttm/tests/
H A Dttm_tt_test.c1 // SPDX-License-Identifier: GPL-2.0 AND MIT
20 .description = "Page-aligned size",
33 strscpy(desc, t->description, KUNIT_PARAM_DESC_SIZE); in ttm_tt_init_case_desc()
39 static void ttm_tt_init_basic(struct kunit *test) in ttm_tt_init_basic()
41 const struct ttm_tt_test_case *params = test->param_value; in ttm_tt_init_basic()
46 u32 extra_pages = params->extra_pages_num; in ttm_tt_init_basic()
47 int num_pages = params->size >> PAGE_SHIFT; in ttm_tt_init_basic()
53 bo = ttm_bo_kunit_init(test, test->priv, params->size, NULL); in ttm_tt_init_basic()
58 KUNIT_ASSERT_EQ(test, tt->num_pages, num_pages + extra_pages); in ttm_tt_init_basic()
60 KUNIT_ASSERT_EQ(test, tt->page_flags, page_flags); in ttm_tt_init_basic()
[all …]
H A Dttm_bo_test.c1 // SPDX-License-Identifier: GPL-2.0 AND MIT
5 #include <linux/dma-resv.h>
54 strscpy(desc, t->description, KUNIT_PARAM_DESC_SIZE); in ttm_bo_init_case_desc()
59 static void ttm_bo_reserve_optimistic_no_ticket(struct kunit *test) in ttm_bo_reserve_optimistic_no_ticket()
61 const struct ttm_bo_test_case *params = test->param_value; in ttm_bo_reserve_optimistic_no_ticket()
65 bo = ttm_bo_kunit_init(test, test->priv, BO_SIZE, NULL); in ttm_bo_reserve_optimistic_no_ticket()
67 err = ttm_bo_reserve(bo, params->interruptible, params->no_wait, NULL); in ttm_bo_reserve_optimistic_no_ticket()
70 dma_resv_unlock(bo->base.resv); in ttm_bo_reserve_optimistic_no_ticket()
73 static void ttm_bo_reserve_locked_no_sleep(struct kunit *test) in ttm_bo_reserve_locked_no_sleep()
80 bo = ttm_bo_kunit_init(test, test->priv, BO_SIZE, NULL); in ttm_bo_reserve_locked_no_sleep()
[all …]
H A Dttm_bo_validate_test.c1 // SPDX-License-Identifier: GPL-2.0 AND MIT
28 static struct ttm_placement *ttm_placement_kunit_init(struct kunit *test, in ttm_placement_kunit_init()
37 placement->num_placement = num_places; in ttm_placement_kunit_init()
38 placement->placement = places; in ttm_placement_kunit_init()
45 return "ttm-bo-validate-fence"; in fence_name()
53 static struct dma_fence *alloc_mock_fence(struct kunit *test) in alloc_mock_fence()
65 static void dma_resv_kunit_active_fence_init(struct kunit *test, in dma_resv_kunit_active_fence_init()
83 strscpy(desc, t->description, KUNIT_PARAM_DESC_SIZE); in ttm_bo_validate_case_desc()
104 static void ttm_bo_init_reserved_sys_man(struct kunit *test) in ttm_bo_init_reserved_sys_man()
106 const struct ttm_bo_validate_test_case *params = test->param_value; in ttm_bo_init_reserved_sys_man()
[all …]
H A Dttm_resource_test.c1 // SPDX-License-Identifier: GPL-2.0 AND MIT
10 #define TTM_PRIV_DUMMY_REG (TTM_NUM_MEM_TYPES - 1)
26 static int ttm_resource_test_init(struct kunit *test) in ttm_resource_test_init()
33 priv->devs = ttm_test_devices_all(test); in ttm_resource_test_init()
34 KUNIT_ASSERT_NOT_NULL(test, priv->devs); in ttm_resource_test_init()
36 test->priv = priv; in ttm_resource_test_init()
41 static void ttm_resource_test_fini(struct kunit *test) in ttm_resource_test_fini()
43 struct ttm_resource_test_priv *priv = test->priv; in ttm_resource_test_fini()
45 ttm_test_devices_put(test, priv->devs); in ttm_resource_test_fini()
48 static void ttm_init_test_mocks(struct kunit *test, in ttm_init_test_mocks()
[all …]
/linux/drivers/net/wireless/intel/iwlwifi/tests/
H A Ddevinfo.c1 // SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
3 * KUnit tests for the iwlwifi device info table
5 * Copyright (C) 2023-2025 Intel Corporation
7 #include <kunit/test.h>
9 #include "iwl-drv.h"
10 #include "iwl-config.h"
16 u16 subdevice_mask = GENMASK(di->subdevice_m_h, di->subdevice_m_l); in iwl_pci_print_dev_info()
20 if (di->match_rf_type) in iwl_pci_print_dev_info()
21 pos += scnprintf(buf + pos, sizeof(buf) - pos, in iwl_pci_print_dev_info()
22 " rf_type=%03x", di->rf_type); in iwl_pci_print_dev_info()
[all …]
/linux/kernel/
H A Dresource_kunit.c1 // SPDX-License-Identifier: GPL-2.0+
6 #include <kunit/test.h>
85 static void resource_do_test(struct kunit *test, bool ret, struct resource *r, in resource_do_test()
90 KUNIT_EXPECT_EQ_MSG(test, r->start, exp_r->start, "Start elements are not equal"); in resource_do_test()
91 KUNIT_EXPECT_EQ_MSG(test, r->end, exp_r->end, "End elements are not equal"); in resource_do_test()
94 static void resource_do_union_test(struct kunit *test, struct result *r) in resource_do_union_test()
100 ret = resource_union(r->r1, r->r2, &result); in resource_do_union_test()
101 resource_do_test(test, ret, &result, r->ret, &r->r, r->r1, r->r2); in resource_do_union_test()
104 ret = resource_union(r->r2, r->r1, &result); in resource_do_union_test()
105 resource_do_test(test, ret, &result, r->ret, &r->r, r->r2, r->r1); in resource_do_union_test()
[all …]
/linux/drivers/pinctrl/qcom/
H A Dtlmm-test.c1 // SPDX-License-Identifier: GPL-2.0-only
6 #define pr_fmt(fmt) "tlmm-test: " fmt
8 #include <kunit/test.h>
23 * (pinctrl-msm) delivers expected number of interrupts in response to changing
27 * "gpio", which the tester is expected to specify an unused and non-connected
41 static int tlmm_test_gpio = -1;
48 void __iomem *base; member
57 * struct tlmm_test_priv - Per-test context
102 if (priv->intr_op & TLMM_TEST_COUNT) in tlmm_test_intr_fn()
103 atomic_inc(&priv->intr_count); in tlmm_test_intr_fn()
[all …]
/linux/drivers/gpu/drm/vc4/tests/
H A Dvc4_mock.c1 // SPDX-License-Identifier: GPL-2.0
6 #include <kunit/test.h>
38 VC4_MOCK_CRTC_DESC(&(_data)->base, __VA_ARGS__)
54 VC4_MOCK_CRTC_DESC(&bcm2835_txp_data.base,
80 VC4_MOCK_CRTC_DESC(&bcm2835_txp_data.base,
109 static int __build_one_pipe(struct kunit *test, struct drm_device *drm, in __build_one_pipe()
120 dummy_crtc = vc4_mock_pv(test, drm, plane, pipe->data); in __build_one_pipe()
123 crtc = &dummy_crtc->crtc.base; in __build_one_pipe()
124 for (i = 0; i < pipe->noutputs; i++) { in __build_one_pipe()
125 const struct vc4_mock_output_desc *mock_output = &pipe->outputs[i]; in __build_one_pipe()
[all …]
H A Dvc4_mock.h1 /* SPDX-License-Identifier: GPL-2.0 */
9 struct drm_crtc *vc4_find_crtc_for_encoder(struct kunit *test, in vc4_find_crtc_for_encoder()
15 KUNIT_ASSERT_EQ(test, hweight32(encoder->possible_crtcs), 1); in vc4_find_crtc_for_encoder()
18 if (encoder->possible_crtcs & drm_crtc_mask(crtc)) in vc4_find_crtc_for_encoder()
24 struct drm_plane *vc4_dummy_plane(struct kunit *test, struct drm_device *drm,
31 struct vc4_dummy_crtc *vc4_mock_pv(struct kunit *test,
42 container_of_const(_enc, struct vc4_dummy_output, encoder.base)
44 struct vc4_dummy_output *vc4_dummy_output(struct kunit *test,
51 struct vc4_dev *vc4_mock_device(struct kunit *test);
52 struct vc4_dev *vc5_mock_device(struct kunit *test);
[all …]
/linux/lib/kunit/
H A DKconfig2 # 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" if !KUNIT_ALL_TESTS
22 Enable debugfs representation for kunit. Currently this consists
23 of /sys/kernel/debug/kunit/<test_suite>/results files for each
28 bool "Enable KUnit tests which print BUG stacktraces"
[all …]
H A Dtest.c1 // SPDX-License-Identifier: GPL-2.0
3 * Base unit test (KUnit) API.
9 #include <kunit/resource.h>
10 #include <kunit/test.h>
11 #include <kunit/test-bug.h>
12 #include <kunit/attributes.h>
23 #include "device-impl.h"
24 #include "hooks-impl.h"
25 #include "string-stream.h"
26 #include "try-catch-impl.h"
[all …]
/linux/lib/math/tests/
H A Dint_pow_kunit.c1 // SPDX-License-Identifier: GPL-2.0-only
3 #include <kunit/test.h>
7 u64 base; member
16 { 0, 5, 0, "Base zero" },
17 { 1, 64, 1, "Base one" },
21 { U64_MAX, 1, U64_MAX, "Max base" },
27 strscpy(desc, tc->name, KUNIT_PARAM_DESC_SIZE); in get_desc()
32 static void int_pow_test(struct kunit *test) in int_pow_test()
34 const struct test_case_params *tc = (const struct test_case_params *)test->param_value; in int_pow_test()
36 KUNIT_EXPECT_EQ(test, tc->expected_result, int_pow(tc->base, tc->exponent)); in int_pow_test()
[all …]
/linux/drivers/firmware/cirrus/test/
H A Dcs_dsp_test_bin_error.c1 // SPDX-License-Identifier: GPL-2.0-only
3 // KUnit tests for cs_dsp.
9 #include <kunit/device.h>
10 #include <kunit/resource.h>
11 #include <kunit/test.h>
47 static void bin_load_with_unknown_blocks(struct kunit *test) in bin_load_with_unknown_blocks()
49 struct cs_dsp_test *priv = test->priv; in bin_load_with_unknown_blocks()
50 struct cs_dsp_test_local *local = priv->local; in bin_load_with_unknown_blocks()
66 cs_dsp_mock_bin_add_raw_block(local->bin_builder, in bin_load_with_unknown_blocks()
71 cs_dsp_mock_bin_add_raw_block(local->bin_builder, in bin_load_with_unknown_blocks()
[all …]
/linux/Documentation/dev-tools/kunit/
H A Dstyle.rst1 .. SPDX-License-Identifier: GPL-2.0
7 To make finding, writing, and using KUnit tests as simple as possible, it is
9 below. While it is possible to write KUnit tests which do not follow these rules,
15 1. Porting tests to KUnit which are already known with an existing name.
17 example, non-deterministically producing false positives or negatives, or
29 ----------
32 or more KUnit test suites which test the same driver or part of the kernel. A
43 underscores. *Do not* include "test" or "kunit" directly in the subsystem name
44 unless we are actually testing other tests or the kunit framework itself. For
59 ``linear-ranges``
[all …]
/linux/include/linux/firmware/cirrus/
H A Dcs_dsp_test_utils.h1 /* SPDX-License-Identifier: GPL-2.0-only */
12 struct kunit;
17 * struct cs_dsp_test - base class for test utilities
19 * @test: Pointer to struct kunit instance.
24 struct kunit *test;
34 * struct cs_dsp_mock_alg_def - Info for creating a mock algorithm entry.
38 * @xm_base_words XM base address in DSP words.
40 * @ym_base_words YM base address in DSP words.
42 * @zm_base_words ZM base address in DSP words.
68 * struct cs_dsp_mock_xm_header - XM header builder

123