From: Philippe REYNES <philippe.reynes@softathome.com>
To: u-boot@lists.denx.de
Subject: [PATCH v2 1/3] test: sharpen button label unit test
Date: Mon, 14 Sep 2020 18:00:15 +0200 (CEST) [thread overview]
Message-ID: <447819573.1006157.1600099215566.JavaMail.zimbra@softathome.com> (raw)
In-Reply-To: <20200914105056.174287-2-xypron.glpk@gmx.de>
> Using different strings for the device tree node labels and the label
> property of buttons sharpens the button label unit test.
>
> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Philippe Reynes <philippe.reynes@softathome.com>
> ---
> v2:
> new patch
> ---
> arch/sandbox/dts/sandbox.dtsi | 8 ++++----
> arch/sandbox/dts/test.dts | 8 ++++----
> test/dm/button.c | 6 +++---
> test/py/tests/test_button.py | 2 +-
> 4 files changed, 12 insertions(+), 12 deletions(-)
>
> diff --git a/arch/sandbox/dts/sandbox.dtsi b/arch/sandbox/dts/sandbox.dtsi
> index c76ecc013c..0faad3f319 100644
> --- a/arch/sandbox/dts/sandbox.dtsi
> +++ b/arch/sandbox/dts/sandbox.dtsi
> @@ -18,14 +18,14 @@
> buttons {
> compatible = "gpio-keys";
>
> - summer {
> + btn1 {
> gpios = <&gpio_a 3 0>;
> - label = "summer";
> + label = "button1";
> };
>
> - christmas {
> + btn2 {
> gpios = <&gpio_a 4 0>;
> - label = "christmas";
> + label = "button2";
> };
> };
>
> diff --git a/arch/sandbox/dts/test.dts b/arch/sandbox/dts/test.dts
> index 9f45c48e4e..395d5f5e56 100644
> --- a/arch/sandbox/dts/test.dts
> +++ b/arch/sandbox/dts/test.dts
> @@ -54,14 +54,14 @@
> buttons {
> compatible = "gpio-keys";
>
> - summer {
> + btn1 {
> gpios = <&gpio_a 3 0>;
> - label = "summer";
> + label = "button1";
> };
>
> - christmas {
> + btn2 {
> gpios = <&gpio_a 4 0>;
> - label = "christmas";
> + label = "button2";
> };
> };
>
> diff --git a/test/dm/button.c b/test/dm/button.c
> index 9117801736..ecaa47cf5f 100644
> --- a/test/dm/button.c
> +++ b/test/dm/button.c
> @@ -57,17 +57,17 @@ static int dm_test_button_label(struct unit_test_state *uts)
> {
> struct udevice *dev, *cmp;
>
> - ut_assertok(button_get_by_label("summer", &dev));
> + ut_assertok(button_get_by_label("button1", &dev));
> ut_asserteq(1, device_active(dev));
> ut_assertok(uclass_get_device(UCLASS_BUTTON, 1, &cmp));
> ut_asserteq_ptr(dev, cmp);
>
> - ut_assertok(button_get_by_label("christmas", &dev));
> + ut_assertok(button_get_by_label("button2", &dev));
> ut_asserteq(1, device_active(dev));
> ut_assertok(uclass_get_device(UCLASS_BUTTON, 2, &cmp));
> ut_asserteq_ptr(dev, cmp);
>
> - ut_asserteq(-ENODEV, button_get_by_label("spring", &dev));
> + ut_asserteq(-ENODEV, button_get_by_label("nobutton", &dev));
>
> return 0;
> }
> diff --git a/test/py/tests/test_button.py b/test/py/tests/test_button.py
> index 98067a98f2..eadd9dd613 100644
> --- a/test/py/tests/test_button.py
> +++ b/test/py/tests/test_button.py
> @@ -11,7 +11,7 @@ def test_button_exit_statuses(u_boot_console):
> expected_response = 'rc:0'
> response = u_boot_console.run_command('button list; echo rc:$?')
> assert(expected_response in response)
> - response = u_boot_console.run_command('button summer; echo rc:$?')
> + response = u_boot_console.run_command('button button1; echo rc:$?')
> assert(expected_response in response)
>
> expected_response = 'rc:1'
> --
> 2.28.0
next prev parent reply other threads:[~2020-09-14 16:00 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-14 10:50 [PATCH v2 0/3] cmd/button: return button status Heinrich Schuchardt
2020-09-14 10:50 ` [PATCH v2 1/3] test: sharpen button label unit test Heinrich Schuchardt
2020-09-14 16:00 ` Philippe REYNES [this message]
2020-10-14 17:42 ` Tom Rini
2020-09-14 10:50 ` [PATCH v2 2/3] drivers: gpio: keep output value for input on sandbox Heinrich Schuchardt
2020-09-14 16:01 ` Philippe REYNES
2020-10-14 17:42 ` Tom Rini
2020-09-14 10:50 ` [PATCH v2 3/3] cmd/button: return button status Heinrich Schuchardt
2020-09-14 16:02 ` Philippe REYNES
2020-10-14 17:42 ` Tom Rini
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=447819573.1006157.1600099215566.JavaMail.zimbra@softathome.com \
--to=philippe.reynes@softathome.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.