aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHeinrich Schuchardt <xypron.glpk@gmx.de>2020-09-14 12:50:54 +0200
committerTom Rini <trini@konsulko.com>2020-10-14 11:16:34 -0400
commit39916bb45f9e233d6df8ee478c539b100116a34a (patch)
treeb2261b42071505cb7e079697d7a4f4c9d7f92b8c
parent9ea0a1ee9309054102e61a29e746db672494d385 (diff)
downloadu-boot-39916bb45f9e233d6df8ee478c539b100116a34a.zip
u-boot-39916bb45f9e233d6df8ee478c539b100116a34a.tar.gz
u-boot-39916bb45f9e233d6df8ee478c539b100116a34a.tar.bz2
test: sharpen button label unit test
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>
-rw-r--r--arch/sandbox/dts/sandbox.dtsi8
-rw-r--r--arch/sandbox/dts/test.dts8
-rw-r--r--test/dm/button.c6
-rw-r--r--test/py/tests/test_button.py2
4 files changed, 12 insertions, 12 deletions
diff --git a/arch/sandbox/dts/sandbox.dtsi b/arch/sandbox/dts/sandbox.dtsi
index c76ecc0..0faad3f 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 c7d1376..fa84b2c 100644
--- a/arch/sandbox/dts/test.dts
+++ b/arch/sandbox/dts/test.dts
@@ -55,14 +55,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 9117801..ecaa47c 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 98067a9..eadd9dd 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'