You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2024/10/01 13:55:08 UTC

(nuttx-apps) branch master updated (3eb2124ca -> 302c1f9dc)

This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git


    from 3eb2124ca system/dhcpc: fix cmake program name
     new d02596835 drivertest/watchdog:add parameter to avoid testing api getstatus.
     new 5d9d27d50 drivertest:fix compile error.
     new 6358b481f test/watchdog:add test case for capture.
     new 19a63bdc1 watchdog: change usleep to up_udelay.
     new 302c1f9dc drivertest_watchdog:change busyloop after capture.

The 5 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 testing/drivertest/Makefile                 |  5 --
 testing/drivertest/drivertest_oneshot.c     |  3 ++
 testing/drivertest/drivertest_posix_timer.c |  3 ++
 testing/drivertest/drivertest_watchdog.c    | 78 +++++++++++++++++++++++------
 4 files changed, 68 insertions(+), 21 deletions(-)


(nuttx-apps) 05/05: drivertest_watchdog:change busyloop after capture.

Posted by xi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git

commit 302c1f9dca1afd6152ef33d1d16bf163d61b6715
Author: yangguangcai <ya...@xiaomi.com>
AuthorDate: Fri Sep 6 14:34:29 2024 +0800

    drivertest_watchdog:change busyloop after capture.
    
    busyloop should be after sem_init and WDIOC_CAPTURE.
    
    Signed-off-by: yangguangcai <ya...@xiaomi.com>
---
 testing/drivertest/drivertest_watchdog.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/testing/drivertest/drivertest_watchdog.c b/testing/drivertest/drivertest_watchdog.c
index 8d6ded436..e1a807f06 100644
--- a/testing/drivertest/drivertest_watchdog.c
+++ b/testing/drivertest/drivertest_watchdog.c
@@ -493,6 +493,10 @@ static void test_case_wdog_04(FAR void **state)
   ret = ioctl(dev_fd, WDIOC_CAPTURE, &watchdog_capture);
   assert_return_code(ret, OK);
 
+  /* Prevent the os entering pm then turn off watchdog. */
+
+  up_udelay(2 * wdg_state->timeout * 1000);
+
   sem_wait(&g_semaphore);
   sem_destroy(&g_semaphore);
 


(nuttx-apps) 04/05: watchdog: change usleep to up_udelay.

Posted by xi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git

commit 19a63bdc194c57dd385e8a350cb9b064b20ce636
Author: yangguangcai <ya...@xiaomi.com>
AuthorDate: Wed Jul 5 16:20:37 2023 +0800

    watchdog: change usleep to up_udelay.
    
    change uleep to up_udelay prevent system into lower
    power mode and watchdog be pause stop count.
    
    Signed-off-by: yangguangcai <ya...@xiaomi.com>
---
 testing/drivertest/drivertest_watchdog.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/testing/drivertest/drivertest_watchdog.c b/testing/drivertest/drivertest_watchdog.c
index 85e94a606..8d6ded436 100644
--- a/testing/drivertest/drivertest_watchdog.c
+++ b/testing/drivertest/drivertest_watchdog.c
@@ -324,7 +324,7 @@ static void test_case_wdog_01(FAR void **state)
     {
       /* Sleep for the requested amount of time */
 
-      usleep(wdg_state->pingdelay * 1000);
+      up_udelay(wdg_state->pingdelay * 1000);
 
       /* Then ping */
 
@@ -334,9 +334,11 @@ static void test_case_wdog_01(FAR void **state)
 
   /* Then stop pinging */
 
-  /* Sleep for the requested amount of time */
+  /* Sleep for the requested amount of time, use up_udelay prevent system
+   * into low power mode and watchdog be pause cannot trigger restart.
+   */
 
-  usleep(2 * wdg_state->timeout * 1000);
+  up_udelay(2 * wdg_state->timeout * 1000);
 
   assert_true(false);
 }
