[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PULL 05/12] tests/qtest: add qtests for npcm7xx sdhci
From: |
Philippe Mathieu-Daudé |
Subject: |
Re: [PULL 05/12] tests/qtest: add qtests for npcm7xx sdhci |
Date: |
Tue, 2 Nov 2021 18:48:24 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.2.0 |
Hi,
On 11/2/21 11:59, Richard Henderson wrote:
> From: Shengtan Mao <stmao@google.com>
>
> Signed-off-by: Shengtan Mao <stmao@google.com>
> Signed-off-by: Hao Wu <wuhaotsh@google.com>
> Reviewed-by: Hao Wu <wuhaotsh@google.com>
> Reviewed-by: Chris Rauer <crauer@google.com>
> Reviewed-by: Tyrone Ting <kfting@nuvoton.com>
> Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
> Message-Id: <20211008002628.1958285-6-wuhaotsh@google.com>
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
> tests/qtest/npcm7xx_sdhci-test.c | 209 +++++++++++++++++++++++++++++++
> tests/qtest/meson.build | 1 +
> 2 files changed, 210 insertions(+)
> create mode 100644 tests/qtest/npcm7xx_sdhci-test.c
> +static void write_sdread(QTestState *qts, const char *msg)
> +{
> + size_t len = strlen(msg);
> + char *rmsg = g_malloc(len);
> +
> + /* write message to sd */
> + int fd = open(sd_path, O_WRONLY);
> + int ret;
> +
> + g_assert(fd > 0);
> + ret = write(fd, msg, len);
> + g_assert(ret == len);
> + ret = close(fd);
> + g_assert(ret == 0);
> +
> + /* read message using sdhci */
> + ret = sdhci_read_cmd(qts, NPCM7XX_MMC_BA, rmsg, len);
> + g_assert(ret == len);
> + g_assert(!strcmp(rmsg, msg));
> +
> + free(rmsg);
> +}
> +static void sdwrite_read(QTestState *qts, const char *msg)
> +{
> + size_t len = strlen(msg);
> + char *rmsg = g_malloc(len);
> +
> + /* write message using sdhci */
> + sdhci_write_cmd(qts, NPCM7XX_MMC_BA, msg, len, NPCM7XX_BLK_SIZE);
> +
> + /* read message from sd */
> + int fd = open(sd_path, O_RDONLY);
> + int ret;
> +
> + g_assert(fd > 0);
> + ret = read(fd, rmsg, len);
> + g_assert(ret == len);
> + ret = close(fd);
> + g_assert(ret == 0);
> +
> + g_assert(!strcmp(rmsg, msg));
Looking at this failure on s390x host (big-endian) with Richard:
https://app.travis-ci.com/gitlab/qemu-project/qemu/jobs/546307442#L9370
ERROR:../tests/qtest/npcm7xx_sdhci-test.c:104:sdwrite_read: assertion
failed: (!strcmp(rmsg, msg))
ERROR qtest-arm/npcm7xx_sdhci-test - Bail out!
ERROR:../tests/qtest/npcm7xx_sdhci-test.c:104:sdwrite_read: assertion
failed: (!strcmp(rmsg, msg))
it seems you want to use strncmp() or memcmp() here.
> + free(rmsg);
> +}
- [PULL 00/12] target/arm patch queue, Richard Henderson, 2021/11/02
- [PULL 01/12] hw/sd: add nuvoton MMC, Richard Henderson, 2021/11/02
- [PULL 02/12] hw/arm: Add Nuvoton SD module to board, Richard Henderson, 2021/11/02
- [PULL 03/12] hw/arm: Attach MMC to quanta-gbs-bmc, Richard Henderson, 2021/11/02
- [PULL 04/12] tests/qtest/libqos: add SDHCI commands, Richard Henderson, 2021/11/02
- [PULL 05/12] tests/qtest: add qtests for npcm7xx sdhci, Richard Henderson, 2021/11/02
- Re: [PULL 05/12] tests/qtest: add qtests for npcm7xx sdhci,
Philippe Mathieu-Daudé <=
- [PULL 07/12] target/arm: Use tcg_constant_i32() in op_smlad(), Richard Henderson, 2021/11/02
- [PULL 08/12] target/arm: Introduce store_cpu_field_constant() helper, Richard Henderson, 2021/11/02
- [PULL 09/12] target/arm: Use the constant variant of store_cpu_field() when possible, Richard Henderson, 2021/11/02
- [PULL 10/12] target/arm: Use tcg_constant_i64() in do_sat_addsub_64(), Richard Henderson, 2021/11/02
- [PULL 06/12] target/arm: Advertise MVE to gdb when present, Richard Henderson, 2021/11/02
- [PULL 11/12] target/arm: Use tcg_constant_i32() in gen_rev16(), Richard Henderson, 2021/11/02
- [PULL 12/12] hw/arm/virt: Rename default_bus_bypass_iommu, Richard Henderson, 2021/11/02