testing: Fix cmocka_syscall_test crash when CONFIG_FDCHECK enable

Fix cmocka_syscall_test crash when CONFIG_FDCHECK is enabled.

Signed-off-by: fangpeina <fangpeina@xiaomi.com>
This commit is contained in:
fangpeina 2024-11-25 10:44:11 +08:00 committed by Xiang Xiao
parent eb9b9a2d60
commit f9dc9bc21e
3 changed files with 7 additions and 3 deletions

View file

@ -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,

View file

@ -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

View file

@ -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"