Simon Glass | 22c80d5 | 2022-09-21 16:21:47 +0200 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
| 2 | /* |
| 3 | * Copyright (C) 2015 Google, Inc |
| 4 | */ |
| 5 | |
| 6 | #include <common.h> |
| 7 | #include <dm.h> |
| 8 | #include <part.h> |
| 9 | #include <scsi.h> |
| 10 | #include <dm/test.h> |
| 11 | #include <test/test.h> |
| 12 | #include <test/ut.h> |
| 13 | |
| 14 | /* Test that sandbox SCSI works correctly */ |
| 15 | static int dm_test_scsi_base(struct unit_test_state *uts) |
| 16 | { |
| 17 | const struct disk_partition *info; |
| 18 | const struct disk_part *part; |
| 19 | struct udevice *dev; |
| 20 | |
| 21 | ut_assertok(scsi_scan(false)); |
| 22 | |
| 23 | /* |
| 24 | * We expect some sort of partition on the disk image, created by |
| 25 | * test_ut_dm_init() |
| 26 | */ |
| 27 | ut_assertok(uclass_first_device_err(UCLASS_PARTITION, &dev)); |
| 28 | |
| 29 | part = dev_get_uclass_plat(dev); |
| 30 | ut_asserteq(1, part->partnum); |
| 31 | |
| 32 | info = &part->gpt_part_info; |
| 33 | ut_asserteq_str("sda1", info->name); |
| 34 | ut_asserteq_str("U-Boot", info->type); |
| 35 | ut_asserteq(0x83 /* linux */, info->sys_ind); |
| 36 | |
| 37 | return 0; |
| 38 | } |
| 39 | DM_TEST(dm_test_scsi_base, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); |