/Linux-v5.15/tools/perf/tests/ |
D | tests.h | 30 struct test { struct 32 int (*func)(struct test *test, int subtest); argument 44 int test__vmlinux_matches_kallsyms(struct test *test, int subtest); argument 45 int test__openat_syscall_event(struct test *test, int subtest); 46 int test__openat_syscall_event_on_all_cpus(struct test *test, int subtest); 47 int test__basic_mmap(struct test *test, int subtest); 48 int test__PERF_RECORD(struct test *test, int subtest); 49 int test__perf_evsel__roundtrip_name_test(struct test *test, int subtest); 50 int test__perf_evsel__tp_sched_test(struct test *test, int subtest); 51 int test__syscall_openat_tp_fields(struct test *test, int subtest); [all …]
|
/Linux-v5.15/tools/build/feature/ |
D | Makefile | 5 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 …]
|
D | test-all.c | 3 * test-all.c: Try to build all the main testcases at once. 14 # include "test-libpython.c" 18 # include "test-libpython-version.c" 22 # include "test-libperl.c" 26 # include "test-hello.c" 30 # include "test-libelf.c" 34 # include "test-get_current_dir_name.c" 38 # include "test-gettid.c" 42 # include "test-glibc.c" 46 # include "test-dwarf.c" [all …]
|
/Linux-v5.15/lib/kunit/ |
D | kunit-test.c | 3 * KUnit test for core test infrastructure. 8 #include <kunit/test.h> 19 struct kunit *test = data; in kunit_test_successful_try() local 20 struct kunit_try_catch_test_context *ctx = test->priv; in kunit_test_successful_try() 27 struct kunit *test = data; in kunit_test_no_catch() local 29 KUNIT_FAIL(test, "Catch should not be called\n"); in kunit_test_no_catch() 32 static void kunit_test_try_catch_successful_try_no_catch(struct kunit *test) in kunit_test_try_catch_successful_try_no_catch() argument 34 struct kunit_try_catch_test_context *ctx = test->priv; in kunit_test_try_catch_successful_try_no_catch() 38 test, in kunit_test_try_catch_successful_try_no_catch() 41 kunit_try_catch_run(try_catch, test); in kunit_test_try_catch_successful_try_no_catch() [all …]
|
D | kunit-example-test.c | 3 * Example KUnit test to show how to use KUnit. 9 #include <kunit/test.h> 12 * This is the most fundamental element of KUnit, the test case. A test case 14 * any expectations or assertions are not met, the test fails; otherwise, the 15 * test passes. 17 * In KUnit, a test case is just a function with the signature 19 * information about the current test. 21 static void example_simple_test(struct kunit *test) in example_simple_test() argument 25 * to test a piece of code, you set some expectations about what the in example_simple_test() 26 * code should do. KUnit then runs the test and verifies that the code's in example_simple_test() [all …]
|
D | test.c | 3 * Base unit test (KUnit) API. 9 #include <kunit/test.h> 10 #include <kunit/test-bug.h> 23 * Fail the current test and print an error message to the log. 64 "Print test stats: never (0), only for multiple subtests (1), or always (2)"); 84 static void kunit_print_test_stats(struct kunit *test, in kunit_print_test_stats() argument 90 kunit_log(KERN_INFO, test, in kunit_print_test_stats() 93 test->name, in kunit_print_test_stats() 153 struct kunit *test = is_test ? test_or_suite : NULL; in kunit_print_ok_not_ok() local 157 * We do not log the test suite results as doing so would in kunit_print_ok_not_ok() [all …]
|
/Linux-v5.15/include/kunit/ |
D | test.h | 3 * Base unit test (KUnit) API. 26 * struct kunit_resource - represents a *test managed resource* 32 * Represents a *test managed resource*, a resource which will automatically be 33 * cleaned up at the end of a test case. 66 * void *kunit_kmalloc(struct kunit *test, size_t size, gfp_t gfp) 73 * return kunit_alloc_resource(test, kunit_kmalloc_init, 80 * unique within the test instance. 94 /* Size of log associated with test. */ 112 * enum kunit_status - Type of result for a test or test suite 113 * @KUNIT_SUCCESS: Denotes the test suite has not failed nor been skipped [all …]
|
/Linux-v5.15/drivers/base/test/ |
D | property-entry-test.c | 6 #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-v5.15/drivers/thunderbolt/ |
D | test.c | 9 #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-v5.15/lib/ |
D | test_kasan.c | 25 #include <kunit/test.h> 46 * test, see the comment for KUNIT_EXPECT_KASAN_FAIL(). 48 static int kasan_test_init(struct kunit *test) in kasan_test_init() argument 51 kunit_err(test, "can't run KASAN tests with KASAN disabled"); in kasan_test_init() 57 kunit_add_named_resource(test, NULL, NULL, &resource, in kasan_test_init() 62 static void kasan_test_exit(struct kunit *test) in kasan_test_exit() argument 65 KUNIT_EXPECT_FALSE(test, fail_data.report_found); in kasan_test_exit() 70 * KASAN report; causes a test failure otherwise. This relies on a KUnit 75 * checking is auto-disabled. When this happens, this test handler reenables 89 #define KUNIT_EXPECT_KASAN_FAIL(test, expression) do { \ argument [all …]
|
D | list-test.c | 3 * KUnit test for the Kernel Linked-list structures. 8 #include <kunit/test.h> 17 static void list_test_list_init(struct kunit *test) in list_test_list_init() argument 19 /* Test the different ways of initialising a list. */ in list_test_list_init() 36 KUNIT_EXPECT_TRUE(test, list_empty_careful(&list1)); in list_test_list_init() 37 KUNIT_EXPECT_TRUE(test, list_empty_careful(&list2)); in list_test_list_init() 38 KUNIT_EXPECT_TRUE(test, list_empty_careful(&list3)); in list_test_list_init() 39 KUNIT_EXPECT_TRUE(test, list_empty_careful(list4)); in list_test_list_init() 40 KUNIT_EXPECT_TRUE(test, list_empty_careful(list5)); in list_test_list_init() 46 static void list_test_list_add(struct kunit *test) in list_test_list_add() argument [all …]
|
/Linux-v5.15/tools/pci/ |
D | pcitest.c | 3 * 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-v5.15/security/apparmor/ |
D | policy_unpack_test.c | 6 #include <kunit/test.h> 52 struct kunit *test, size_t buf_size) in build_aa_ext_struct() argument 57 buf = kunit_kzalloc(test, buf_size, GFP_USER); in build_aa_ext_struct() 58 KUNIT_EXPECT_NOT_ERR_OR_NULL(test, buf); in build_aa_ext_struct() 60 e = kunit_kmalloc(test, sizeof(*e), GFP_USER); in build_aa_ext_struct() 61 KUNIT_EXPECT_NOT_ERR_OR_NULL(test, e); in build_aa_ext_struct() 109 static int policy_unpack_test_init(struct kunit *test) in policy_unpack_test_init() argument 114 puf = kunit_kmalloc(test, sizeof(*puf), GFP_USER); in policy_unpack_test_init() 115 KUNIT_EXPECT_NOT_ERR_OR_NULL(test, puf); in policy_unpack_test_init() 118 puf->e = build_aa_ext_struct(puf, test, e_size); in policy_unpack_test_init() [all …]
|
/Linux-v5.15/drivers/misc/ |
D | pci_endpoint_test.c | 3 * Host side test driver to test endpoint functionality 28 #define DRV_MODULE_NAME "pci-endpoint-test" 128 static inline u32 pci_endpoint_test_readl(struct pci_endpoint_test *test, in pci_endpoint_test_readl() argument 131 return readl(test->base + offset); in pci_endpoint_test_readl() 134 static inline void pci_endpoint_test_writel(struct pci_endpoint_test *test, in pci_endpoint_test_writel() argument 137 writel(value, test->base + offset); in pci_endpoint_test_writel() 140 static inline u32 pci_endpoint_test_bar_readl(struct pci_endpoint_test *test, in pci_endpoint_test_bar_readl() argument 143 return readl(test->bar[bar] + offset); in pci_endpoint_test_bar_readl() 146 static inline void pci_endpoint_test_bar_writel(struct pci_endpoint_test *test, in pci_endpoint_test_bar_writel() argument 149 writel(value, test->bar[bar] + offset); in pci_endpoint_test_bar_writel() [all …]
|
/Linux-v5.15/usr/include/ |
D | Makefile | 23 no-header-test += asm/shmbuf.h 24 no-header-test += asm/signal.h 25 no-header-test += asm/ucontext.h 26 no-header-test += drm/vmwgfx_drm.h 27 no-header-test += linux/am437x-vpfe.h 28 no-header-test += linux/android/binder.h 29 no-header-test += linux/android/binderfs.h 30 no-header-test += linux/coda.h 31 no-header-test += linux/errqueue.h 32 no-header-test += linux/fsmap.h [all …]
|
/Linux-v5.15/drivers/mmc/host/ |
D | sdhci-of-aspeed-test.c | 4 #include <kunit/test.h> 6 static void aspeed_sdhci_phase_ddr52(struct kunit *test) in aspeed_sdhci_phase_ddr52() argument 10 KUNIT_EXPECT_EQ(test, 0, in aspeed_sdhci_phase_ddr52() 12 KUNIT_EXPECT_EQ(test, 0, in aspeed_sdhci_phase_ddr52() 14 KUNIT_EXPECT_EQ(test, 1, in aspeed_sdhci_phase_ddr52() 16 KUNIT_EXPECT_EQ(test, 1, in aspeed_sdhci_phase_ddr52() 18 KUNIT_EXPECT_EQ(test, 2, in aspeed_sdhci_phase_ddr52() 20 KUNIT_EXPECT_EQ(test, 3, in aspeed_sdhci_phase_ddr52() 22 KUNIT_EXPECT_EQ(test, 14, in aspeed_sdhci_phase_ddr52() 24 KUNIT_EXPECT_EQ(test, 15, in aspeed_sdhci_phase_ddr52() [all …]
|
/Linux-v5.15/drivers/mmc/core/ |
D | mmc_test.c | 38 * Limit the test area size to the maximum MMC HC erase group size. Note that 65 * @max_sz: test area size (in bytes) 110 * @card: card under test 111 * @testcase: number of test case 112 * @result: result of test run 126 * @card: card under test 136 * struct mmc_test_card - test information. 137 * @card: card under test 179 static int mmc_test_set_blksize(struct mmc_test_card *test, unsigned size) in mmc_test_set_blksize() argument 181 return mmc_set_blocklen(test->card, size); in mmc_test_set_blksize() [all …]
|
/Linux-v5.15/net/mptcp/ |
D | token_test.c | 2 #include <kunit/test.h> 6 static struct mptcp_subflow_request_sock *build_req_sock(struct kunit *test) in build_req_sock() argument 10 req = kunit_kzalloc(test, sizeof(struct mptcp_subflow_request_sock), in build_req_sock() 12 KUNIT_EXPECT_NOT_ERR_OR_NULL(test, req); in build_req_sock() 18 static void mptcp_token_test_req_basic(struct kunit *test) in mptcp_token_test_req_basic() argument 20 struct mptcp_subflow_request_sock *req = build_req_sock(test); in mptcp_token_test_req_basic() 23 KUNIT_ASSERT_EQ(test, 0, in mptcp_token_test_req_basic() 25 KUNIT_EXPECT_NE(test, 0, (int)req->token); in mptcp_token_test_req_basic() 26 KUNIT_EXPECT_PTR_EQ(test, null_msk, mptcp_token_get_sock(&init_net, req->token)); in mptcp_token_test_req_basic() 32 static struct inet_connection_sock *build_icsk(struct kunit *test) in build_icsk() argument [all …]
|
/Linux-v5.15/sound/soc/ |
D | soc-topology-test.c | 3 * soc-topology-test.c -- ALSA SoC Topology Kernel Unit Tests 12 #include <kunit/test.h> 25 .name = "sound-soc-topology-test-driver", 28 static int snd_soc_tplg_test_init(struct kunit *test) in snd_soc_tplg_test_init() argument 30 test_dev = root_device_register("sound-soc-topology-test"); in snd_soc_tplg_test_init() 40 static void snd_soc_tplg_test_exit(struct kunit *test) in snd_soc_tplg_test_exit() argument 49 * we can report test result 87 SND_SOC_DAILINK_DEF(platform, DAILINK_COMP_ARRAY(COMP_PLATFORM("sound-soc-topology-test"))); 104 .name = "sound-soc-topology-test", 214 /* ===== TEST CASES ========================================================= */ [all …]
|
/Linux-v5.15/Documentation/dev-tools/kunit/ |
D | usage.rst | 21 possible to unit test code that was otherwise un-unit-testable. 39 A `unit test <https://martinfowler.com/bliki/UnitTest.html>`_ is a test that 50 Test Cases 53 The fundamental unit in KUnit is the test case. A test case is a function with 54 the signature ``void (*)(struct kunit *test)``. It calls a function to be tested 59 void example_test_success(struct kunit *test) 63 void example_test_failure(struct kunit *test) 65 KUNIT_FAIL(test, "This test never passes."); 71 a special expectation that logs a message and causes the test case to fail. 76 something in a test. An expectation is called like a function. A test is made [all …]
|
/Linux-v5.15/kernel/ |
D | sysctl-test.c | 3 * KUnit test of proc sysctl. 6 #include <kunit/test.h> 16 * Test that proc_dointvec will not try to use a NULL .data field even when the 19 static void sysctl_test_api_dointvec_null_tbl_data(struct kunit *test) in sysctl_test_api_dointvec_null_tbl_data() argument 39 void __user *buffer = (void __user *)kunit_kzalloc(test, sizeof(int), in sysctl_test_api_dointvec_null_tbl_data() 49 KUNIT_EXPECT_EQ(test, 0, proc_dointvec(&null_data_table, in sysctl_test_api_dointvec_null_tbl_data() 52 KUNIT_EXPECT_EQ(test, 0, len); in sysctl_test_api_dointvec_null_tbl_data() 58 KUNIT_EXPECT_EQ(test, 0, proc_dointvec(&null_data_table, in sysctl_test_api_dointvec_null_tbl_data() 61 KUNIT_EXPECT_EQ(test, 0, len); in sysctl_test_api_dointvec_null_tbl_data() 65 * Similar to the previous test, we create a struct ctrl_table that has a .data [all …]
|
/Linux-v5.15/tools/perf/tests/attr/ |
D | README | 1 The struct perf_event_attr test (attr tests) support 28 the test definition, executes it and checks results. 32 Directory containing all attr test definitions. 35 perf record kill (test-record-basic) 36 perf record -b kill (test-record-branch-any) 37 perf record -j any kill (test-record-branch-filter-any) 38 perf record -j any_call kill (test-record-branch-filter-any_call) 39 perf record -j any_ret kill (test-record-branch-filter-any_ret) 40 perf record -j hv kill (test-record-branch-filter-hv) 41 perf record -j ind_call kill (test-record-branch-filter-ind_call) [all …]
|
/Linux-v5.15/mm/kfence/ |
D | kfence_test.c | 3 * Test cases for KFENCE memory safety error detector. Since the interface with 5 * should verify. For each test case checks the presence (or absence) of 14 #include <kunit/test.h> 55 * KFENCE report and related to the test. in probe_console() 70 /* Check if a report related to the test exists. */ 173 /* ===== Test cases ===== */ 180 static size_t setup_test_cache(struct kunit *test, size_t size, slab_flags_t flags, in setup_test_cache() argument 183 if (test->priv != TEST_PRIV_WANT_MEMCACHE) in setup_test_cache() 186 kunit_info(test, "%s: size=%zu, ctor=%ps\n", __func__, size, ctor); in setup_test_cache() 194 test_cache = kmem_cache_create("test", size, 1, flags, ctor); in setup_test_cache() [all …]
|
/Linux-v5.15/tools/testing/scatterlist/ |
D | main.c | 8 struct test { struct 30 static void fail(struct test *test, struct sg_table *st, const char *cond) in fail() argument 37 test->size, test->max_seg, test->expected_segments, st->nents, in fail() 40 printf("%u input PFNs:", test->num_pages); in fail() 41 for (i = 0; i < test->num_pages; i++) in fail() 42 printf(" %x", test->pfn[i]); in fail() 48 #define VALIDATE(cond, st, test) \ argument 50 fail((test), (st), #cond); 55 struct test *test, tests[] = { in main() local 86 for (i = 0, test = tests; test->expected_segments; test++, i++) { in main() [all …]
|
/Linux-v5.15/drivers/base/power/ |
D | qos-test.c | 5 #include <kunit/test.h> 8 /* Basic test for aggregating two "min" requests */ 9 static void freq_qos_test_min(struct kunit *test) in freq_qos_test_min() argument 20 KUNIT_EXPECT_EQ(test, ret, 1); in freq_qos_test_min() 22 KUNIT_EXPECT_EQ(test, ret, 1); in freq_qos_test_min() 24 KUNIT_EXPECT_EQ(test, freq_qos_read_value(&qos, FREQ_QOS_MIN), 2000); in freq_qos_test_min() 27 KUNIT_EXPECT_EQ(test, ret, 1); in freq_qos_test_min() 28 KUNIT_EXPECT_EQ(test, freq_qos_read_value(&qos, FREQ_QOS_MIN), 1000); in freq_qos_test_min() 31 KUNIT_EXPECT_EQ(test, ret, 1); in freq_qos_test_min() 32 KUNIT_EXPECT_EQ(test, freq_qos_read_value(&qos, FREQ_QOS_MIN), in freq_qos_test_min() [all …]
|