]>
Commit | Line | Data |
---|---|---|
4f89d494 BM |
1 | // SPDX-License-Identifier: GPL-2.0+ |
2 | /* | |
3 | * Copyright (C) 2018, Bin Meng <bmeng.cn@gmail.com> | |
4 | */ | |
5 | ||
d678a59d | 6 | #include <common.h> |
4f89d494 BM |
7 | #include <dm.h> |
8 | #include <virtio_types.h> | |
9 | #include <virtio.h> | |
4f89d494 | 10 | #include <dm/device-internal.h> |
4f89d494 BM |
11 | #include <dm/root.h> |
12 | #include <dm/test.h> | |
0e1fad43 SG |
13 | #include <dm/uclass-internal.h> |
14 | #include <test/test.h> | |
4f89d494 BM |
15 | #include <test/ut.h> |
16 | ||
4f89d494 BM |
17 | /* Test of the virtio driver that does not have required driver ops */ |
18 | static int dm_test_virtio_missing_ops(struct unit_test_state *uts) | |
19 | { | |
20 | struct udevice *bus; | |
21 | ||
22 | /* find the virtio device */ | |
23 | ut_assertok(uclass_find_device(UCLASS_VIRTIO, 1, &bus)); | |
24 | ||
25 | /* | |
26 | * Probe the device should fail with error -ENOENT. | |
27 | * See ops check in virtio_uclass_pre_probe(). | |
28 | */ | |
29 | ut_asserteq(-ENOENT, device_probe(bus)); | |
30 | ||
31 | return 0; | |
32 | } | |
e180c2b1 | 33 | DM_TEST(dm_test_virtio_missing_ops, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); |