fix rpc_suite/rpc:add check returned value
Subsystems (2)
PATCH 1/1 fix rpc_suite/rpc:add check returned value
"Segmentation fault (core dumped)" due to the failure of svcfd_create during the rpc test, so you need to check the return value of the "svcfd_create" function
--- .../rpc/rpc_createdestroy_svc_destroy/rpc_svc_destroy.c | 5 +++++ .../rpc_createdestroy_svc_destroy/rpc_svc_destroy_stress.c | 5 +++++ .../rpc/rpc_regunreg_xprt_register/rpc_xprt_register.c | 5 +++++ .../rpc/rpc_regunreg_xprt_unregister/rpc_xprt_unregister.c | 5 +++++ 4 files changed, 20 insertions(+)
testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_createdestroy_svc_destroy/rpc_svc_destroy.c +5 -0
@@ -46,6 +46,11 @@ int main(void)//First of all, create a server svcr =svcfd_create (fd,0 ,0 ); + +//check returned value +if ((SVCXPRT *) svcr ==NULL ) { +return test_status; + }//Then call destroy macro svc_destroy (svcr);
testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_createdestroy_svc_destroy/rpc_svc_destroy_stress.c +5 -0
@@ -55,6 +55,11 @@ int main(int argn, char *argc[])//First of all, create a server for (i =0 ; i < nbCall; i++) { svcr =svcfd_create (fd,0 ,0 ); + +//check returned value +if ((SVCXPRT *) svcr ==NULL ) +continue ; + svcr =NULL ;//Then call destroy macro svc_destroy (svcr);
testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_regunreg_xprt_register/rpc_xprt_register.c +5 -0
@@ -48,6 +48,11 @@ int main(void)//create a server svcr =svcfd_create (fd,1024 ,1024 ); + +//check returned value +if ((SVCXPRT *) svcr ==NULL ) { +return test_status; + }//call routine xprt_register (svcr);
testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_regunreg_xprt_unregister/rpc_xprt_unregister.c +5 -0
@@ -52,6 +52,11 @@ int main(int argn, char *argc[])//create a server svcr =svcfd_create (fd,1024 ,1024 ); + +//check returned value +if ((SVCXPRT *) svcr ==NULL ) { +return test_status; + }xprt_register (svcr);//call routine
Signature · 1 line
2.27.0
Hi all,
[Cc libtirpc ML and Steve]
Quoted 1 line
"Segmentation fault (core dumped)" due to the failure of
svcfd_createduring the rpc test, so you need to check the return value of the "svcfd_create" function
I'm not sure what is the value of TI-RPC tests. IMHO really messy code does not in the end cover much of libtirpc functionality. That's why I'm thinking to propose deleting whole testcases/network/rpc/rpc-tirpc/. libtirpc is being used in nfs-utils, thus it'd deserve to have some testing, but IMHO this should be libtirpc.
I'm not planning to dive into the technology to understand it enough be able to written the tests from scratch and I'm not aware of anybody else planning it.
Quoted 29 lines
Signed-off-by dongshijiang <[email protected]>--- .../rpc/rpc_createdestroy_svc_destroy/rpc_svc_destroy.c | 5 +++++ .../rpc_createdestroy_svc_destroy/rpc_svc_destroy_stress.c | 5 +++++ .../rpc/rpc_regunreg_xprt_register/rpc_xprt_register.c | 5 +++++ .../rpc/rpc_regunreg_xprt_unregister/rpc_xprt_unregister.c | 5 +++++ 4 files changed, 20 insertions(+)testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_createdestroy_svc_destroy/rpc_svc_destroy.c +5
-0@@ -46,6 +46,11 @@ int main(void)//First of all, create a server svcr =svcfd_create (fd,0 ,0 ); + +//check returned value +if ((SVCXPRT *) svcr ==NULL ) { +return test_status; + }//Then call destroy macro svc_destroy (svcr);testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_createdestroy_svc_destroy/rpc_svc_destroy_stress.c +0
-0
testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_createdestroy_svc_destroy/rpc_svc_destroy_stress.c int main(int argn, char *argc[]) · line 62
Quoted 8 lines
testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_createdestroy_svc_destroy/rpc_svc_destroy_stress.c +5
-0@@ -55,6 +55,11 @@ int main(int argn, char *argc[])//First of all, create a server for (i =0 ; i < nbCall; i++) { svcr =svcfd_create (fd,0 ,0 ); + +//check returned value +if ((SVCXPRT *) svcr ==NULL ) +continue ; + svcr =NULL ;
man svc_destroy(3) states that it deallocates private data structures, including xprt itself.
Kind regards,
Petr
Quoted 34 lines
testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_createdestroy_svc_destroy/rpc_svc_destroy_stress.c +0
-0//Then call destroy macro svc_destroy (svcr);testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_regunreg_xprt_register/rpc_xprt_register.c +5
-0@@ -48,6 +48,11 @@ int main(void)//create a server svcr =svcfd_create (fd,1024 ,1024 ); + +//check returned value +if ((SVCXPRT *) svcr ==NULL ) { +return test_status; + }//call routine xprt_register (svcr);testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_regunreg_xprt_unregister/rpc_xprt_unregister.c +5
-0@@ -52,6 +52,11 @@ int main(int argn, char *argc[])//create a server svcr =svcfd_create (fd,1024 ,1024 ); + +//check returned value +if ((SVCXPRT *) svcr ==NULL ) { +return test_status; + }xprt_register (svcr);//call routine
PATCH 1/1 fix rpc_suite/rpc:add check returned value
In reply to dongshijiangHi dongshijiang,
Quoted 1 line
"Segmentation fault (core dumped)" due to the failure of
svcfd_createduring the rpc test, so you need to check the return value of the "svcfd_create" function
Merged (with removed useless (SVCXPRT *) cast and svcr = NULL; also added more cleanup in additional commit.
Thanks!
Kind regards,
Petr