]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
test: sharpen button label unit test
authorHeinrich Schuchardt <xypron.glpk@gmx.de>
Mon, 14 Sep 2020 10:50:54 +0000 (12:50 +0200)
committerTom Rini <trini@konsulko.com>
Wed, 14 Oct 2020 15:16:34 +0000 (11:16 -0400)
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>
arch/sandbox/dts/sandbox.dtsi
arch/sandbox/dts/test.dts
test/dm/button.c
test/py/tests/test_button.py

index c76ecc013c98143b54b3be4d563bb90cd80b1d14..0faad3f3195429299ea7dc6d65a00a5235218eb5 100644 (file)
        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";
                };
        };
 
index c7d137691163e664d34b87e0e72d64735a2a5774..fa84b2c10f3bc8af412478b3eede0c300de294b5 100644 (file)
        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";
                };
        };
 
index 911780173657570a508e67be3ed4420ea8eb0f0b..ecaa47cf5f355bbd0a8fc85ef33424be29012f88 100644 (file)
@@ -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;
 }
index 98067a98f2896c8c7a0ae97fbda186ccce015c72..eadd9dd6135d058fd9759155309d3ac15cad511e 100644 (file)
@@ -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'