MCPcopy Create free account
hub / github.com/F-Stack/f-stack / test_exit_val

Function test_exit_val

dpdk/app/test/test_debug.c:66–93  ·  view source on GitHub ↗

use fork() to test rte_exit() */

Source from the content-addressed store, hash-verified

64
65/* use fork() to test rte_exit() */
66static int
67test_exit_val(int exit_val)
68{
69 int pid;
70 int status;
71
72 /* manually cleanup EAL memory, as the fork() below would otherwise
73 * cause the same hugepages to be free()-ed multiple times.
74 */
75 rte_service_finalize();
76
77 pid = fork();
78
79 if (pid == 0)
80 rte_exit(exit_val, __func__);
81 else if (pid < 0){
82 printf("Fork Failed\n");
83 return -1;
84 }
85 wait(&status);
86 printf("Child process status: %d\n", status);
87 if(!WIFEXITED(status) || WEXITSTATUS(status) != (uint8_t)exit_val){
88 printf("Child process terminated with incorrect status (expected = %d)!\n",
89 exit_val);
90 return -1;
91 }
92 return 0;
93}
94
95static int
96test_exit(void)

Callers 1

test_exitFunction · 0.85

Calls 3

rte_service_finalizeFunction · 0.85
rte_exitFunction · 0.85
printfFunction · 0.50

Tested by

no test coverage detected