tests/qtest: add qtests for npcm7xx sdhci
PATCH v5 1/1 tests/qtest: add qtests for npcm7xx sdhci
From: Shengtan Mao <[email protected]>
---
v5
* use memcmp to compare whether strings are expected
v4
* use strncmp instead of strcmp
v3:
* fixup compilation from missing macro value
v2:
* update copyright year
* check result of open
* use g_free instead of free
* move declarations to the top
* use g_file_open_tmp
--- tests/qtest/meson.build | 1 + tests/qtest/npcm7xx_sdhci-test.c | 215 +++++++++++++++++++++++++++++++ 2 files changed, 216 insertions(+) create mode 100644 tests/qtest/npcm7xx_sdhci-test.c
tests/qtest/meson.build +1 -0
@@ -190,6 +190,7 @@ qtests_npcm7xx = \ 'npcm7xx_gpio-test', 'npcm7xx_pwm-test', 'npcm7xx_rng-test', + 'npcm7xx_sdhci-test', 'npcm7xx_smbus-test', 'npcm7xx_timer-test', 'npcm7xx_watchdog_timer-test'] + \
tests/qtest/npcm7xx_sdhci-test.c new file +215 -0
215 lines not on this page · raw message
Signature · 1 line
2.35.1.574.g5d30c73bfb-goog
Peter Maydell
AppliedQuoted 7 lines · Hao Wu
From: Shengtan Mao <[email protected]>
Reviewed-by Hao Wu <[email protected]>Reviewed-by Chris Rauer <[email protected]>Signed-off-by Shengtan Mao <[email protected]>Signed-off-by Patrick Venture <[email protected]>
Applied to target-arm.next, thanks.
-- PMM
Quoted 7 lines · Hao Wu
From: Shengtan Mao <[email protected]>
Reviewed-by Hao Wu <[email protected]>Reviewed-by Chris Rauer <[email protected]>Signed-off-by Shengtan Mao <[email protected]>Signed-off-by Patrick Venture <[email protected]>
Hi; John Snow tells me that this test fails in the tests/vm/netbsd VM (you can test this with 'make vm-build-netbsd') because the assert() on the ftruncate() call fails:
tests/qtest/npcm7xx_sdhci-test.c
Quoted 4 lines
tests/qtest/npcm7xx_sdhci-test.c new file +3
-0+ ret =ftruncate (fd,NPCM7XX_TEST_IMAGE_SIZE ); + g_assert_cmpint(ret, ==, 0); +#define NPCM7XX_TEST_IMAGE_SIZE (1 << 30)
I haven't investigated the exact cause, but this is a gigabyte, right? That's a pretty massive file for a test case to create -- can we make the test use a more sensible size of sd card image ?
thanks
-- PMM
Quoted 16 lines · Peter Maydell
Quoted 7 lines · Hao Wu
From: Shengtan Mao <[email protected]>
Reviewed-by Hao Wu <[email protected]>Reviewed-by Chris Rauer <[email protected]>Signed-off-by Shengtan Mao <[email protected]>Signed-off-by Patrick Venture <[email protected]>Hi; John Snow tells me that this test fails in the tests/vm/netbsd VM (you can test this with 'make vm-build-netbsd') because the
assert()on theftruncate()call fails:Quoted 2 lines
tests/qtest/npcm7xx_sdhci-test.c new file +2
-0+ ret =ftruncate (fd,NPCM7XX_TEST_IMAGE_SIZE ); + g_assert_cmpint(ret, ==, 0);
Quoted 7 lines
Quoted 1 line
+#define
NPCM7XX_TEST_IMAGE_SIZE(1 << 30)I haven't investigated the exact cause, but this is a gigabyte, right? That's a pretty massive file for a test case to create -- can we make the test use a more sensible size of sd card image ?
It looks like the nuvoton part had an issue with a smaller image size, but we can resurrect that thread and poke at it a bit and see what shakes out.
Quoted 4 lines
thanks
-- PMM
Quoted 25 lines · Patrick Venture
On Thu, May 26, 2022 at 8:54 AM Peter Maydell <[email protected] <mailto:[email protected]>> wrote:
On Fri, 25 Feb 2022 at 17:45, Hao Wu <[email protected] <mailto:[email protected]>> wrote:
>
> From: Shengtan Mao <[email protected] <mailto:[email protected]>> >
> Reviewed-by: Hao Wu <[email protected]
<mailto:[email protected]>>
> Reviewed-by: Chris Rauer <[email protected]
<mailto:[email protected]>>
> Signed-off-by: Shengtan Mao <[email protected]
<mailto:[email protected]>>
> Signed-off-by: Patrick Venture <[email protected]
<mailto:[email protected]>>Hi; John Snow tells me that this test fails in the tests/vm/netbsd VM (you can test this with 'make vm-build-netbsd') because the
assert()on theftruncate()call fails:> + ret =
ftruncate(fd, NPCM7XX_TEST_IMAGE_SIZE); > +g_assert_cmpint(ret, ==, 0);> +#define
NPCM7XX_TEST_IMAGE_SIZE(1 << 30)
Quoted 7 lines
I haven't investigated the exact cause, but this is a gigabyte, right? That's a pretty massive file for a test case to create -- can we make the test use a more sensible size of sd card image ?
It looks like the nuvoton part had an issue with a smaller image size, but we can resurrect that thread and poke at it a bit and see what shakes out.
Could you use the null-co block driver instead?
-blockdev driver=null-co,size=1G,read-zeroes=on,node-name=null0 -device sd-card,drive=null0
Hi,
We did some experiments on this issue. It looks like the image size restriction is in firmware. So in qtest we can make it
much smaller (e.g. 1MB) and the test still passes. We can send a patch with this change if necessary.
Quoted 38 lines · Patrick Venture
Quoted 16 lines · Peter Maydell
Quoted 7 lines · Hao Wu
From: Shengtan Mao <[email protected]>
Reviewed-by Hao Wu <[email protected]>Reviewed-by Chris Rauer <[email protected]>Signed-off-by Shengtan Mao <[email protected]>Signed-off-by Patrick Venture <[email protected]>Hi; John Snow tells me that this test fails in the tests/vm/netbsd VM (you can test this with 'make vm-build-netbsd') because the
assert()on theftruncate()call fails:Quoted 2 lines
tests/qtest/npcm7xx_sdhci-test.c new file +2
-0+ ret =ftruncate (fd,NPCM7XX_TEST_IMAGE_SIZE ); + g_assert_cmpint(ret, ==, 0);Quoted 7 lines
Quoted 1 line
+#define
NPCM7XX_TEST_IMAGE_SIZE(1 << 30)I haven't investigated the exact cause, but this is a gigabyte, right? That's a pretty massive file for a test case to create -- can we make the test use a more sensible size of sd card image ?
It looks like the nuvoton part had an issue with a smaller image size, but we can resurrect that thread and poke at it a bit and see what shakes out.
Quoted 4 lines
thanks
-- PMM
Quoted 5 lines · Hao Wu
Hi,
We did some experiments on this issue. It looks like the image size restriction is in firmware. So in qtest we can make it much smaller (e.g. 1MB) and the test still passes. We can send a patch with this change if necessary.
Yes, please send a patch.
thanks
-- PMM