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