Lines Matching full:test
15 Linux, and formats the test results.
31 test targets as well. The ``.kunitconfig`` should also contain any other config
114 Build and run your kernel as usual. Test output will be written to the kernel
122 Writing your first test
125 In your kernel repo let's add some code that we can test. Create a file
158 Now we are ready to write the test. The test will be in
159 ``drivers/misc/example-test.c``:
163 #include <kunit/test.h>
166 /* Define the test cases. */
168 static void misc_example_add_test_basic(struct kunit *test)
170 KUNIT_EXPECT_EQ(test, 1, misc_example_add(1, 0));
171 KUNIT_EXPECT_EQ(test, 2, misc_example_add(1, 1));
172 KUNIT_EXPECT_EQ(test, 0, misc_example_add(-1, 1));
173 KUNIT_EXPECT_EQ(test, INT_MAX, misc_example_add(0, INT_MAX));
174 KUNIT_EXPECT_EQ(test, -1, misc_example_add(INT_MAX, INT_MIN));
177 static void misc_example_test_failure(struct kunit *test)
179 KUNIT_FAIL(test, "This test never passes.");
199 bool "Test for my example"
206 obj-$(CONFIG_MISC_EXAMPLE_TEST) += example-test.o
215 Now you can run the test:
228 [16:08:57] EXPECTATION FAILED at drivers/misc/example-test.c:17
229 [16:08:57] This test never passes.
232 Congrats! You just wrote your first KUnit test!