1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
#include <kunit/test.h>
#include <kunit/mock.h>
/* #include <linux/example/example_driver.h> */
static void kunit_test(struct test *test)
{
/*
struct example_driver_drvdata *p = test->priv;
EXPECT_EQ(test, -EINVAL, example_driver_set_intensity(p, 99999));
EXPECT_FALSE(test, example_driver_set_enable(p, true));
*/
return;
}
static void kunit_test2(struct test *test)
{
/*
struct example_driver_drvdata *p = test->priv;
EXPECT_FALSE(test, example_driver_set_enable(p, false));
EXPECT_EQ(test, -EINVAL, example_set_frequency(p, EXAMPLE_FREQ_MAX));
*/
return;
}
static int kunit_test_init(struct test *test)
{
/*
test->priv = a_struct_pointer;
if (!test->priv)
return -ENOMEM;
*/
return 0;
}
static void kunit_test_exit(struct test *test)
{
return;
}
static struct test_case kunit_test_cases[] = {
TEST_CASE(kunit_test),
TEST_CASE(kunit_test2),
{},
};
static struct test_module kunit_test_module = {
.name = "kunit-test",
.init = kunit_test_init,
.exit = kunit_test_exit,
.test_cases = kunit_test_cases,
};
module_test(kunit_test_module);
|