@@ -456,9 +458,11 @@ static void test_case_wdog_04(FAR void **state)
 
   while (get_time_elaps(start_ms) < wdg_state->pingtime)
     {
-      /* Sleep for the requested amount of time */
+      /* Sleep for the requested amount of time, use up_udelay prevent
+       * system into low power mode and watchdog be pause stop count.
+       */
 
-      usleep(wdg_state->pingdelay * 1000);
+      up_udelay(wdg_state->pingdelay * 1000);
 
       if (wdg_state->test_getstatus)
         {


(nuttx-apps) 01/05: drivertest/watchdog:add parameter to avoid testing api getstatus.

Posted by xi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git

commit d02596835f894a8c6196ba56faf03780f25447d4
Author: yangguangcai <ya...@xiaomi.com>
AuthorDate: Mon Nov 27 21:25:11 2023 +0800

    drivertest/watchdog:add parameter to avoid testing api getstatus.
    
    some vendor hardware not support get watchdog status.
    
    Signed-off-by: yangguangcai <ya...@xiaomi.com>
---
 testing/drivertest/drivertest_watchdog.c | 31 ++++++++++++++++++++-----------
 1 file changed, 20 insertions(+), 11 deletions(-)

diff --git a/testing/drivertest/drivertest_watchdog.c b/testing/drivertest/drivertest_watchdog.c
index 65fa8ac94..a5ba7a8b9 100644
--- a/testing/drivertest/drivertest_watchdog.c
+++ b/testing/drivertest/drivertest_watchdog.c
@@ -80,6 +80,7 @@ struct wdg_state_s
   uint32_t timeout;
   uint32_t deviation;
   int test_case;
+  bool test_getstatus;
 };
 
 /****************************************************************************
@@ -161,7 +162,7 @@ static void show_usage(FAR const char *progname,
                        FAR struct wdg_state_s *wdg_state, int exitcode)
 {
   printf("Usage: %s -d <devpath> -r <test case> -t <pingtime>"
-         "-l <pingdelay> -o <timeout> -a <deviation>\n", progname);
+         "-l <pingdelay> -o <timeout> -a <deviation> -g\n", progname);
   printf("  [-d devpath] selects the WATCHDOG device.\n"
          "  Default: %s Current: %s\n", WDG_DEFAULT_DEV_PATH,
          wdg_state->devpath);
@@ -180,6 +181,7 @@ static void show_usage(FAR const char *progname,
   printf("  [-a deviation] Watchdog getstatus precision.\n"
          "  Default: %d Current: %" PRIu32 "\n",
          WDG_DEFAULT_DEVIATION, wdg_state->deviation);
+  printf("  [-g] don't test getstatus\n");
   printf("  [-h] = Shows this message and exits\n");
 
   exit(exitcode);
@@ -195,7 +197,7 @@ static void parse_commandline(FAR struct wdg_state_s *wdg_state, int argc,
   int ch;
   int converted;
 
-  while ((ch = getopt(argc, argv, "d:r:t:l:o:a:h")) != ERROR)
+  while ((ch = getopt(argc, argv, "d:r:t:l:o:a:gh")) != ERROR)
     {
       switch (ch)
         {
@@ -257,6 +259,9 @@ static void parse_commandline(FAR struct wdg_state_s *wdg_state, int argc,
               }
 
             wdg_state->deviation = (uint32_t)converted;
+
+          case 'g':
+            wdg_state->test_getstatus = false;
             break;
 
           case '?':
@@ -442,16 +447,19 @@ static void test_case_wdog_04(FAR void **state)
 
       usleep(wdg_state->pingdelay * 1000);
 
-      /* Get Status */
+      if (wdg_state->test_getstatus)
+        {
+          /* Get Status */
 
-      ret = ioctl(dev_fd, WDIOC_GETSTATUS, &status);
-      assert_return_code(ret, OK);
+          ret = ioctl(dev_fd, WDIOC_GETSTATUS, &status);
+          assert_return_code(ret, OK);
 
-      assert_int_equal(status.timeout, wdg_state->timeout);
-      assert_in_range(
-        status.timeout - status.timeleft,
-        wdg_state->pingdelay - wdg_state->deviation,
-        wdg_state->pingdelay + wdg_state->deviation);
+          assert_int_equal(status.timeout, wdg_state->timeout);
+          assert_in_range(
+            status.timeout - status.timeleft,
+            wdg_state->pingdelay - wdg_state->deviation,
+            wdg_state->pingdelay + wdg_state->deviation);
+        }
 
       /* Then ping */
 
@@ -485,7 +493,8 @@ int main(int argc, FAR char *argv[])
     .pingdelay = WDG_DEFAULT_PINGDELAY,
     .timeout = WDG_DEFAULT_TIMEOUT,
     .test_case = WDG_DEFAULT_TESTCASE,
-    .deviation = WDG_DEFAULT_DEVIATION
+    .deviation = WDG_DEFAULT_DEVIATION,
+    .test_getstatus = true
   };
 
   parse_commandline(&wdg_state, argc, argv);


(nuttx-apps) 02/05: drivertest:fix compile error.

Posted by xi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git

commit 5d9d27d505156cbdb808012588561c8a0027986e
Author: yangguangcai <ya...@xiaomi.com>
AuthorDate: Wed Nov 29 20:14:30 2023 +0800

    drivertest:fix compile error.
    
    arm-none-eabi-ld: /home/ygc/ssd/vela_n62_4.0/nuttx/staging/libapps.a(drivertest_watchdog.c.home.ygc.ssd.vela_n62_4.0.apps.testing.drivertest.o): in function `cmocka_driver_watchdog_main':
    /home/ygc/ssd/vela_n62_4.0/apps/testing/drivertest/drivertest_watchdog.c:480: multiple definition of `cmocka_driver_watchdog_main'; /home/ygc/ssd/vela_n62_4.0/nuttx/staging/libapps.a(drivertest_watchdog.c.home.ygc.ssd.vela_n62_4.0.apps.testing.drivertest.o):/home/ygc/ssd/vela_n62_4.0/apps/testing/drivertest/drivertest_watchdog.c:480: first defined here
    
    Signed-off-by: yangguangcai <ya...@xiaomi.com>
