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

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

commit 89c76388d02dcc1afd2b0a4b2b71f1532f43cdf7
Author: chenzihan1 <[email protected]>
AuthorDate: Fri Mar 21 11:20:56 2025 +0800

    system/uorb/test: Shorten the test topic names.
    
    The uORB device path is built from ORB_SENSOR_PATH, the topic name and
    the instance number, and the result has to fit into the path buffer of
    the topic. orb_test_medium_queue_poll and the other orb_test_medium_*
    names are long enough that the path is truncated on some
    configurations, so the unit test opens the wrong node.
    
    Rename orb_test_medium_multi, orb_test_medium_queue and
    orb_test_medium_queue_poll to orb_test_multi, orb_test_queue and
    orb_test_queue_poll.
    
    Signed-off-by: chenzihan1 <[email protected]>
---
 system/uorb/test/unit_test.c | 34 +++++++++++++++++-----------------
 system/uorb/test/utility.c   |  6 +++---
 system/uorb/test/utility.h   |  6 +++---
 3 files changed, 23 insertions(+), 23 deletions(-)

diff --git a/system/uorb/test/unit_test.c b/system/uorb/test/unit_test.c
index 70cd059df..89897fb1f 100644
--- a/system/uorb/test/unit_test.c
+++ b/system/uorb/test/unit_test.c
@@ -671,7 +671,7 @@ static FAR void *pub_test_multi2_entry(FAR void *arg)
   for (i = 0; i < num_instances; ++i)
     {
       orb_pub[i] = orb_advertise_multi_queue_persist(
-        ORB_ID(orb_test_medium_multi), &data_topic, &i, 1);
+        ORB_ID(orb_test_multi), &data_topic, &i, 1);
     }
 
   usleep(100 * 1000);
@@ -683,7 +683,7 @@ static FAR void *pub_test_multi2_entry(FAR void *arg)
       data_topic.timestamp = orb_absolute_time();
       data_topic.val       = data_next_idx;
 
-      orb_publish(ORB_ID(orb_test_medium_multi), orb_pub[data_next_idx],
+      orb_publish(ORB_ID(orb_test_multi), orb_pub[data_next_idx],
                   &data_topic);
 
       data_next_idx = (data_next_idx + 1) % num_instances;
@@ -725,7 +725,7 @@ static int test_multi2(void)
 
   for (i = 0; i < num_instances; ++i)
     {
-      orb_data_fd[i] = orb_subscribe_multi(ORB_ID(orb_test_medium_multi), i);
+      orb_data_fd[i] = orb_subscribe_multi(ORB_ID(orb_test_multi), i);
     }
 
   /* launch the publisher thread */
@@ -760,7 +760,7 @@ static int test_multi2(void)
               0, 0
             };
 
