diff options
author | Simon Glass <sjg@chromium.org> | 2022-09-21 16:21:47 +0200 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2022-09-25 13:59:56 -0600 |
commit | 22c80d5603ac4c58debc8c776b8f138e76cf5f7c (patch) | |
tree | a6bd3d83314fee80b1b1a2e9a39df39d96a2dcc8 /test/dm/scsi.c | |
parent | 46df0243942f98ad5a6b57cb65b31acdc88559f8 (diff) |
sandbox: Add a test for SCSI
Add a simple uclass test for SCSI. It reads the partition table from a
disk image and checks that it looks correct.
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'test/dm/scsi.c')
-rw-r--r-- | test/dm/scsi.c | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/test/dm/scsi.c b/test/dm/scsi.c new file mode 100644 index 00000000000..380cfc88bab --- /dev/null +++ b/test/dm/scsi.c @@ -0,0 +1,39 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright (C) 2015 Google, Inc + */ + +#include <common.h> +#include <dm.h> +#include <part.h> +#include <scsi.h> +#include <dm/test.h> +#include <test/test.h> +#include <test/ut.h> + +/* Test that sandbox SCSI works correctly */ +static int dm_test_scsi_base(struct unit_test_state *uts) +{ + const struct disk_partition *info; + const struct disk_part *part; + struct udevice *dev; + + ut_assertok(scsi_scan(false)); + + /* + * We expect some sort of partition on the disk image, created by + * test_ut_dm_init() + */ + ut_assertok(uclass_first_device_err(UCLASS_PARTITION, &dev)); + + part = dev_get_uclass_plat(dev); + ut_asserteq(1, part->partnum); + + info = &part->gpt_part_info; + ut_asserteq_str("sda1", info->name); + ut_asserteq_str("U-Boot", info->type); + ut_asserteq(0x83 /* linux */, info->sys_ind); + + return 0; +} +DM_TEST(dm_test_scsi_base, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); |