---
 testing/drivertest/Makefile                 | 5 -----
 testing/drivertest/drivertest_oneshot.c     | 3 +++
 testing/drivertest/drivertest_posix_timer.c | 3 +++
 3 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/testing/drivertest/Makefile b/testing/drivertest/Makefile
index dcb5fa266..1b7bc6345 100644
--- a/testing/drivertest/Makefile
+++ b/testing/drivertest/Makefile
@@ -71,11 +71,6 @@ MAINSRC  += drivertest_pwm.c
 PROGNAME += cmocka_driver_pwm
 endif
 
-ifneq ($(CONFIG_WATCHDOG),)
-MAINSRC  += drivertest_watchdog.c
-PROGNAME += cmocka_driver_watchdog
-endif
-
 ifneq ($(CONFIG_ADC),)
 MAINSRC  += drivertest_adc.c
 PROGNAME += cmocka_driver_adc
diff --git a/testing/drivertest/drivertest_oneshot.c b/testing/drivertest/drivertest_oneshot.c
index a86213840..6d190fe73 100644
--- a/testing/drivertest/drivertest_oneshot.c
+++ b/testing/drivertest/drivertest_oneshot.c
@@ -29,6 +29,9 @@
 #include <stdlib.h>
 #include <unistd.h>
 #include <setjmp.h>
+#include <stdarg.h>
+#include <stddef.h>
+#include <stdint.h>
 #include <cmocka.h>
 #include <sys/ioctl.h>
 #include <sys/types.h>
diff --git a/testing/drivertest/drivertest_posix_timer.c b/testing/drivertest/drivertest_posix_timer.c
index 5ab5ac02f..5fc2092f8 100644
--- a/testing/drivertest/drivertest_posix_timer.c
+++ b/testing/drivertest/drivertest_posix_timer.c
@@ -26,6 +26,9 @@
 #include <signal.h>
 #include <setjmp.h>
 #include <stdlib.h>
+#include <stdarg.h>
+#include <stddef.h>
+#include <stdint.h>
 #include <cmocka.h>
 #include <syslog.h>
 #include <nuttx/timers/timer.h>


(nuttx-apps) 03/05: test/watchdog:add test case for capture.

Posted by xi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git

commit 6358b481fb693f0740be34163d6aed67ec1a4975
Author: yangguangcai <ya...@xiaomi.com>
AuthorDate: Wed Dec 13 15:17:42 2023 +0800

    test/watchdog:add test case for capture.
    
    Signed-off-by: yangguangcai <ya...@xiaomi.com>
---
 testing/drivertest/drivertest_watchdog.c | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/testing/drivertest/drivertest_watchdog.c b/testing/drivertest/drivertest_watchdog.c
index a5ba7a8b9..85e94a606 100644
--- a/testing/drivertest/drivertest_watchdog.c
+++ b/testing/drivertest/drivertest_watchdog.c
@@ -83,6 +83,8 @@ struct wdg_state_s
   bool test_getstatus;
 };
 
+static sem_t g_semaphore;
+
 /****************************************************************************
  * Private Data
  ****************************************************************************/
@@ -272,6 +274,16 @@ static void parse_commandline(FAR struct wdg_state_s *wdg_state, int argc,
     }
 }
 
+/****************************************************************************
+ * Name: capture_callback
+ ****************************************************************************/
+
+static int capture_callback(int irq, FAR void *context, FAR void *arg)
+{
+  sem_post(&g_semaphore);
+  return OK;
+}
+
 /****************************************************************************
  * Name: test_case_wdog_01
  *
@@ -425,6 +437,7 @@ static void test_case_wdog_04(FAR void **state)
   FAR struct wdg_state_s *wdg_state;
   struct watchdog_status_s status;
   struct boardioc_reset_cause_s reset_cause;
+  struct watchdog_capture_s watchdog_capture;
 
   wdg_state = (FAR struct wdg_state_s *)*state;
 
@@ -467,6 +480,22 @@ static void test_case_wdog_04(FAR void **state)
       assert_return_code(ret, OK);
     }
 
+  /* Test capture. */
+
+  ret = sem_init(&g_semaphore, 0, 0);
+  assert_return_code(ret, OK);
+
+  watchdog_capture.newhandler = capture_callback;
+  ret = ioctl(dev_fd, WDIOC_CAPTURE, &watchdog_capture);
+  assert_return_code(ret, OK);
+
+  sem_wait(&g_semaphore);
+  sem_destroy(&g_semaphore);
+
+  watchdog_capture.newhandler = watchdog_capture.oldhandler;
+  ret = ioctl(dev_fd, WDIOC_CAPTURE, &watchdog_capture);
+  assert_return_code(ret, OK);
+
   /* Then stop pinging */
 
   ret = ioctl(dev_fd, WDIOC_STOP, 0);