From: Bin Meng <bmeng.cn@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2 4/4] test: dm: spi: Fix sandbox dm_test_spi_find()
Date: Mon, 9 Sep 2019 06:00:03 -0700 [thread overview]
Message-ID: <1568034003-14675-4-git-send-email-bmeng.cn@gmail.com> (raw)
In-Reply-To: <1568034003-14675-1-git-send-email-bmeng.cn@gmail.com>
Per sandbox_cs_info(), sandbox spi controller only supports chip
select 0. Current test case tries to locate devices on chip select
1, and any call to spi_get_bus_and_cs() or spi_cs_info() with cs
number 1 should not return 0.
This updates the test case to handle it correctly.
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
---
Changes in v2:
- new patch to fix sandbox dm_test_spi_find()
test/dm/spi.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/test/dm/spi.c b/test/dm/spi.c
index ffd789c..8e417ac 100644
--- a/test/dm/spi.c
+++ b/test/dm/spi.c
@@ -77,10 +77,10 @@ static int dm_test_spi_find(struct unit_test_state *uts)
/* We should be able to add something to another chip select */
ut_assertok(sandbox_sf_bind_emul(state, busnum, cs_b, bus, node,
"name"));
- ut_assertok(spi_get_bus_and_cs(busnum, cs_b, speed, mode,
+ ut_asserteq(-EINVAL, spi_get_bus_and_cs(busnum, cs_b, speed, mode,
"spi_flash_std", "name", &bus, &slave));
- ut_assertok(spi_cs_info(bus, cs_b, &info));
- ut_asserteq_ptr(info.dev, slave->dev);
+ ut_asserteq(-EINVAL, spi_cs_info(bus, cs_b, &info));
+ ut_asserteq_ptr(NULL, info.dev);
/*
* Since we are about to destroy all devices, we must tell sandbox
--
2.7.4
next prev parent reply other threads:[~2019-09-09 13:00 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-09 13:00 [U-Boot] [PATCH v2 1/4] dm: spi: Return 0 if driver does not implement ops->cs_info Bin Meng
2019-09-09 13:00 ` [U-Boot] [PATCH v2 2/4] dm: spi: Change cs_info op to return -EINVAL for invalid cs num Bin Meng
2019-09-09 13:00 ` [U-Boot] [PATCH v2 3/4] dm: spi: Check cs number before accessing slaves Bin Meng
2019-10-16 14:05 ` Jagan Teki
2019-10-16 15:21 ` Jagan Teki
2019-10-29 10:15 ` Bin Meng
2019-11-18 7:15 ` Bin Meng
2020-01-09 13:47 ` Bin Meng
2020-01-09 13:48 ` Jagan Teki
2019-09-09 13:00 ` Bin Meng [this message]
2019-10-16 14:07 ` [U-Boot] [PATCH v2 4/4] test: dm: spi: Fix sandbox dm_test_spi_find() Jagan Teki
2019-09-29 8:04 ` [U-Boot] [PATCH v2 1/4] dm: spi: Return 0 if driver does not implement ops->cs_info Bin Meng
2019-10-08 12:59 ` Bin Meng
2019-10-14 2:33 ` Bin Meng
2019-10-16 10:14 ` Jagan Teki
2019-10-16 13:58 ` Jagan Teki
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1568034003-14675-4-git-send-email-bmeng.cn@gmail.com \
--to=bmeng.cn@gmail.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox