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 6c461cbda21d3c29b3dc4856d040b9a7b0424b1f Author: Junbo Zheng <[email protected]> AuthorDate: Fri Oct 9 21:50:18 2026 +0800 misc: Fix pre-existing nxstyle issues in files touched by the nitems conversion The CI checkpatch runs nxstyle on every file a patch touches, not just on the changed lines. Resolve the accumulated alignment, blank-line and missing-braces issues in those files so that the conversion can pass the checks. Whitespace-only changes plus braces added around single statements where nxstyle requires them; no functional changes. Assisted-by: Claude Code (glm-5.3) <[email protected]> Signed-off-by: Junbo Zheng <[email protected]> --- examples/mml_parser/mml_parser_main.c | 1 + system/nxrecorder/nxrecorder.c | 12 +-- .../kernel/socket/cases/net_socket_test_008.c | 4 + .../kernel/socket/cases/net_socket_test_009.c | 4 + .../kernel/socket/cases/net_socket_test_011.c | 4 + .../testsuites/kernel/syscall/cases/fsync_test.c | 36 ++++----- .../kernel/syscall/cases/getpeername_test.c | 10 ++- .../kernel/syscall/cases/getsocketopt_test.c | 21 ++++- .../testsuites/kernel/syscall/cases/listen_test.c | 36 +++++---- .../kernel/syscall/cases/recvfrom_test.c | 7 ++ .../testsuites/kernel/syscall/cases/sched_test.c | 28 +++---- .../kernel/syscall/cases/setsocketopt01_test.c | 89 ++++++++++++--------- .../kernel/syscall/cases/socketpair_test.c | 90 +++++++++++----------- .../kernel/time/cases/clock_test_timer03.c | 3 +- 14 files changed, 203 insertions(+), 142 deletions(-) diff --git a/examples/mml_parser/mml_parser_main.c b/examples/mml_parser/mml_parser_main.c index 7ccae800f..924dc5a28 100644 --- a/examples/mml_parser/mml_parser_main.c +++ b/examples/mml_parser/mml_parser_main.c @@ -136,6 +136,7 @@ int print_parse_result(int ret_code, FAR struct mml_result_s *result) printf(" : Notes "); { int i; + for (i = 0; i < result->chord_notes; i++) { printf("%d ", result->note_idx[i]); diff --git a/system/nxrecorder/nxrecorder.c b/system/nxrecorder/nxrecorder.c index dfc3c1961..4918bb01c 100644 --- a/system/nxrecorder/nxrecorder.c +++ b/system/nxrecorder/nxrecorder.c @@ -189,6 +189,7 @@ static int nxrecorder_opendevice(FAR struct nxrecorder_s *precorder, if (precorder->dev_fd == -1) { int errcode = errno; + DEBUGASSERT(errcode > 0); auderr("ERROR: Failed to open %s: %d\n", @@ -288,7 +289,7 @@ static int nxrecorder_opendevice(FAR struct nxrecorder_s *precorder, } } - close(precorder->dev_fd); + close(precorder->dev_fd); } } @@ -468,6 +469,7 @@ static int nxrecorder_enqueuebuffer(FAR struct nxrecorder_s *precorder, if (ret < 0) { int errcode = errno; + DEBUGASSERT(errcode > 0); auderr("ERROR: AUDIOIOC_ENQUEUEBUFFER ioctl failed: %d\n", errcode); @@ -608,9 +610,9 @@ static FAR void *nxrecorder_recordthread(pthread_addr_t pvarg) * message after all queued buffers have been returned. */ - streaming = false; - failed = true; - break; + streaming = false; + failed = true; + break; } #ifdef CONFIG_DEBUG_FEATURES else @@ -816,7 +818,7 @@ err_out: if (pbuffers[x] != NULL) { #ifdef CONFIG_AUDIO_MULTI_SESSION - buf_desc.session = precorder->session; + buf_desc.session = precorder->session; #endif buf_desc.u.buffer = pbuffers[x]; ioctl(precorder->dev_fd, AUDIOIOC_FREEBUFFER, diff --git a/testing/testsuites/kernel/socket/cases/net_socket_test_008.c b/testing/testsuites/kernel/socket/cases/net_socket_test_008.c index 3ae7734de..d1a2bd682 100644 --- a/testing/testsuites/kernel/socket/cases/net_socket_test_008.c +++ b/testing/testsuites/kernel/socket/cases/net_socket_test_008.c @@ -120,6 +120,7 @@ static int handlerecv(int fd) { char buf[256]; int ret = recv(fd, buf, sizeof(buf) - 1, 0); + if (ret < 0) { syslog(LOG_INFO, "[%d]Error: %s", fd, strerror(errno)); @@ -151,6 +152,7 @@ static int handleaccept(int lsfd) struct sockaddr_in sa; socklen_t salen = sizeof(sa); int fd = accept(lsfd, (struct sockaddr *)&sa, &salen); + if (fd == INVALID_SOCKET) { perror("accept"); @@ -173,6 +175,7 @@ static int handleaccept(int lsfd) static int handlereadfds(fd_set *fds, int lsfd) { int ret = 0; + for (int i = 0; i < FD_SETSIZE; ++i) { if (gfds[i] == INVALID_SOCKET || !FD_ISSET(gfds[i], fds)) @@ -208,6 +211,7 @@ static void *clientsthread(void *param) } struct sockaddr_in sa; + sa.sin_family = AF_INET; sa.sin_addr.s_addr = htonl(INADDR_LOOPBACK); sa.sin_port = htons(SERVER_PORT); diff --git a/testing/testsuites/kernel/socket/cases/net_socket_test_009.c b/testing/testsuites/kernel/socket/cases/net_socket_test_009.c index e4ca6e6d9..7e497ffdb 100644 --- a/testing/testsuites/kernel/socket/cases/net_socket_test_009.c +++ b/testing/testsuites/kernel/socket/cases/net_socket_test_009.c @@ -120,6 +120,7 @@ static int handlerecv(int fd) { char buf[256]; int ret = recv(fd, buf, sizeof(buf) - 1, 0); + if (ret < 0) { syslog(LOG_INFO, "[%d]Error: %s", fd, strerror(errno)); @@ -151,6 +152,7 @@ static int handleaccept(int lsfd) struct sockaddr_in sa; int salen = sizeof(sa); int fd = accept(lsfd, (struct sockaddr *)&sa, (socklen_t *)&salen); + if (fd == INVALID_SOCKET) { perror("accept"); @@ -173,6 +175,7 @@ static int handleaccept(int lsfd) static int handlereadfds(struct pollfd *fds, int nfds, int lsfd) { int ret = 0; + for (int i = 0; i < nfds; ++i) { if (fds[i].revents == 0) @@ -210,6 +213,7 @@ static void *clientsthread(void *param) } struct sockaddr_in sa; + sa.sin_family = AF_INET; sa.sin_addr.s_addr = htonl(INADDR_LOOPBACK); sa.sin_port = htons(SERVER_PORT); diff --git a/testing/testsuites/kernel/socket/cases/net_socket_test_011.c b/testing/testsuites/kernel/socket/cases/net_socket_test_011.c index 191346bf1..92dda13f2 100644 --- a/testing/testsuites/kernel/socket/cases/net_socket_test_011.c +++ b/testing/testsuites/kernel/socket/cases/net_socket_test_011.c @@ -119,6 +119,7 @@ static int handlerecv(int fd) { char buf[128]; int ret = recv(fd, buf, sizeof(buf) - 1, 0); + if (ret < 0) { syslog(LOG_INFO, "[%d]Error: %s", fd, strerror(errno)); @@ -147,6 +148,7 @@ static int handlerecv(int fd) static int handlereadfds(fd_set *fds, int lsfd) { int ret = 0; + for (int i = 0; i < FD_SETSIZE; ++i) { if (gfds[i] == INVALID_SOCKET || !FD_ISSET(gfds[i], fds)) @@ -174,6 +176,7 @@ static void *clientsthread(void *param) } struct sockaddr_in sa; + sa.sin_family = AF_INET; sa.sin_addr.s_addr = htonl(INADDR_LOOPBACK); sa.sin_port = htons(SERVER_PORT); @@ -223,6 +226,7 @@ static int startclients(pthread_t *cli, int clinum) }; int policy; + ret = pthread_getschedparam(pthread_self(), &policy, ¶m); assert_int_equal(ret, 0); diff --git a/testing/testsuites/kernel/syscall/cases/fsync_test.c b/testing/testsuites/kernel/syscall/cases/fsync_test.c index 2069f5688..928a8e86f 100644 --- a/testing/testsuites/kernel/syscall/cases/fsync_test.c +++ b/testing/testsuites/kernel/syscall/cases/fsync_test.c @@ -109,35 +109,35 @@ void test_nuttx_syscall_fsync02(FAR void **state) } tcases[] = - { - /* EINVAL - fsync() on pipe should not succeed. */ + { + /* EINVAL - fsync() on pipe should not succeed. */ - { - &pipe_fd[1], EINVAL - }, + { + &pipe_fd[1], EINVAL + }, - /* EBADF - fd is closed */ + /* EBADF - fd is closed */ # ifndef CONFIG_FDCHECK - { - &pipe_fd[0], EBADF - }, + { + &pipe_fd[0], EBADF + }, # endif - /* EBADF - fd is invalid (-1) */ + /* EBADF - fd is invalid (-1) */ # ifndef CONFIG_FDSAN - { - &bad_fd, EBADF - }, + { + &bad_fd, EBADF + }, # endif - /* EINVAL - fsync() on fifo should not succeed. */ + /* EINVAL - fsync() on fifo should not succeed. */ - { - &fifo_wfd, EINVAL - }, - }; + { + &fifo_wfd, EINVAL + }, + }; ret = mkfifo("/var/Test_Fifo_SyscallFsync02", 0666); assert_int_equal(ret, 0); diff --git a/testing/testsuites/kernel/syscall/cases/getpeername_test.c b/testing/testsuites/kernel/syscall/cases/getpeername_test.c index e149ec129..023d220c1 100644 --- a/testing/testsuites/kernel/syscall/cases/getpeername_test.c +++ b/testing/testsuites/kernel/syscall/cases/getpeername_test.c @@ -127,11 +127,14 @@ void test_nuttx_syscall_getpeername01(FAR void **state) #ifdef CONFIG_NET_TCP int total = nitems(test_cases); int ret; + setup(); for (int i = 0; i < total; ++i) { if (test_cases[i].setup != NULL) - test_cases[i].setup(i); + { + test_cases[i].setup(i); + } assert_false(test_cases[i].setup != NULL && test_cases[i].sockfd <= 0); @@ -141,7 +144,9 @@ void test_nuttx_syscall_getpeername01(FAR void **state) assert_false(ret != test_cases[i].expretval || errno != test_cases[i].experrno); if (test_cases[i].cleanup != NULL) - test_cases[i].cleanup(i); + { + test_cases[i].cleanup(i); + } } #endif } @@ -157,6 +162,7 @@ __attribute__((unused)) static void setup(void) __attribute__((unused)) static void setup2(int i) { int ret; + ret = open("/dev/null", O_WRONLY, 0666); assert_true(ret >= 0); test_cases[i].sockfd = ret; diff --git a/testing/testsuites/kernel/syscall/cases/getsocketopt_test.c b/testing/testsuites/kernel/syscall/cases/getsocketopt_test.c index 249563df8..773147975 100644 --- a/testing/testsuites/kernel/syscall/cases/getsocketopt_test.c +++ b/testing/testsuites/kernel/syscall/cases/getsocketopt_test.c @@ -139,12 +139,16 @@ void test_nuttx_syscall_getsockopt01(FAR void **state) #if defined(CONFIG_NET) && defined(CONFIG_NET_SOCKOPTS) int ret; int flag = 1; + setup(); for (testno = 0; testno < nitems(tdat); ++testno) { tdat[testno].setup(); if (s < 0) - continue; + { + continue; + } + ret = getsockopt(s, tdat[testno].level, tdat[testno].optname, tdat[testno].optval, tdat[testno].optlen); if (ret != tdat[testno].retval || errno != tdat[testno].experrno) @@ -177,7 +181,9 @@ __attribute__((unused)) static void setup(void) __attribute__((unused)) static void setup0(void) { if (tdat[testno].experrno == EBADF) - s = -400; /* anything not an open file */ + { + s = -400; /* anything not an open file */ + } else if ((s = open("/dev/null", O_WRONLY)) == -1) { syslog(LOG_ERR, @@ -191,7 +197,10 @@ __attribute__((unused)) static void setup0(void) __attribute__((unused)) static void cleanup0(void) { if (tdat[testno].experrno != EBADF && s > 0) - (void)close(s); + { + (void)close(s); + } + s = -1; } @@ -200,8 +209,12 @@ __attribute__((unused)) static void setup1(void) s = safe_socket(tdat[testno].domain, tdat[testno].type, tdat[testno].proto); if (s < 0) - fail_msg("setup1 fail"); + { + fail_msg("setup1 fail"); + } + int ret = safe_bind(s, (struct sockaddr *)&sin0, sizeof(sin0)); + assert_int_not_equal(ret, -1); sinlen = sizeof(fsin1); optlen = sizeof(optval); diff --git a/testing/testsuites/kernel/syscall/cases/listen_test.c b/testing/testsuites/kernel/syscall/cases/listen_test.c index b6021936e..70ece61b3 100644 --- a/testing/testsuites/kernel/syscall/cases/listen_test.c +++ b/testing/testsuites/kernel/syscall/cases/listen_test.c @@ -68,25 +68,25 @@ void test_nuttx_syscall_listen01(FAR void **state) } tdat[] = - { + { #ifndef CONFIG_FDCHECK - { - 0, 0, 0, 0, -1, EBADF, "setup0", "cleanup0", - "bad file descriptor" - }, + { + 0, 0, 0, 0, -1, EBADF, "setup0", "cleanup0", + "bad file descriptor" + }, #endif - { - 0, 0, 0, 0, -1, ENOTSOCK, "setup0", "cleanup0", "not a socket" - }, + { + 0, 0, 0, 0, -1, ENOTSOCK, "setup0", "cleanup0", "not a socket" + }, # ifdef CONFIG_NET_UDP - { - PF_INET, SOCK_DGRAM, 0, 0, -1, EOPNOTSUPP, "setup1", "cleanup1", - "UDP listen" - }, + { + PF_INET, SOCK_DGRAM, 0, 0, -1, EOPNOTSUPP, "setup1", "cleanup1", + "UDP listen" + }, # endif - }; + }; const char set[] = "setup0"; const char clean[] = "cleanup0"; @@ -98,10 +98,14 @@ void test_nuttx_syscall_listen01(FAR void **state) if (!strcmp(tdat[testno].setup, set)) { if (tdat[testno].experrno == EBADF) - s = -400; /* anything not an open file */ + { + s = -400; /* anything not an open file */ + } else if ((s = open("/dev/null", O_WRONLY)) == -1) - syslog(LOG_ERR, "error opening /dev/null - errno: %s\n", - strerror(errno)); + { + syslog(LOG_ERR, "error opening /dev/null - errno: %s\n", + strerror(errno)); + } } else diff --git a/testing/testsuites/kernel/syscall/cases/recvfrom_test.c b/testing/testsuites/kernel/syscall/cases/recvfrom_test.c index 99de0b1a3..c95eb271c 100644 --- a/testing/testsuites/kernel/syscall/cases/recvfrom_test.c +++ b/testing/testsuites/kernel/syscall/cases/recvfrom_test.c @@ -158,6 +158,7 @@ tdat[] = __attribute__((unused)) static int setup(void) { int r = pthread_create(&thread, NULL, start_server, (void *)&sin1); + if (r < 0) { syslog(LOG_ERR, "pthread_create fail, errno %d\n", errno); @@ -353,15 +354,18 @@ __attribute__((unused)) static void do_child(void) while (1) { socklen_t fromlen_s; + memcpy(&rfds, &afds, sizeof(rfds)); if (select(nfds, &rfds, NULL, NULL, NULL) < 0) + { if (errno != EINTR) { syslog(LOG_ERR, "select exit fail\n"); fail_msg("test fail !"); return; } + } if (FD_ISSET(sfd, &rfds)) { @@ -381,6 +385,7 @@ __attribute__((unused)) static void do_child(void) } for (fd = 0; fd < nfds; ++fd) + { if (fd != sfd && FD_ISSET(fd, &rfds)) { cc = read(fd, buf, sizeof(buf)); @@ -390,6 +395,7 @@ __attribute__((unused)) static void do_child(void) FD_CLR(fd, &afds); } } + } pthread_testcancel(); } @@ -408,6 +414,7 @@ void test_nuttx_syscall_recvfromtest01(FAR void **state) #ifdef CONFIG_NET_TCP int ret; int flag = 1; + setup(); for (testno = 0; testno < nitems(tdat); ++testno) diff --git a/testing/testsuites/kernel/syscall/cases/sched_test.c b/testing/testsuites/kernel/syscall/cases/sched_test.c index 7f6c8ef04..377153712 100644 --- a/testing/testsuites/kernel/syscall/cases/sched_test.c +++ b/testing/testsuites/kernel/syscall/cases/sched_test.c @@ -61,19 +61,19 @@ void test_nuttx_syscall_sched01(FAR void **state) } TC[] = - { - /* set scheduling policy to SCHED_RR */ + { + /* set scheduling policy to SCHED_RR */ - { - 1, SCHED_RR - }, + { + 1, SCHED_RR + }, - /* set scheduling policy to SCHED_FIFO */ + /* set scheduling policy to SCHED_FIFO */ - { - 1, SCHED_FIFO - } - }; + { + 1, SCHED_FIFO + } + }; int i; int rec; @@ -172,11 +172,11 @@ void test_nuttx_syscall_sched04(FAR void **state) } test_cases[] = + { { - { - &inval_pid, &tp, EINVAL - } - }; + &inval_pid, &tp, EINVAL + } + }; int TST_TOTAL = nitems(test_cases); diff --git a/testing/testsuites/kernel/syscall/cases/setsocketopt01_test.c b/testing/testsuites/kernel/syscall/cases/setsocketopt01_test.c index f499e41d4..829b70d5e 100644 --- a/testing/testsuites/kernel/syscall/cases/setsocketopt01_test.c +++ b/testing/testsuites/kernel/syscall/cases/setsocketopt01_test.c @@ -67,49 +67,49 @@ void test_nuttx_syscall_setsockopt01(FAR void **state) } testcase_list[] = - { + { # ifndef CONFIG_FDCHECK - { - -1, -1, -1, SOL_SOCKET, SO_OOBINLINE, &optval, sizeof(optval), - EBADF, "invalid file descriptor" - }, + { + -1, -1, -1, SOL_SOCKET, SO_OOBINLINE, &optval, sizeof(optval), + EBADF, "invalid file descriptor" + }, # endif - { - -1, -1, -1, SOL_SOCKET, SO_OOBINLINE, &optval, sizeof(optval), - ENOTSOCK, "non-socket file descriptor" - }, + { + -1, -1, -1, SOL_SOCKET, SO_OOBINLINE, &optval, sizeof(optval), + ENOTSOCK, "non-socket file descriptor" + }, - { - PF_INET, SOCK_STREAM, 0, SOL_SOCKET, SO_OOBINLINE, NULL, - sizeof(optval), EFAULT, "invalid option buffer" - }, + { + PF_INET, SOCK_STREAM, 0, SOL_SOCKET, SO_OOBINLINE, NULL, + sizeof(optval), EFAULT, "invalid option buffer" + }, - { - PF_INET, SOCK_STREAM, 0, SOL_SOCKET, SO_OOBINLINE, &optval, 0, - EINVAL, "invalid optlen" - }, + { + PF_INET, SOCK_STREAM, 0, SOL_SOCKET, SO_OOBINLINE, &optval, 0, + EINVAL, "invalid optlen" + }, - { - PF_INET, SOCK_STREAM, 0, 500, SO_OOBINLINE, &optval, - sizeof(optval), ENOPROTOOPT, "invalid level" - }, + { + PF_INET, SOCK_STREAM, 0, 500, SO_OOBINLINE, &optval, + sizeof(optval), ENOPROTOOPT, "invalid level" + }, - { - PF_INET, SOCK_STREAM, 0, IPPROTO_UDP, SO_OOBINLINE, &optval, - sizeof(optval), ENOPROTOOPT, "invalid option name (UDP)" - }, + { + PF_INET, SOCK_STREAM, 0, IPPROTO_UDP, SO_OOBINLINE, &optval, + sizeof(optval), ENOPROTOOPT, "invalid option name (UDP)" + }, - { - PF_INET, SOCK_STREAM, 0, IPPROTO_IP, -1, &optval, sizeof(optval), - ENOPROTOOPT, "invalid option name (IP)" - }, + { + PF_INET, SOCK_STREAM, 0, IPPROTO_IP, -1, &optval, sizeof(optval), + ENOPROTOOPT, "invalid option name (IP)" + }, - { - PF_INET, SOCK_STREAM, 0, IPPROTO_TCP, -1, &optval, sizeof(optval), - ENOPROTOOPT, "invalid option name (TCP)" - } - }; + { + PF_INET, SOCK_STREAM, 0, IPPROTO_TCP, -1, &optval, sizeof(optval), + ENOPROTOOPT, "invalid option name (TCP)" + } + }; /* initialize local sockaddr */ @@ -123,27 +123,40 @@ void test_nuttx_syscall_setsockopt01(FAR void **state) struct test_case *tc = testcase_list + n; int tmpfd; int fd; + if (tc->domain == -1) { tmpfd = fd = SAFE_OPEN("/dev/null", O_WRONLY); if (fd < 0) - continue; + { + continue; + } } else { tmpfd = fd = safe_socket(tc->domain, tc->type, tc->proto); if (fd < 0) - continue; + { + continue; + } + if (safe_bind(fd, (struct sockaddr *)&addr, sizeof(addr)) < 0) - continue; + { + continue; + } } /* Use closed file descriptor rather than -1 */ if (tc->experrno == EBADF) + { if (safe_close(tmpfd) < 0) - continue; + { + continue; + } + } + ret = setsockopt(fd, tc->level, tc->optname, tc->optval, tc->optlen); if (tc->experrno != EBADF) diff --git a/testing/testsuites/kernel/syscall/cases/socketpair_test.c b/testing/testsuites/kernel/syscall/cases/socketpair_test.c index a7d968e3b..9bd8472b8 100644 --- a/testing/testsuites/kernel/syscall/cases/socketpair_test.c +++ b/testing/testsuites/kernel/syscall/cases/socketpair_test.c @@ -68,52 +68,53 @@ void test_nuttx_syscall_socketpair01(FAR void **state) } tdat[] = + { { - { - 0, SOCK_STREAM, 0, fds, -1, EAFNOSUPPORT, "invalid domain" - }, + 0, SOCK_STREAM, 0, fds, -1, EAFNOSUPPORT, "invalid domain" + }, - { - PF_INET, 75, 0, fds, -1, EINVAL, "invalid type" - }, + { + PF_INET, 75, 0, fds, -1, EINVAL, "invalid type" + }, - { - PF_UNIX, SOCK_DGRAM, 0, fds, 0, 0, "UNIX domain dgram" - }, + { + PF_UNIX, SOCK_DGRAM, 0, fds, 0, 0, "UNIX domain dgram" + }, - { - PF_INET, SOCK_RAW, 0, fds, -1, EPROTONOSUPPORT, - "raw open as non-root" - }, + { + PF_INET, SOCK_RAW, 0, fds, -1, EPROTONOSUPPORT, + "raw open as non-root" + }, #ifndef UCLINUX - { - PF_UNIX, SOCK_STREAM, 0, 0, -1, EFAULT, "bad aligned pointer" - }, + { + PF_UNIX, SOCK_STREAM, 0, 0, -1, EFAULT, "bad aligned pointer" + }, - { - PF_UNIX, SOCK_STREAM, 0, (int *)7, -1, EFAULT, - "bad unaligned pointer" - }, + { + PF_UNIX, SOCK_STREAM, 0, (int *)7, -1, EFAULT, + "bad unaligned pointer" + }, #endif - /* {PF_INET, SOCK_DGRAM, 17, fds, -1, EOPNOTSUPP, "UDP socket"}, */ + /* {PF_INET, SOCK_DGRAM, 17, fds, -1, EOPNOTSUPP, "UDP socket"}, */ - { - PF_INET, SOCK_DGRAM, 6, fds, -1, EPROTONOSUPPORT, "TCP dgram" - }, + { + PF_INET, SOCK_DGRAM, 6, fds, -1, EPROTONOSUPPORT, "TCP dgram" + }, - /* {PF_INET, SOCK_STREAM, 6, fds, -1, EOPNOTSUPP, "TCP socket"}, */ + /* {PF_INET, SOCK_STREAM, 6, fds, -1, EOPNOTSUPP, "TCP socket"}, */ - { - PF_INET, SOCK_STREAM, 1, fds, -1, EPROTONOSUPPORT, - "ICMP stream" - } - }; + { + PF_INET, SOCK_STREAM, 1, fds, -1, EPROTONOSUPPORT, + "ICMP stream" + } + }; for (int n = 0; n < nitems(tdat); n++) { struct test_case_t *tc = &tdat[n]; + ret = socketpair(tc->domain, tc->type, tc->proto, tc->sv); if (ret == 0) { @@ -154,29 +155,30 @@ void test_nuttx_syscall_socketpair02(FAR void **state) } tcases[] = + { { - { - SOCK_STREAM, 0, F_GETFD, "no close-on-exec" - }, + SOCK_STREAM, 0, F_GETFD, "no close-on-exec" + }, - { - SOCK_STREAM | SOCK_CLOEXEC, FD_CLOEXEC, F_GETFD, "close-on-exec" - }, + { + SOCK_STREAM | SOCK_CLOEXEC, FD_CLOEXEC, F_GETFD, "close-on-exec" + }, - { - SOCK_STREAM, 0, F_GETFL, "no non-blocking" - }, + { + SOCK_STREAM, 0, F_GETFL, "no non-blocking" + }, - { - SOCK_STREAM | SOCK_NONBLOCK, O_NONBLOCK, F_GETFL, - "non-blocking" - } - }; + { + SOCK_STREAM | SOCK_NONBLOCK, O_NONBLOCK, F_GETFL, + "non-blocking" + } + }; for (int n = 0; n < nitems(tcases); n++) { int res; struct tcase *tc = &tcases[n]; + ret = socketpair(PF_UNIX, tc->type, 0, fds); if (ret == -1) { diff --git a/testing/testsuites/kernel/time/cases/clock_test_timer03.c b/testing/testsuites/kernel/time/cases/clock_test_timer03.c index c915e4076..c1e5c737d 100644 --- a/testing/testsuites/kernel/time/cases/clock_test_timer03.c +++ b/testing/testsuites/kernel/time/cases/clock_test_timer03.c @@ -101,7 +101,8 @@ void test_nuttx_clock_test_timer03(FAR void **state) struct timespec start; struct timespec end; struct itimerspec its; - int64_t expected, escaped; + int64_t expected; + int64_t escaped; its.it_interval = zero; its.it_value = testcases[i];
