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 f9dc9bc21e6a2b3c83826bc5efae78903f31455f Author: fangpeina <[email protected]> AuthorDate: Mon Nov 25 10:44:11 2024 +0800 testing: Fix cmocka_syscall_test crash when CONFIG_FDCHECK enable Fix cmocka_syscall_test crash when CONFIG_FDCHECK is enabled. Signed-off-by: fangpeina <[email protected]> --- testing/testsuites/kernel/syscall/cases/connect_test.c | 6 ++++-- testing/testsuites/kernel/syscall/cases/dup_test.c | 2 +- testing/testsuites/kernel/syscall/cases/listen_test.c | 2 ++ 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/testing/testsuites/kernel/syscall/cases/connect_test.c b/testing/testsuites/kernel/syscall/cases/connect_test.c index 530e9c8fd..8c808e1a4 100644 --- a/testing/testsuites/kernel/syscall/cases/connect_test.c +++ b/testing/testsuites/kernel/syscall/cases/connect_test.c @@ -77,11 +77,13 @@ __attribute__((unused)) static struct test_case_t tdat[] = { + #ifndef CONFIG_FDCHECK { PF_INET, SOCK_STREAM, 0, (struct sockaddr *)&sin1, sizeof(struct sockaddr_in), -1, EBADF, setup0, cleanup0, "bad file descriptor" }, + #endif #ifndef UCLINUX /* Skip since uClinux does not implement memory protection */ @@ -97,12 +99,12 @@ tdat[] = PF_INET, SOCK_STREAM, 0, (struct sockaddr *)&sin1, 3, -1, EINVAL, setup1, cleanup1, "invalid salen" }, - + #ifndef CONFIG_FDCHECK { 0, 0, 0, (struct sockaddr *)&sin1, sizeof(sin1), -1, ENOTSOCK, setup0, cleanup0, "invalid socket" }, - + #endif { PF_INET, SOCK_STREAM, 0, (struct sockaddr *)&sin1, sizeof(sin1), -1, EISCONN, setup2, cleanup1, diff --git a/testing/testsuites/kernel/syscall/cases/dup_test.c b/testing/testsuites/kernel/syscall/cases/dup_test.c index 0d31adae1..4794866be 100644 --- a/testing/testsuites/kernel/syscall/cases/dup_test.c +++ b/testing/testsuites/kernel/syscall/cases/dup_test.c @@ -78,7 +78,7 @@ void test_nuttx_syscall_dup01(FAR void **state) void test_nuttx_syscall_dup02(FAR void **state) { -#ifndef CONFIG_FDSAN +#if !defined(CONFIG_FDSAN) && !defined(CONFIG_FDCHECK) int fds[] = { -1, 1500 diff --git a/testing/testsuites/kernel/syscall/cases/listen_test.c b/testing/testsuites/kernel/syscall/cases/listen_test.c index 7dc4ba266..de016b009 100644 --- a/testing/testsuites/kernel/syscall/cases/listen_test.c +++ b/testing/testsuites/kernel/syscall/cases/listen_test.c @@ -68,10 +68,12 @@ void test_nuttx_syscall_listen01(FAR void **state) tdat[] = { + #ifndef CONFIG_FDCHECK { 0, 0, 0, 0, -1, EBADF, "setup0", "cleanup0", "bad file descriptor" }, + #endif { 0, 0, 0, 0, -1, ENOTSOCK, "setup0", "cleanup0", "not a socket"
