diff options
author | Tom Rini <trini@konsulko.com> | 2016-05-17 17:58:27 (GMT) |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2016-05-17 17:58:27 (GMT) |
commit | 4b6e1fda107e5244e80ebc41865650ac2873dc88 (patch) | |
tree | f448089740af77c2987d12e2dd5b753b7659586f /test | |
parent | 27bec5c12757c80f598b704477c1bc6c250bcb4c (diff) | |
parent | 341392dd115f1385c31bb0b034ec15f542730e30 (diff) | |
download | u-boot-4b6e1fda107e5244e80ebc41865650ac2873dc88.tar.xz |
Merge git://git.denx.de/u-boot-dm
Diffstat (limited to 'test')
-rw-r--r-- | test/dm/blk.c | 4 | ||||
-rw-r--r-- | test/dm/mmc.c | 19 |
2 files changed, 21 insertions, 2 deletions
diff --git a/test/dm/blk.c b/test/dm/blk.c index f4ea32e..012bf4c 100644 --- a/test/dm/blk.c +++ b/test/dm/blk.c @@ -83,12 +83,12 @@ static int dm_test_blk_usb(struct unit_test_state *uts) ut_asserteq_ptr(usb_dev, dev_get_parent(dev)); /* Check we have one block device for each mass storage device */ - ut_asserteq(3, count_blk_devices()); + ut_asserteq(4, count_blk_devices()); /* Now go around again, making sure the old devices were unbound */ ut_assertok(usb_stop()); ut_assertok(usb_init()); - ut_asserteq(3, count_blk_devices()); + ut_asserteq(4, count_blk_devices()); ut_assertok(usb_stop()); return 0; diff --git a/test/dm/mmc.c b/test/dm/mmc.c index 0461423..5bca4b7 100644 --- a/test/dm/mmc.c +++ b/test/dm/mmc.c @@ -25,3 +25,22 @@ static int dm_test_mmc_base(struct unit_test_state *uts) return 0; } DM_TEST(dm_test_mmc_base, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); + +static int dm_test_mmc_blk(struct unit_test_state *uts) +{ + struct udevice *dev; + struct blk_desc *dev_desc; + char cmp[1024]; + + ut_assertok(uclass_get_device(UCLASS_MMC, 0, &dev)); + ut_assertok(blk_get_device_by_str("mmc", "0", &dev_desc)); + + /* Read a few blocks and look for the string we expect */ + ut_asserteq(512, dev_desc->blksz); + memset(cmp, '\0', sizeof(cmp)); + ut_asserteq(2, blk_dread(dev_desc, 0, 2, cmp)); + ut_assertok(strcmp(cmp, "this is a test")); + + return 0; +} +DM_TEST(dm_test_mmc_blk, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); |