-          if (OK != orb_copy(ORB_ID(orb_test_medium_multi),
+          if (OK != orb_copy(ORB_ID(orb_test_multi),
                              orb_data_cur_fd, &msg))
             {
               test_fail("copy failed: %d", errno);
@@ -810,7 +810,7 @@ int test_queue(void)
 
   test_note("Testing orb queuing");
 
-  sfd = orb_subscribe(ORB_ID(orb_test_medium_queue));
+  sfd = orb_subscribe(ORB_ID(orb_test_queue));
 
   if (sfd < 0)
     {
@@ -826,13 +826,13 @@ int test_queue(void)
       orb_check(sfd, &updated);
       if (updated)
         {
-          orb_copy(ORB_ID(orb_test_medium_queue), sfd, &sub_sample);
+          orb_copy(ORB_ID(orb_test_queue), sfd, &sub_sample);
         }
     }
   while (updated);
 
   ptopic = orb_advertise_multi_queue_persist(
-    ORB_ID(orb_test_medium_queue), &sample, &instance, queue_size);
+    ORB_ID(orb_test_queue), &sample, &instance, queue_size);
   if (ptopic < 0)
     {
       orb_unsubscribe(sfd);
@@ -846,7 +846,7 @@ int test_queue(void)
       goto out;
     }
 
-  if (OK != orb_copy(ORB_ID(orb_test_medium_queue), sfd, &sub_sample))
+  if (OK != orb_copy(ORB_ID(orb_test_queue), sfd, &sub_sample))
     {
       test_fail("copy(1) failed: %d", errno);
       goto out;
@@ -883,7 +883,7 @@ int test_queue(void)
     }
 
 #define CHECK_COPY(i_got, i_correct) \
-  orb_copy(ORB_ID(orb_test_medium_queue), sfd, &sub_sample); \
+  orb_copy(ORB_ID(orb_test_queue), sfd, &sub_sample); \
   if (i_got != i_correct) \
     { \
       test_fail("got wrong element from the queue (got %i," \
@@ -898,7 +898,7 @@ int test_queue(void)
   for (i = 0; i < queue_size - 2; ++i)
     {
       sample.val = i;
-      orb_publish(ORB_ID(orb_test_medium_queue), ptopic, &sample);
+      orb_publish(ORB_ID(orb_test_queue), ptopic, &sample);
     }
 
   for (i = 0; i < queue_size - 2; ++i)
@@ -914,7 +914,7 @@ int test_queue(void)
   for (i = 0; i < queue_size + overflow_by; ++i)
     {
       sample.val = i;
-      orb_publish(ORB_ID(orb_test_medium_queue), ptopic, &sample);
+      orb_publish(ORB_ID(orb_test_queue), ptopic, &sample);
     }
 
   for (i = 0; i < queue_size; ++i)
@@ -935,7 +935,7 @@ int test_queue(void)
 
   sample.val = 943;
 
-  orb_publish(ORB_ID(orb_test_medium_queue), ptopic, &sample);
+  orb_publish(ORB_ID(orb_test_queue), ptopic, &sample);
 
   CHECK_UPDATED(-1);
   CHECK_COPY(sub_sample.val, sample.val);
@@ -970,7 +970,7 @@ static FAR void *pub_test_queue_entry(FAR void *arg)
   (void)arg;
   memset(&t, '\0', sizeof(t));
   ptopic = orb_advertise_multi_queue_persist(
-    ORB_ID(orb_test_medium_queue_poll), &t, &instance, queue_size);
+    ORB_ID(orb_test_queue_poll), &t, &instance, queue_size);
   if (ptopic < 0)
     {
       g_thread_should_exit = true;
@@ -990,7 +990,7 @@ static FAR void *pub_test_queue_entry(FAR void *arg)
         {
           /* make interval non-boundary aligned */
 
-          orb_publish(ORB_ID(orb_test_medium_queue_poll), ptopic, &t);
+          orb_publish(ORB_ID(orb_test_queue_poll), ptopic, &t);
           ++t.val;
         }
 
@@ -1018,7 +1018,7 @@ static int test_queue_poll_notify(void)
 
   test_note("Testing orb queuing (poll & notify)");
 
-  if ((sfd = orb_subscribe(ORB_ID(orb_test_medium_queue_poll))) < 0)
+  if ((sfd = orb_subscribe(ORB_ID(orb_test_queue_poll))) < 0)
     {
       return test_fail("subscribe failed: %d", errno);
     }
@@ -1032,7 +1032,7 @@ static int test_queue_poll_notify(void)
       orb_check(sfd, &updated);
       if (updated)
         {
-          orb_copy(ORB_ID(orb_test_medium_queue_poll), sfd, &t);
+          orb_copy(ORB_ID(orb_test_queue_poll), sfd, &t);
         }
     }
   while (updated);
@@ -1078,7 +1078,7 @@ static int test_queue_poll_notify(void)
 
       if (fds[0].revents & POLLIN)
         {
-          orb_copy(ORB_ID(orb_test_medium_queue_poll), sfd, &t);
+          orb_copy(ORB_ID(orb_test_queue_poll), sfd, &t);
           if (next_expected_val != t.val)
             {
               orb_unsubscribe(sfd);
diff --git a/system/uorb/test/utility.c b/system/uorb/test/utility.c
index 3f90c6c7b..c0a198ef2 100644
--- a/system/uorb/test/utility.c
+++ b/system/uorb/test/utility.c
@@ -45,11 +45,11 @@ static const char orb_test_format[] =
 ORB_DEFINE(orb_test, struct orb_test_s, orb_test_format);
 ORB_DEFINE(orb_multitest, struct orb_test_s, orb_test_format);
 ORB_DEFINE(orb_test_medium, struct orb_test_medium_s, orb_test_format);
-ORB_DEFINE(orb_test_medium_multi, struct orb_test_medium_s, orb_test_format);
+ORB_DEFINE(orb_test_multi, struct orb_test_medium_s, orb_test_format);
 ORB_DEFINE(orb_test_medium_wrap_around, struct orb_test_medium_s,
            orb_test_format);
-ORB_DEFINE(orb_test_medium_queue, struct orb_test_medium_s, orb_test_format);
-ORB_DEFINE(orb_test_medium_queue_poll, struct orb_test_medium_s,
+ORB_DEFINE(orb_test_queue, struct orb_test_medium_s, orb_test_format);
+ORB_DEFINE(orb_test_queue_poll, struct orb_test_medium_s,
            orb_test_format);
 ORB_DEFINE(orb_test_large, struct orb_test_large_s, orb_test_format);
 
diff --git a/system/uorb/test/utility.h b/system/uorb/test/utility.h
index 512413ab6..813c5a7b9 100644
--- a/system/uorb/test/utility.h
+++ b/system/uorb/test/utility.h
@@ -61,10 +61,10 @@ ORB_DECLARE(orb_test);
 ORB_DECLARE(orb_multitest);
 ORB_DECLARE(orb_test_large);
 ORB_DECLARE(orb_test_medium);
-ORB_DECLARE(orb_test_medium_multi);
+ORB_DECLARE(orb_test_multi);
 ORB_DECLARE(orb_test_medium_wrap_around);
-ORB_DECLARE(orb_test_medium_queue);
-ORB_DECLARE(orb_test_medium_queue_poll);
+ORB_DECLARE(orb_test_queue);
+ORB_DECLARE(orb_test_queue_poll);
 
 /****************************************************************************
  * Public Function Prototypes

Reply via email to