Home
last modified time | relevance | path

Searched full:test (Results 1 – 25 of 5617) sorted by relevance

12345678910>>...225

/linux-6.6/drivers/gpu/drm/tests/
Ddrm_cmdline_parser_test.c7 #include <kunit/test.h>
14 static void drm_test_cmdline_force_e_only(struct kunit *test) in drm_test_cmdline_force_e_only() argument
19 KUNIT_ASSERT_TRUE(test, drm_mode_parse_command_line_for_connector(cmdline, in drm_test_cmdline_force_e_only()
21 KUNIT_EXPECT_FALSE(test, mode.specified); in drm_test_cmdline_force_e_only()
22 KUNIT_EXPECT_FALSE(test, mode.refresh_specified); in drm_test_cmdline_force_e_only()
23 KUNIT_EXPECT_FALSE(test, mode.bpp_specified); in drm_test_cmdline_force_e_only()
25 KUNIT_EXPECT_FALSE(test, mode.rb); in drm_test_cmdline_force_e_only()
26 KUNIT_EXPECT_FALSE(test, mode.cvt); in drm_test_cmdline_force_e_only()
27 KUNIT_EXPECT_FALSE(test, mode.interlace); in drm_test_cmdline_force_e_only()
28 KUNIT_EXPECT_FALSE(test, mode.margins); in drm_test_cmdline_force_e_only()
[all …]
Ddrm_format_test.c3 * Test cases for the drm_format functions
8 #include <kunit/test.h>
12 static void drm_test_format_block_width_invalid(struct kunit *test) in drm_test_format_block_width_invalid() argument
16 KUNIT_EXPECT_EQ(test, drm_format_info_block_width(info, 0), 0); in drm_test_format_block_width_invalid()
17 KUNIT_EXPECT_EQ(test, drm_format_info_block_width(info, -1), 0); in drm_test_format_block_width_invalid()
18 KUNIT_EXPECT_EQ(test, drm_format_info_block_width(info, 1), 0); in drm_test_format_block_width_invalid()
21 static void drm_test_format_block_width_one_plane(struct kunit *test) in drm_test_format_block_width_one_plane() argument
25 KUNIT_ASSERT_NOT_NULL(test, info); in drm_test_format_block_width_one_plane()
27 KUNIT_EXPECT_EQ(test, drm_format_info_block_width(info, 0), 1); in drm_test_format_block_width_one_plane()
28 KUNIT_EXPECT_EQ(test, drm_format_info_block_width(info, 1), 0); in drm_test_format_block_width_one_plane()
[all …]
/linux-6.6/tools/testing/kunit/
Dkunit_parser.py3 # Parses KTAP test results from a kernel dmesg log and incrementally prints
4 # results with reader-friendly format. Stores and returns test results in a
5 # Test object.
22 class Test: class
24 A class to represent a test parsed from KTAP results. All KTAP
25 results within a test log are stored in a main Test object as
29 status : TestStatus - status of the test
30 name : str - name of the test
32 test case and None if unknown expected number of subtests)
33 subtests : List[Test] - list of subtests
[all …]
/linux-6.6/lib/kunit/
Dkunit-test.c3 * KUnit test for core test infrastructure.
8 #include <kunit/test.h>
9 #include <kunit/test-bug.h>
20 struct kunit *test = data; in kunit_test_successful_try() local
21 struct kunit_try_catch_test_context *ctx = test->priv; in kunit_test_successful_try()
28 struct kunit *test = data; in kunit_test_no_catch() local
30 KUNIT_FAIL(test, "Catch should not be called\n"); in kunit_test_no_catch()
33 static void kunit_test_try_catch_successful_try_no_catch(struct kunit *test) in kunit_test_try_catch_successful_try_no_catch() argument
35 struct kunit_try_catch_test_context *ctx = test->priv; in kunit_test_try_catch_successful_try_no_catch()
39 test, in kunit_test_try_catch_successful_try_no_catch()
[all …]
Dkunit-example-test.c3 * Example KUnit test to show how to use KUnit.
9 #include <kunit/test.h>
13 * This is the most fundamental element of KUnit, the test case. A test case
15 * any expectations or assertions are not met, the test fails; otherwise, the
16 * test passes.
18 * In KUnit, a test case is just a function with the signature
20 * information about the current test.
22 static void example_simple_test(struct kunit *test) in example_simple_test() argument
26 * to test a piece of code, you set some expectations about what the in example_simple_test()
27 * code should do. KUnit then runs the test and verifies that the code's in example_simple_test()
[all …]
Dexecutor_test.c3 * KUnit test for the KUnit executor.
9 #include <kunit/test.h>
12 static void kfree_at_end(struct kunit *test, const void *to_free);
13 static struct kunit_suite *alloc_fake_suite(struct kunit *test,
17 static void dummy_test(struct kunit *test) {} in dummy_test() argument
26 static void parse_filter_test(struct kunit *test) in parse_filter_test() argument
31 KUNIT_EXPECT_STREQ(test, filter.suite_glob, "suite"); in parse_filter_test()
32 KUNIT_EXPECT_FALSE(test, filter.test_glob); in parse_filter_test()
36 kunit_parse_glob_filter(&filter, "suite.test"); in parse_filter_test()
37 KUNIT_EXPECT_STREQ(test, filter.suite_glob, "suite"); in parse_filter_test()
[all …]
Dtest.c3 * Base unit test (KUnit) API.
10 #include <kunit/test.h>
11 #include <kunit/test-bug.h>
26 * Hook to fail the current test and print an error message to the log.
76 "Print test stats: never (0), only for multiple subtests (1), or always (2)");
96 static void kunit_print_test_stats(struct kunit *test, in kunit_print_test_stats() argument
102 kunit_log(KERN_INFO, test, in kunit_print_test_stats()
105 test->name, in kunit_print_test_stats()
172 /* Currently supported test levels */
182 * We do not log the test suite header as doing so would in kunit_print_suite_start()
[all …]
/linux-6.6/drivers/platform/chrome/
Dcros_ec_proto_test.c6 #include <kunit/test.h>
26 static void cros_ec_proto_test_prepare_tx_legacy_normal(struct kunit *test) in cros_ec_proto_test_prepare_tx_legacy_normal() argument
28 struct cros_ec_proto_test_priv *priv = test->priv; in cros_ec_proto_test_prepare_tx_legacy_normal()
45 KUNIT_EXPECT_EQ(test, ret, EC_MSG_TX_PROTO_BYTES + EC_PROTO2_MAX_PARAM_SIZE); in cros_ec_proto_test_prepare_tx_legacy_normal()
46 KUNIT_EXPECT_EQ(test, ec_dev->dout[0], EC_CMD_VERSION0); in cros_ec_proto_test_prepare_tx_legacy_normal()
47 KUNIT_EXPECT_EQ(test, ec_dev->dout[1], EC_CMD_HELLO); in cros_ec_proto_test_prepare_tx_legacy_normal()
48 KUNIT_EXPECT_EQ(test, ec_dev->dout[2], EC_PROTO2_MAX_PARAM_SIZE); in cros_ec_proto_test_prepare_tx_legacy_normal()
49 KUNIT_EXPECT_EQ(test, EC_MSG_TX_HEADER_BYTES, 3); in cros_ec_proto_test_prepare_tx_legacy_normal()
50 KUNIT_EXPECT_EQ(test, ec_dev->dout[EC_MSG_TX_HEADER_BYTES + 0], 0xde); in cros_ec_proto_test_prepare_tx_legacy_normal()
51 KUNIT_EXPECT_EQ(test, ec_dev->dout[EC_MSG_TX_HEADER_BYTES + 1], 0xad); in cros_ec_proto_test_prepare_tx_legacy_normal()
[all …]
/linux-6.6/tools/build/feature/
DMakefile5 test-all.bin \
6 test-backtrace.bin \
7 test-bionic.bin \
8 test-dwarf.bin \
9 test-dwarf_getlocations.bin \
10 test-eventfd.bin \
11 test-fortify-source.bin \
12 test-get_current_dir_name.bin \
13 test-glibc.bin \
14 test-gtk2.bin \
[all …]
/linux-6.6/mm/kasan/
Dkasan_test.c10 #include <kunit/test.h>
88 static void kasan_test_exit(struct kunit *test) in kasan_test_exit() argument
90 KUNIT_EXPECT_FALSE(test, READ_ONCE(test_status.report_found)); in kasan_test_exit()
95 * KASAN report; causes a test failure otherwise. This relies on a KUnit
100 * checking is auto-disabled. When this happens, this test handler reenables
114 #define KUNIT_EXPECT_KASAN_FAIL(test, expression) do { \ argument
118 KUNIT_EXPECT_FALSE(test, READ_ONCE(test_status.report_found)); \
125 KUNIT_FAIL(test, KUNIT_SUBTEST_INDENT "KASAN failure " \
140 #define KASAN_TEST_NEEDS_CONFIG_ON(test, config) do { \ argument
142 kunit_skip((test), "Test requires " #config "=y"); \
[all …]
/linux-6.6/drivers/base/test/
Dproperty-entry-test.c6 #include <kunit/test.h>
10 static void pe_test_uints(struct kunit *test) in pe_test_uints() argument
28 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, node); in pe_test_uints()
31 KUNIT_EXPECT_EQ(test, error, 1); in pe_test_uints()
34 KUNIT_EXPECT_EQ(test, error, 0); in pe_test_uints()
35 KUNIT_EXPECT_EQ(test, val_u8, 8); in pe_test_uints()
38 KUNIT_EXPECT_EQ(test, error, 0); in pe_test_uints()
39 KUNIT_EXPECT_EQ(test, array_u8[0], 8); in pe_test_uints()
42 KUNIT_EXPECT_NE(test, error, 0); in pe_test_uints()
45 KUNIT_EXPECT_NE(test, error, 0); in pe_test_uints()
[all …]
/linux-6.6/drivers/clk/
Dclk-gate_test.c3 * Kunit test for clk gate basic type
9 #include <kunit/test.h>
11 static void clk_gate_register_test_dev(struct kunit *test) in clk_gate_register_test_dev() argument
17 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, pdev); in clk_gate_register_test_dev()
21 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ret); in clk_gate_register_test_dev()
22 KUNIT_EXPECT_STREQ(test, "test_gate", clk_hw_get_name(ret)); in clk_gate_register_test_dev()
23 KUNIT_EXPECT_EQ(test, 0UL, clk_hw_get_flags(ret)); in clk_gate_register_test_dev()
29 static void clk_gate_register_test_parent_names(struct kunit *test) in clk_gate_register_test_parent_names() argument
36 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, parent); in clk_gate_register_test_parent_names()
40 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ret); in clk_gate_register_test_parent_names()
[all …]
Dclk_test.c3 * Kunit test for clk rate management
11 #include <kunit/test.h>
167 static int clk_test_init_with_ops(struct kunit *test, const struct clk_ops *ops) in clk_test_init_with_ops() argument
173 ctx = kunit_kzalloc(test, sizeof(*ctx), GFP_KERNEL); in clk_test_init_with_ops()
177 test->priv = ctx; in clk_test_init_with_ops()
190 static int clk_test_init(struct kunit *test) in clk_test_init() argument
192 return clk_test_init_with_ops(test, &clk_dummy_rate_ops); in clk_test_init()
195 static int clk_maximize_test_init(struct kunit *test) in clk_maximize_test_init() argument
197 return clk_test_init_with_ops(test, &clk_dummy_maximize_rate_ops); in clk_maximize_test_init()
200 static int clk_minimize_test_init(struct kunit *test) in clk_minimize_test_init() argument
[all …]
/linux-6.6/include/kunit/
Dtest.h3 * Base unit test (KUnit) API.
37 /* Size of log associated with test. */
56 * enum kunit_status - Type of result for a test or test suite
57 * @KUNIT_SUCCESS: Denotes the test suite has not failed nor been skipped
58 * @KUNIT_FAILURE: Denotes the test has failed.
59 * @KUNIT_SKIPPED: Denotes the test has been skipped.
84 /* Holds attributes for each test case and suite */
90 * struct kunit_case - represents an individual test case.
92 * @run_case: the function representing the actual test case.
93 * @name: the name of the test case.
[all …]
/linux-6.6/drivers/thunderbolt/
Dtest.c9 #include <kunit/test.h>
31 static void kunit_ida_init(struct kunit *test, struct ida *ida) in kunit_ida_init() argument
33 kunit_alloc_resource(test, __ida_init, __ida_destroy, GFP_KERNEL, ida); in kunit_ida_init()
36 static struct tb_switch *alloc_switch(struct kunit *test, u64 route, in alloc_switch() argument
43 sw = kunit_kzalloc(test, sizeof(*sw), GFP_KERNEL); in alloc_switch()
55 sw->ports = kunit_kzalloc(test, size, GFP_KERNEL); in alloc_switch()
64 kunit_ida_init(test, &sw->ports[i].in_hopids); in alloc_switch()
65 kunit_ida_init(test, &sw->ports[i].out_hopids); in alloc_switch()
72 static struct tb_switch *alloc_host(struct kunit *test) in alloc_host() argument
76 sw = alloc_switch(test, 0, 7, 13); in alloc_host()
[all …]
/linux-6.6/tools/pci/
Dpcitest.c3 * Userspace PCI Endpoint Test Module
41 static int run_test(struct pci_test *test) in run_test() argument
47 fd = open(test->device, O_RDWR); in run_test()
49 perror("can't open PCI Endpoint Test device"); in run_test()
53 if (test->barnum >= 0 && test->barnum <= 5) { in run_test()
54 ret = ioctl(fd, PCITEST_BAR, test->barnum); in run_test()
55 fprintf(stdout, "BAR%d:\t\t", test->barnum); in run_test()
57 fprintf(stdout, "TEST FAILED\n"); in run_test()
62 if (test->set_irqtype) { in run_test()
63 ret = ioctl(fd, PCITEST_SET_IRQTYPE, test->irqtype); in run_test()
[all …]
/linux-6.6/drivers/gpu/drm/ttm/tests/
Dttm_pool_test.c30 static int ttm_pool_test_init(struct kunit *test) in ttm_pool_test_init() argument
34 priv = kunit_kzalloc(test, sizeof(*priv), GFP_KERNEL); in ttm_pool_test_init()
35 KUNIT_ASSERT_NOT_NULL(test, priv); in ttm_pool_test_init()
37 priv->devs = ttm_test_devices_basic(test); in ttm_pool_test_init()
38 test->priv = priv; in ttm_pool_test_init()
43 static void ttm_pool_test_fini(struct kunit *test) in ttm_pool_test_fini() argument
45 struct ttm_pool_test_priv *priv = test->priv; in ttm_pool_test_fini()
47 ttm_test_devices_put(test, priv->devs); in ttm_pool_test_fini()
50 static struct ttm_tt *ttm_tt_kunit_init(struct kunit *test, in ttm_tt_kunit_init() argument
55 struct ttm_pool_test_priv *priv = test->priv; in ttm_tt_kunit_init()
[all …]
Dttm_device_test.c18 static void ttm_device_init_basic(struct kunit *test) in ttm_device_init_basic() argument
20 struct ttm_test_devices *priv = test->priv; in ttm_device_init_basic()
25 ttm_dev = kunit_kzalloc(test, sizeof(*ttm_dev), GFP_KERNEL); in ttm_device_init_basic()
26 KUNIT_ASSERT_NOT_NULL(test, ttm_dev); in ttm_device_init_basic()
29 KUNIT_ASSERT_EQ(test, err, 0); in ttm_device_init_basic()
31 KUNIT_EXPECT_PTR_EQ(test, ttm_dev->funcs, &ttm_dev_funcs); in ttm_device_init_basic()
32 KUNIT_ASSERT_NOT_NULL(test, ttm_dev->wq); in ttm_device_init_basic()
33 KUNIT_ASSERT_NOT_NULL(test, ttm_dev->man_drv[TTM_PL_SYSTEM]); in ttm_device_init_basic()
36 KUNIT_ASSERT_NOT_NULL(test, ttm_sys_man); in ttm_device_init_basic()
37 KUNIT_EXPECT_TRUE(test, ttm_sys_man->use_tt); in ttm_device_init_basic()
[all …]
/linux-6.6/security/apparmor/
Dpolicy_unpack_test.c6 #include <kunit/test.h>
55 struct kunit *test, size_t buf_size) in build_aa_ext_struct() argument
60 buf = kunit_kzalloc(test, buf_size, GFP_USER); in build_aa_ext_struct()
61 KUNIT_EXPECT_NOT_ERR_OR_NULL(test, buf); in build_aa_ext_struct()
63 e = kunit_kmalloc(test, sizeof(*e), GFP_USER); in build_aa_ext_struct()
64 KUNIT_EXPECT_NOT_ERR_OR_NULL(test, e); in build_aa_ext_struct()
111 static int policy_unpack_test_init(struct kunit *test) in policy_unpack_test_init() argument
116 puf = kunit_kmalloc(test, sizeof(*puf), GFP_USER); in policy_unpack_test_init()
117 KUNIT_EXPECT_NOT_ERR_OR_NULL(test, puf); in policy_unpack_test_init()
120 puf->e = build_aa_ext_struct(puf, test, e_size); in policy_unpack_test_init()
[all …]
/linux-6.6/lib/
Dlist-test.c3 * KUnit test for the Kernel Linked-list structures.
8 #include <kunit/test.h>
18 static void list_test_list_init(struct kunit *test) in list_test_list_init() argument
20 /* Test the different ways of initialising a list. */ in list_test_list_init()
37 KUNIT_EXPECT_TRUE(test, list_empty_careful(&list1)); in list_test_list_init()
38 KUNIT_EXPECT_TRUE(test, list_empty_careful(&list2)); in list_test_list_init()
39 KUNIT_EXPECT_TRUE(test, list_empty_careful(&list3)); in list_test_list_init()
40 KUNIT_EXPECT_TRUE(test, list_empty_careful(list4)); in list_test_list_init()
41 KUNIT_EXPECT_TRUE(test, list_empty_careful(list5)); in list_test_list_init()
47 static void list_test_list_add(struct kunit *test) in list_test_list_add() argument
[all …]
Dkunit_iov_iter.c2 /* I/O iterator tests. This can only test kernel-backed iterator types.
15 #include <kunit/test.h>
47 static void *__init iov_kunit_create_buffer(struct kunit *test, in iov_kunit_create_buffer() argument
55 pages = kunit_kcalloc(test, npages, sizeof(struct page *), GFP_KERNEL); in iov_kunit_create_buffer()
56 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, pages); in iov_kunit_create_buffer()
62 KUNIT_ASSERT_EQ(test, got, npages); in iov_kunit_create_buffer()
66 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, buffer); in iov_kunit_create_buffer()
68 kunit_add_action_or_reset(test, iov_kunit_unmap, buffer); in iov_kunit_create_buffer()
72 static void __init iov_kunit_load_kvec(struct kunit *test, in iov_kunit_load_kvec() argument
84 KUNIT_ASSERT_GE(test, pr->to, pr->from); in iov_kunit_load_kvec()
[all …]
/linux-6.6/drivers/net/ethernet/microchip/vcap/
Dvcap_api_kunit.c3 * Microchip VCAP API kunit test suite
6 #include <kunit/test.h>
11 /* First we have the test infrastructure that emulates the platform
246 static void test_vcap_xn_rule_creator(struct kunit *test, int cid, in test_vcap_xn_rule_creator() argument
285 KUNIT_ASSERT_NE(test, VCAP_KFS_NO_VALUE, keyset); in test_vcap_xn_rule_creator()
290 KUNIT_EXPECT_PTR_NE(test, NULL, rule); in test_vcap_xn_rule_creator()
304 KUNIT_EXPECT_EQ(test, 0, ret); in test_vcap_xn_rule_creator()
305 KUNIT_EXPECT_EQ(test, keyset, rule->keyset); in test_vcap_xn_rule_creator()
306 KUNIT_EXPECT_EQ(test, actionset, rule->actionset); in test_vcap_xn_rule_creator()
307 KUNIT_EXPECT_EQ(test, size, ri->size); in test_vcap_xn_rule_creator()
[all …]
/linux-6.6/drivers/misc/
Dpci_endpoint_test.c3 * Host side test driver to test endpoint functionality
28 #define DRV_MODULE_NAME "pci-endpoint-test"
129 static inline u32 pci_endpoint_test_readl(struct pci_endpoint_test *test, in pci_endpoint_test_readl() argument
132 return readl(test->base + offset); in pci_endpoint_test_readl()
135 static inline void pci_endpoint_test_writel(struct pci_endpoint_test *test, in pci_endpoint_test_writel() argument
138 writel(value, test->base + offset); in pci_endpoint_test_writel()
141 static inline u32 pci_endpoint_test_bar_readl(struct pci_endpoint_test *test, in pci_endpoint_test_bar_readl() argument
144 return readl(test->bar[bar] + offset); in pci_endpoint_test_bar_readl()
147 static inline void pci_endpoint_test_bar_writel(struct pci_endpoint_test *test, in pci_endpoint_test_bar_writel() argument
150 writel(value, test->bar[bar] + offset); in pci_endpoint_test_bar_writel()
[all …]
/linux-6.6/Documentation/dev-tools/kunit/
Dusage.rst6 Test Cases
9 The fundamental unit in KUnit is the test case. A test case is a function with
10 the signature ``void (*)(struct kunit *test)``. It calls the function under test
15 void example_test_success(struct kunit *test)
19 void example_test_failure(struct kunit *test)
21 KUNIT_FAIL(test, "This test never passes.");
27 which is a special expectation that logs a message and causes the test case to
33 test. An expectation is called like a function. A test is made by setting
34 expectations about the behavior of a piece of code under test. When one or more
35 expectations fail, the test case fails and information about the failure is
[all …]
/linux-6.6/drivers/firewire/
Duapi-test.c8 #include <kunit/test.h>
12 static void structure_layout_event_response(struct kunit *test) in structure_layout_event_response() argument
16 KUNIT_EXPECT_EQ(test, 20, sizeof(struct fw_cdev_event_response)); in structure_layout_event_response()
19 KUNIT_EXPECT_EQ(test, 24, sizeof(struct fw_cdev_event_response)); in structure_layout_event_response()
22 KUNIT_EXPECT_EQ(test, 0, offsetof(struct fw_cdev_event_response, closure)); in structure_layout_event_response()
23 KUNIT_EXPECT_EQ(test, 8, offsetof(struct fw_cdev_event_response, type)); in structure_layout_event_response()
24 KUNIT_EXPECT_EQ(test, 12, offsetof(struct fw_cdev_event_response, rcode)); in structure_layout_event_response()
25 KUNIT_EXPECT_EQ(test, 16, offsetof(struct fw_cdev_event_response, length)); in structure_layout_event_response()
26 KUNIT_EXPECT_EQ(test, 20, offsetof(struct fw_cdev_event_response, data)); in structure_layout_event_response()
30 static void structure_layout_event_request3(struct kunit *test) in structure_layout_event_request3() argument
[all …]

12345678910>>...225