[RFC] make sandbox UT more generic

Simon Glass sjg at chromium.org
Thu Aug 31 04:49:05 CEST 2023


On Wed, 30 Aug 2023 at 18:38, AKASHI Takahiro
<takahiro.akashi at linaro.org> wrote:
> Hi,
> I'm working on implementing SCMI-based pinctrl/gpio driver,
> and want to re-use sandbox UT to test the code. However,
> It is somehow sandbox-specific (with additional DT nodes).
> How can/should we make it more generic for other targets/drivers
> rather than just by copying the test code?
> (I have already created a test for pinmux since there is only
> one existing scenario, but gpio test has many.)
> Even if I say 'generic', my case may be special since real
> hardware (device drivers) cannot always run all the test cases,
> while SCMI-based drivers potentially can with a dummy SCMI server
> for sandbox.
> See:
>     drivers/firmware/scmi/sandbox-scmi_agent.c

We don't have a good way to test drivers that talk to hardware, in general.

For I2C, SPI and some PCI devices you can sometimes write an emulator
for the chip and then your driver can talk to the emulator as if it
were talking to the hardware. Sandbox does actually support that with
memory-mapped I/O too, although it is fairly rarely used.

We have done this a lot with Zephyr, as well[1] and achieved 90% code
coverage on some boards.

But I'm not quite sure I am answering the right question, so I will stop here.


[1] https://www.youtube.com/watch?v=usXCAXR2G_c

More information about the U-Boot mailing list