/lib/kunit/ |
D | kunit-test.c | 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() 43 KUNIT_EXPECT_TRUE(test, ctx->function_called); in kunit_test_try_catch_successful_try_no_catch() 48 struct kunit *test = data; in kunit_test_unsuccessful_try() local [all …]
|
D | test.c | 71 struct kunit *test = is_test ? test_or_suite : NULL; in kunit_print_ok_not_ok() local 86 kunit_log(KERN_INFO, test, KUNIT_SUBTEST_INDENT "%s %zd - %s", in kunit_print_ok_not_ok() 130 static void kunit_print_string_stream(struct kunit *test, in kunit_print_string_stream() argument 141 kunit_err(test, in kunit_print_string_stream() 144 kunit_err(test, "%s", fragment->fragment); in kunit_print_string_stream() 146 kunit_err(test, "\n"); in kunit_print_string_stream() 148 kunit_err(test, "%s", buf); in kunit_print_string_stream() 149 kunit_kfree(test, buf); in kunit_print_string_stream() 153 static void kunit_fail(struct kunit *test, struct kunit_assert *assert) in kunit_fail() argument 157 kunit_set_failure(test); in kunit_fail() [all …]
|
D | string-stream.c | 16 struct kunit *test; member 27 frag = kunit_kzalloc(ctx->test, sizeof(*frag), ctx->gfp); in string_stream_fragment_init() 31 frag->test = ctx->test; in string_stream_fragment_init() 32 frag->fragment = kunit_kmalloc(ctx->test, ctx->len, ctx->gfp); in string_stream_fragment_init() 46 kunit_kfree(frag->test, frag->fragment); in string_stream_fragment_free() 47 kunit_kfree(frag->test, frag); in string_stream_fragment_free() 51 struct kunit *test, int len, gfp_t gfp) in alloc_string_stream_fragment() argument 54 .test = test, in alloc_string_stream_fragment() 59 return kunit_alloc_resource(test, in alloc_string_stream_fragment() 68 return kunit_destroy_resource(frag->test, in string_stream_fragment_destroy() [all …]
|
D | string-stream-test.c | 14 static void string_stream_test_empty_on_creation(struct kunit *test) in string_stream_test_empty_on_creation() argument 16 struct string_stream *stream = alloc_string_stream(test, GFP_KERNEL); in string_stream_test_empty_on_creation() 18 KUNIT_EXPECT_TRUE(test, string_stream_is_empty(stream)); in string_stream_test_empty_on_creation() 21 static void string_stream_test_not_empty_after_add(struct kunit *test) in string_stream_test_not_empty_after_add() argument 23 struct string_stream *stream = alloc_string_stream(test, GFP_KERNEL); in string_stream_test_not_empty_after_add() 27 KUNIT_EXPECT_FALSE(test, string_stream_is_empty(stream)); in string_stream_test_not_empty_after_add() 30 static void string_stream_test_get_string(struct kunit *test) in string_stream_test_get_string() argument 32 struct string_stream *stream = alloc_string_stream(test, GFP_KERNEL); in string_stream_test_get_string() 39 KUNIT_ASSERT_STREQ(test, output, "Foo bar"); in string_stream_test_get_string()
|
D | Kconfig | 23 test suite, which allow users to see results of the last test suite 27 tristate "KUnit test for KUnit" if !KUNIT_ALL_TESTS 30 Enables the unit tests for the KUnit test framework. These tests test 31 the KUnit test framework itself; the tests are both written using 32 KUnit and test KUnit. This option should only be enabled for testing 37 tristate "Example test for KUnit" if !KUNIT_ALL_TESTS 40 Enables an example unit test that illustrates some of the basic 41 features of KUnit. This test only exists to help new users understand 42 what KUnit is and how it is used. Please refer to the example test 43 itself, lib/kunit/example-test.c, for more information. This option [all …]
|
D | kunit-example-test.c | 21 static void example_simple_test(struct kunit *test) in example_simple_test() argument 29 KUNIT_EXPECT_EQ(test, 1 + 1, 2); in example_simple_test() 36 static int example_test_init(struct kunit *test) in example_test_init() argument 38 kunit_info(test, "initializing\n"); in example_test_init()
|
D | try-catch.c | 61 struct kunit *test = try_catch->test; in kunit_try_catch_run() local 79 kunit_err(test, "try timed out\n"); in kunit_try_catch_run() 91 kunit_err(test, "wake_up_process() was never called\n"); in kunit_try_catch_run() 93 kunit_err(test, "Unknown error: %d\n", exit_code); in kunit_try_catch_run()
|
D | try-catch-impl.h | 18 struct kunit *test, in kunit_try_catch_init() argument 22 try_catch->test = test; in kunit_try_catch_init()
|
D | string-stream.h | 17 struct kunit *test; member 27 struct kunit *test; member 33 struct string_stream *alloc_string_stream(struct kunit *test, gfp_t gfp);
|
/lib/ |
D | test_kasan.c | 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() 60 static void kasan_test_exit(struct kunit *test) in kasan_test_exit() argument 82 #define KUNIT_EXPECT_KASAN_FAIL(test, expression) do { \ argument 88 kunit_add_named_resource(test, \ 99 KUNIT_EXPECT_EQ(test, \ 110 #define KASAN_TEST_NEEDS_CONFIG_ON(test, config) do { \ argument 112 kunit_info((test), "skipping, " #config " required"); \ 117 #define KASAN_TEST_NEEDS_CONFIG_OFF(test, config) do { \ argument 119 kunit_info((test), "skipping, " #config " enabled"); \ [all …]
|
D | test_printf.c | 136 #define test(expect, fmt, ...) \ macro 145 test("", &nul); in test_basic() 146 test("100%", "100%%"); in test_basic() 147 test("xxx%yyy", "xxx%cyyy", '%'); in test_basic() 154 test("0x1234abcd ", "%#-12x", 0x1234abcd); in test_number() 155 test(" 0x1234abcd", "%#12x", 0x1234abcd); in test_number() 156 …test("0|001| 12|+123| 1234|-123|-1234", "%d|%03d|%3d|%+d|% d|%+d|% d", 0, 1, 12, 123, 1234, -123, … in test_number() 157 test("0|1|1|128|255", "%hhu|%hhu|%hhu|%hhu|%hhu", 0, 1, 257, 128, -1); in test_number() 158 test("0|1|1|-128|-1", "%hhd|%hhd|%hhd|%hhd|%hhd", 0, 1, 257, 128, -1); in test_number() 159 test("2015122420151225", "%ho%ho%#ho", 1037, 5282, -11627); in test_number() [all …]
|
D | list-test.c | 17 static void list_test_list_init(struct kunit *test) in list_test_list_init() argument 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 55 KUNIT_EXPECT_PTR_EQ(test, list.next, &b); in list_test_list_add() 56 KUNIT_EXPECT_PTR_EQ(test, b.prev, &list); in list_test_list_add() 57 KUNIT_EXPECT_PTR_EQ(test, b.next, &a); in list_test_list_add() [all …]
|
D | crc32test.c | 558 } const test[] __initconst = variable 678 bytes += 2*test[i].length; in crc32c_test() 680 crc ^= __crc32c_le(test[i].crc, test_buf + in crc32c_test() 681 test[i].start, test[i].length); in crc32c_test() 689 if (test[i].crc32c_le != __crc32c_le(test[i].crc, test_buf + in crc32c_test() 690 test[i].start, test[i].length)) in crc32c_test() 717 crc_full = __crc32c_le(test[i].crc, test_buf + test[i].start, in crc32c_combine_test() 718 test[i].length); in crc32c_combine_test() 719 for (j = 0; j <= test[i].length; ++j) { in crc32c_combine_test() 721 u32 len1 = j, len2 = test[i].length - j; in crc32c_combine_test() [all …]
|
D | test_bits.c | 10 static void genmask_test(struct kunit *test) in genmask_test() argument 12 KUNIT_EXPECT_EQ(test, 1ul, GENMASK(0, 0)); in genmask_test() 13 KUNIT_EXPECT_EQ(test, 3ul, GENMASK(1, 0)); in genmask_test() 14 KUNIT_EXPECT_EQ(test, 6ul, GENMASK(2, 1)); in genmask_test() 15 KUNIT_EXPECT_EQ(test, 0xFFFFFFFFul, GENMASK(31, 0)); in genmask_test() 27 static void genmask_ull_test(struct kunit *test) in genmask_ull_test() argument 29 KUNIT_EXPECT_EQ(test, 1ull, GENMASK_ULL(0, 0)); in genmask_ull_test() 30 KUNIT_EXPECT_EQ(test, 3ull, GENMASK_ULL(1, 0)); in genmask_ull_test() 31 KUNIT_EXPECT_EQ(test, 0x000000ffffe00000ull, GENMASK_ULL(39, 21)); in genmask_ull_test() 32 KUNIT_EXPECT_EQ(test, 0xffffffffffffffffull, GENMASK_ULL(63, 0)); in genmask_ull_test() [all …]
|
D | test_linear_ranges.c | 123 static void range_test_get_value(struct kunit *test) in range_test_get_value() argument 131 KUNIT_EXPECT_EQ(test, 0, ret); in range_test_get_value() 132 KUNIT_EXPECT_EQ(test, val, range1_vals[i]); in range_test_get_value() 137 KUNIT_EXPECT_EQ(test, 0, ret); in range_test_get_value() 138 KUNIT_EXPECT_EQ(test, val, range2_vals[i]); in range_test_get_value() 141 KUNIT_EXPECT_NE(test, 0, ret); in range_test_get_value() 144 static void range_test_get_selector_high(struct kunit *test) in range_test_get_selector_high() argument 153 KUNIT_EXPECT_EQ(test, 0, ret); in range_test_get_selector_high() 154 KUNIT_EXPECT_EQ(test, sel, range1_sels[i]); in range_test_get_selector_high() 155 KUNIT_EXPECT_TRUE(test, found); in range_test_get_selector_high() [all …]
|
D | test_user_copy.c | 34 #define test(condition, msg, ...) \ macro 52 if (test(size < 2 * PAGE_SIZE, "buffer too small")) in test_check_nonzero_user() 87 ret |= test(copy_to_user(umem, kmem, size), in test_check_nonzero_user() 96 ret |= test(retval != expected, in test_check_nonzero_user() 113 ret = test(umem_src == NULL, "kmalloc failed"); in test_copy_struct_from_user() 118 ret = test(expected == NULL, "kmalloc failed"); in test_copy_struct_from_user() 124 ret |= test(copy_to_user(umem, umem_src, size), in test_copy_struct_from_user() 134 ret |= test(copy_struct_from_user(kmem, ksize, umem, usize), in test_copy_struct_from_user() 136 ret |= test(memcmp(kmem, expected, ksize), in test_copy_struct_from_user() 147 ret |= test(copy_struct_from_user(kmem, ksize, umem, usize), in test_copy_struct_from_user() [all …]
|
D | test_hexdump.c | 68 int groupsize, char *test, in test_hexdump_prepare_test() argument 97 p = test; in test_hexdump_prepare_test() 114 } while (p < test + rs * 2 + rs / gs + 1); in test_hexdump_prepare_test() 128 char test[TEST_HEXDUMP_BUF_SIZE]; in test_hexdump() local 137 memset(test, FILL_CHAR, sizeof(test)); in test_hexdump() 138 test_hexdump_prepare_test(len, rowsize, groupsize, test, sizeof(test), in test_hexdump() 141 if (memcmp(test, real, TEST_HEXDUMP_BUF_SIZE)) { in test_hexdump() 144 pr_err("Expect: '%s'\n", test); in test_hexdump() 164 char test[TEST_HEXDUMP_BUF_SIZE]; in test_hexdump_overflow() local 190 test_hexdump_prepare_test(len, rs, gs, test, sizeof(test), ascii); in test_hexdump_overflow() [all …]
|
D | test-kstrtox.c | 5 #define for_each_test(i, test) \ argument 6 for (i = 0; i < ARRAY_SIZE(test); i++) 13 #define DEFINE_TEST_FAIL(test) \ argument 14 const struct test_fail test[] __initconst 23 #define DEFINE_TEST_OK(type, test) \ argument 24 const type test[] __initconst 26 #define TEST_FAIL(fn, type, fmt, test) \ argument 30 for_each_test(i, test) { \ 31 const struct test_fail *t = &test[i]; \ 45 #define TEST_OK(fn, type, fmt, test) \ argument [all …]
|
D | test_string.c | 184 int test, subtest; in string_selftest_init() local 186 test = 1; in string_selftest_init() 191 test = 2; in string_selftest_init() 196 test = 3; in string_selftest_init() 201 test = 4; in string_selftest_init() 206 test = 5; in string_selftest_init() 214 pr_crit("String selftest failure %d.%08x\n", test, subtest); in string_selftest_init()
|
D | test_bitmap.c | 440 struct test_bitmap_parselist test = parse_tests[i]; in test_bitmap_parse() local 441 size_t len = test.flags & NO_LEN ? UINT_MAX : strlen(test.in); in test_bitmap_parse() 444 err = bitmap_parse(test.in, len, bmap, test.nbits); in test_bitmap_parse() 447 if (err != test.errno) { in test_bitmap_parse() 449 i, test.in, err, test.errno); in test_bitmap_parse() 453 if (!err && test.expected in test_bitmap_parse() 454 && !__bitmap_equal(bmap, test.expected, test.nbits)) { in test_bitmap_parse() 456 i, test.in, bmap[0], in test_bitmap_parse() 457 *test.expected); in test_bitmap_parse() 461 if (test.flags & PARSE_TIME) in test_bitmap_parse() [all …]
|
D | Kconfig.kfence | 22 afford to use KASAN, continue using KASAN, for example in test 65 this option is to stress test KFENCE with concurrent error reports 71 tristate "KFENCE integration test suite" if !KUNIT_ALL_TESTS 79 Say Y here if you want the test to be built into the kernel and run 80 during boot; say M if you want the test to build as a module; say N
|
D | globtest.c | 19 static bool __pure __init test(char const *pat, char const *str, bool expected) in test() function 148 successes += test(pat, p, expected); in glob_init()
|
D | Kconfig.kcsan | 43 # Compiler capabilities that should not fail the test if they are unavailable. 68 Run KCSAN selftests on boot. On test failure, causes the kernel to 73 tristate "KCSAN test for integrated runtime behaviour" 77 KCSAN test focusing on behaviour of the integrated runtime. Tests 79 console. Makes use of KUnit for test organization, and the Torture 80 framework for test thread control. 82 Each test case may run at least up to KCSAN_REPORT_ONCE_IN_MS 84 kernel and KCSAN test with KCSAN_REPORT_ONCE_IN_MS set to a lower 87 Say Y here if you want the test to be built into the kernel and run 88 during boot; say M if you want the test to build as a module; say N
|
D | atomic64_test.c | 36 #define FAMILY_TEST(test, bit, op, args...) \ argument 38 test(bit, op, ##args); \ 39 test(bit, op##_acquire, ##args); \ 40 test(bit, op##_release, ##args); \ 41 test(bit, op##_relaxed, ##args); \
|
D | Kconfig.debug | 682 tristate "Simple test for the kernel memory leak detector" 779 This option provides a debug method which can be used to test 1277 will test all possible w/w mutex interface abuse with the 1379 Say Y here if you want the kernel to run a short self-test during 1380 bootup. The self-test checks whether common types of locking bugs 1407 with this test harness. 1740 specified notifier chain callbacks. It is useful to test the error 1815 value of theses functions. This is useful to test error paths of code. 1883 an error value and have to handle it. This is useful to test the 1892 useful to test the error handling in the mmc block device [all …]
|