blob: 2574c4da62434b7f87c4ecd25bccf3c4a19fe800 [file] [log] [blame]
Bin Meng1bb290d2018-10-15 02:21:26 -07001// SPDX-License-Identifier: GPL-2.0+
2/*
3 * Copyright (C) 2018, Bin Meng <bmeng.cn@gmail.com>
4 */
5
Bin Meng1bb290d2018-10-15 02:21:26 -07006#include <dm.h>
7#include <virtio_types.h>
8#include <virtio.h>
Bin Meng1bb290d2018-10-15 02:21:26 -07009#include <dm/device-internal.h>
Bin Meng1bb290d2018-10-15 02:21:26 -070010#include <dm/root.h>
11#include <dm/test.h>
Simon Glass75c4d412020-07-19 10:15:37 -060012#include <dm/uclass-internal.h>
13#include <test/test.h>
Bin Meng1bb290d2018-10-15 02:21:26 -070014#include <test/ut.h>
15
Bin Meng1bb290d2018-10-15 02:21:26 -070016/* Test of the virtio driver that does not have required driver ops */
17static int dm_test_virtio_missing_ops(struct unit_test_state *uts)
18{
19 struct udevice *bus;
20
21 /* find the virtio device */
22 ut_assertok(uclass_find_device(UCLASS_VIRTIO, 1, &bus));
23
24 /*
25 * Probe the device should fail with error -ENOENT.
26 * See ops check in virtio_uclass_pre_probe().
27 */
28 ut_asserteq(-ENOENT, device_probe(bus));
29
30 return 0;
31}
Simon Glass1a92f832024-08-22 07:57:48 -060032DM_TEST(dm_test_virtio_missing_ops, UTF_SCAN_PDATA | UTF_SCAN_FDT);