diff options
author | Andrew Scull <ascull@google.com> | 2022-05-16 10:41:38 +0000 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2022-06-08 09:24:04 -0400 |
commit | 420b3e51f4f64ebc6ab88f751f116e634894b231 (patch) | |
tree | eb80aed3febc2081b2338e425374ec36e473a191 /test/dm/virtio_device.c | |
parent | acd3b27a6564b94ffd2d4cf0c2726816bc1bffc3 (diff) | |
download | u-boot-420b3e51f4f64ebc6ab88f751f116e634894b231.tar.gz u-boot-420b3e51f4f64ebc6ab88f751f116e634894b231.tar.bz2 u-boot-420b3e51f4f64ebc6ab88f751f116e634894b231.zip |
test: dm: virtio: Test virtio device driver probing
Once the virtio-rng driver has been bound, probe it to trigger the pre
and post child probe hooks of the virtio uclass driver. Check the status
of the virtio device to confirm it reached the expected state.
Signed-off-by: Andrew Scull <ascull@google.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'test/dm/virtio_device.c')
-rw-r--r-- | test/dm/virtio_device.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/test/dm/virtio_device.c b/test/dm/virtio_device.c index f5f2349750..d0195e6bf0 100644 --- a/test/dm/virtio_device.c +++ b/test/dm/virtio_device.c @@ -34,6 +34,15 @@ static int dm_test_virtio_base(struct unit_test_state *uts) ut_assertok(virtio_get_status(dev, &status)); ut_asserteq(VIRTIO_CONFIG_S_ACKNOWLEDGE, status); + /* probe the virtio-rng driver */ + ut_assertok(device_probe(dev)); + + /* check the device was reset and the driver picked up the device */ + ut_assertok(virtio_get_status(dev, &status)); + ut_asserteq(VIRTIO_CONFIG_S_DRIVER | + VIRTIO_CONFIG_S_DRIVER_OK | + VIRTIO_CONFIG_S_FEATURES_OK, status); + return 0; } DM_TEST(dm_test_virtio_base, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); |