You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2022/08/31 15:11:30 UTC

[GitHub] [incubator-nuttx-apps] anchao opened a new pull request, #1304: net/usrsock: fix usrsocktest test case break

anchao opened a new pull request, #1304:
URL: https://github.com/apache/incubator-nuttx-apps/pull/1304

   ## Summary
   
   1. examples/usrsocktest: add some delay to wait the daemon task ready
   2. examples/usrsocktest: add USRSOCK_REQUEST_IOCTL support
   
      The test model of usrsock ioctl() has changed after file socket layer implemented from vfs,
      usrsock must implement the ioctl() hook to pass this test
   
   3. examples/usrsocktest: fix build break
   
   ```
      usrsocktest_wake_with_signal.c: In function ‘do_wake_test’:
      usrsocktest_wake_with_signal.c:553:16: error: ‘USEC_PER_MSEC’ undeclared (first use in this function)
        553 |   usleep(100 * USEC_PER_MSEC); /* Let worker thread proceed to blocking
            |                ^~~~~~~~~~~~~
   ```
   
   4. examples/usrsocktest: correct the check region of remote address
   
      let us skip the sin_zero
   
   5. examples/usrsocktest: correct return value check of dup2()
   
   ```
      DUP(2) Linux Programmer's Manual
   
      NAME
             dup, dup2, dup3 - duplicate a file descriptor
      ...
      RETURN VALUE
             On success, these system calls return the new file descriptor.
             On error, -1 is returned, and errno is set appropriately.
   ```
   
   
   ## Impact
   
   ## Testing
   
   ```
   NuttShell (NSH) NuttX-10.4.0
   MOTD: username=admin password=Administrator
   nsh> usrsocktest
   Starting unit-tests...
   Testing group "char_dev" =>
   	Group "char_dev": [OK]
   Testing group "no_daemon" =>
   	Group "no_daemon": [OK]
   Testing group "basic_daemon" =>
   	Group "basic_daemon": [OK]
   Testing group "basic_connect" =>
   	Group "basic_connect": [OK]
   Testing group "basic_connect_delay" =>
   	Group "basic_connect_delay": [OK]
   Testing group "no_block_connect" =>
   	Group "no_block_connect": [OK]
   Testing group "basic_send" =>
   	Group "basic_send": [OK]
   Testing group "no_block_send" =>
   	Group "no_block_send": [OK]
   Testing group "block_send" =>
   	Group "block_send": [OK]
   Testing group "no_block_recv" =>
   	Group "no_block_recv": [OK]
   Testing group "block_recv" =>
   	Group "block_recv": [OK]
   Testing group "remote_disconnect" =>
   	Group "remote_disconnect": [OK]
   Testing group "basic_setsockopt" =>
   	Group "basic_setsockopt": [OK]
   Testing group "basic_getsockopt" =>
   	Group "basic_getsockopt": [OK]
   Testing group "basic_getsockname" =>
   	Group "basic_getsockname": [OK]
   Testing group "wake_with_signal" =>
   	Group "wake_with_signal": [OK]
   Testing group "multithread" =>
   	Group "multithread": [OK]
   Unit-test groups done... OK:17, FAILED:0, TOTAL:17
    -- number of checks made: 3589
   HEAP BEFORE TESTS:
                total       used       free    largest
   Mem:      67108368    1860016   65248352   65248192
   HEAP AFTER TESTS:
                total       used       free    largest
   Mem:      67108368    2200400   64907968   64906336
   
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx-apps] xiaoxiang781216 commented on a diff in pull request #1304: net/usrsock: fix usrsocktest test case break

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #1304:
URL: https://github.com/apache/incubator-nuttx-apps/pull/1304#discussion_r959785460


##########
examples/usrsocktest/usrsocktest_daemon.c:
##########
@@ -1380,6 +1387,143 @@ static int getsockname_request(int fd, FAR struct daemon_priv_s *priv,
   return OK;
 }
 
+static int ioctl_request(int fd, FAR struct daemon_priv_s *priv,
+                         FAR void *hdrbuf)
+{
+  FAR struct usrsock_request_ioctl_s *req = hdrbuf;
+  struct usrsock_message_datareq_ack_s resp = {
+  };
+
+  FAR struct test_socket_s *tsock;
+  uint32_t value;
+  ssize_t wlen;
+  ssize_t rlen;
+  int ret;
+
+  /* Check if this socket exists. */
+
+  tsock = test_socket_get(priv, req->usockid);
+  if (!tsock)
+    {
+      ret = -EBADFD;
+      goto prepare;
+    }
+
+  if (req->arglen != sizeof(value))
+    {
+      ret = -EINVAL;
+      goto prepare;
+    }
+
+  if (req->cmd != FIONBIO)
+    {
+      ret = -EINVAL;

Review Comment:
   ENOTTY



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx-apps] xiaoxiang781216 merged pull request #1304: net/usrsock: fix usrsocktest test case break

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 merged PR #1304:
URL: https://github.com/apache/incubator-nuttx-apps/pull/1304


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx-apps] anchao commented on a diff in pull request #1304: net/usrsock: fix usrsocktest test case break

Posted by GitBox <gi...@apache.org>.
anchao commented on code in PR #1304:
URL: https://github.com/apache/incubator-nuttx-apps/pull/1304#discussion_r960224419


##########
examples/usrsocktest/usrsocktest_daemon.c:
##########
@@ -1380,6 +1387,143 @@ static int getsockname_request(int fd, FAR struct daemon_priv_s *priv,
   return OK;
 }
 
+static int ioctl_request(int fd, FAR struct daemon_priv_s *priv,
+                         FAR void *hdrbuf)
+{
+  FAR struct usrsock_request_ioctl_s *req = hdrbuf;
+  struct usrsock_message_datareq_ack_s resp = {
+  };
+
+  FAR struct test_socket_s *tsock;
+  uint32_t value;
+  ssize_t wlen;
+  ssize_t rlen;
+  int ret;
+
+  /* Check if this socket exists. */
+
+  tsock = test_socket_get(priv, req->usockid);
+  if (!tsock)
+    {
+      ret = -EBADFD;
+      goto prepare;
+    }
+
+  if (req->arglen != sizeof(value))
+    {
+      ret = -EINVAL;
+      goto prepare;
+    }
+
+  if (req->cmd != FIONBIO)
+    {
+      ret = -EINVAL;

Review Comment:
   Done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org