]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
test: dm: virtio: Test virtio device driver probing
authorAndrew Scull <ascull@google.com>
Mon, 16 May 2022 10:41:38 +0000 (10:41 +0000)
committerTom Rini <trini@konsulko.com>
Wed, 8 Jun 2022 13:24:04 +0000 (09:24 -0400)
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>
test/dm/virtio_device.c

index f5f2349750218e479dc6df3692f38cedc3312418..d0195e6bf096fb352eba4d04109bd65bedb77b28 100644 (file)
@@ -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);