[PATCH 1/2] test/dm: fix watchdog test

Heinrich Schuchardt xypron.glpk at gmx.de
Mon Nov 1 06:21:49 CET 2021



Am 1. November 2021 00:46:49 MEZ schrieb Simon Glass <sjg at chromium.org>:
>On Thu, 28 Oct 2021 at 04:16, Heinrich Schuchardt
><heinrich.schuchardt at canonical.com> wrote:
>>
>> Avoid a build failure for CONFIG_WDT_GPIO=n.
>>
>> We need this setting to test watchdog based system reset.
>
>watchdog-based
>
>>
>> Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt at canonical.com>
>> ---
>>  test/dm/wdt.c | 4 ++++
>>  1 file changed, 4 insertions(+)
>
>Reviewed-by: Simon Glass <sjg at chromium.org>
>
>>
>> diff --git a/test/dm/wdt.c b/test/dm/wdt.c
>> index ee615f0e14..07a8eb0e7a 100644
>> --- a/test/dm/wdt.c
>> +++ b/test/dm/wdt.c
>> @@ -44,6 +44,7 @@ static int dm_test_wdt_base(struct unit_test_state *uts)
>>  }
>>  DM_TEST(dm_test_wdt_base, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT);
>>
>> +#ifdef CONFIG_WDT_GPIO
>>  static int dm_test_wdt_gpio(struct unit_test_state *uts)
>>  {
>>         /*
>> @@ -75,6 +76,7 @@ static int dm_test_wdt_gpio(struct unit_test_state *uts)
>>         return 0;
>>  }
>>  DM_TEST(dm_test_wdt_gpio, UT_TESTF_SCAN_FDT);
>> +#endif
>>
>>  static int dm_test_wdt_watchdog_reset(struct unit_test_state *uts)
>>  {
>> @@ -86,9 +88,11 @@ static int dm_test_wdt_watchdog_reset(struct unit_test_state *uts)
>>         uint reset_count;
>>         int val;
>>
>> +#ifdef CONFIG_WDT_GPIO
>
>The #ifdef is unfortunate but I believe it is needed due to
>DM_DRIVER_GET. You could get by name perhaps, or just get the first
>device?

Thanks for reviewing

We could move the GPIO test to a separate file and make the decision in Makefile. This would avoid #ifdef.

Best regards 
Heinrich 


>
>>         ut_assertok(uclass_get_device_by_driver(UCLASS_WDT,
>>                                                 DM_DRIVER_GET(wdt_gpio), &gpio_wdt));
>>         ut_assertnonnull(gpio_wdt);
>> +#endif
>>         ut_assertok(uclass_get_device_by_driver(UCLASS_WDT,
>>                                                 DM_DRIVER_GET(wdt_sandbox), &sandbox_wdt));
>>         ut_assertnonnull(sandbox_wdt);
>> --
>> 2.32.0
>>
>
>Regards,
>Simon


More information about the U-Boot mailing list