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 2020/11/18 08:09:07 UTC

[incubator-nuttx-apps] branch master updated: test/sensor: fix test failed when some apis are NULL

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/incubator-nuttx-apps.git


The following commit(s) were added to refs/heads/master by this push:
     new a96867a  test/sensor: fix test failed when some apis are NULL
a96867a is described below

commit a96867a65d39f3e4ec99003f54b1762e652d1f2d
Author: dongjiuzhu <do...@xiaomi.com>
AuthorDate: Wed Nov 11 16:09:55 2020 +0800

    test/sensor: fix test failed when some apis are NULL
    
    N/A
    
    Change-Id: Ieb40b3ce73240057a181ee0dd482564cf27f6afa
    Signed-off-by: dongjiuzhu <do...@xiaomi.com>
---
 testing/sensortest/sensortest.c | 27 ++++++++++++++++++---------
 1 file changed, 18 insertions(+), 9 deletions(-)

diff --git a/testing/sensortest/sensortest.c b/testing/sensortest/sensortest.c
index cca82a6..787c3d6 100644
--- a/testing/sensortest/sensortest.c
+++ b/testing/sensortest/sensortest.c
@@ -258,27 +258,36 @@ int main(int argc, FAR char *argv[])
   if (ret < 0)
     {
       ret = -errno;
-      printf("Failed to enable sensor:%s, ret:%s\n",
-             devname, strerror(errno));
-      goto ctl_err;
+      if (ret != -ENOTTY)
+        {
+          printf("Failed to enable sensor:%s, ret:%s\n",
+                 devname, strerror(errno));
+          goto ctl_err;
+        }
     }
 
   ret = ioctl(fd, SNIOC_SET_INTERVAL, &interval);
   if (ret < 0)
     {
       ret = -errno;
-      snerr("Failed to set interval for sensor:%s, ret:%s\n",
-            devname, strerror(errno));
-      goto ctl_err;
+      if (ret != -ENOTTY)
+        {
+          printf("Failed to set interval for sensor:%s, ret:%s\n",
+                devname, strerror(errno));
+          goto ctl_err;
+        }
     }
 
   ret = ioctl(fd, SNIOC_BATCH, &latency);
   if (ret < 0)
     {
       ret = -errno;
-      snerr("Failed to batch for sensor:%s, ret:%s\n",
-            devname, strerror(errno));
-      goto ctl_err;
+      if (ret != -ENOTTY)
+        {
+          printf("Failed to batch for sensor:%s, ret:%s\n",
+                devname, strerror(errno));
+          goto ctl_err;
+        }
     }
 
   printf("SensorTest: Test %s with interval(%uus), latency(%uus)\n",