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

Function run_secondary_instances

dpdk/app/test/test_mp_secondary.c:65–124  ·  view source on GitHub ↗

* This function is called in the primary i.e. main test, to spawn off secondary * processes to run actual mp tests. Uses fork() and exec pair */

Source from the content-addressed store, hash-verified

63 * processes to run actual mp tests. Uses fork() and exec pair
64 */
65static int
66run_secondary_instances(void)
67{
68 int ret = 0;
69 char coremask[10];
70
71#ifdef RTE_EXEC_ENV_LINUX
72 char tmp[PATH_MAX] = {0};
73 char prefix[PATH_MAX] = {0};
74
75 get_current_prefix(tmp, sizeof(tmp));
76
77 snprintf(prefix, sizeof(prefix), "--file-prefix=%s", tmp);
78#else
79 const char *prefix = "";
80#endif
81
82 /* good case, using secondary */
83 const char *argv1[] = {
84 prgname, "-c", coremask, "--proc-type=secondary",
85 prefix
86 };
87 /* good case, using auto */
88 const char *argv2[] = {
89 prgname, "-c", coremask, "--proc-type=auto",
90 prefix
91 };
92 /* bad case, using invalid type */
93 const char *argv3[] = {
94 prgname, "-c", coremask, "--proc-type=ERROR",
95 prefix
96 };
97#ifdef RTE_EXEC_ENV_LINUX
98 /* bad case, using invalid file prefix */
99 const char *argv4[] = {
100 prgname, "-c", coremask, "--proc-type=secondary",
101 "--file-prefix=ERROR"
102 };
103#endif
104
105 snprintf(coremask, sizeof(coremask), "%x", \
106 (1 << rte_get_main_lcore()));
107
108 ret |= launch_proc(argv1);
109 printf("### Testing rte_mp_disable() reject:\n");
110 if (rte_mp_disable()) {
111 printf("Error: rte_mp_disable() has been accepted\n");
112 ret |= -1;
113 } else {
114 printf("# Checked rte_mp_disable() is refused\n");
115 }
116 ret |= launch_proc(argv2);
117
118 ret |= !(launch_proc(argv3));
119#ifdef RTE_EXEC_ENV_LINUX
120 ret |= !(launch_proc(argv4));
121#endif
122

Callers 1

test_mp_secondaryFunction · 0.85

Calls 5

get_current_prefixFunction · 0.85
snprintfFunction · 0.85
rte_get_main_lcoreFunction · 0.85
printfFunction · 0.50
rte_mp_disableFunction · 0.50

Tested by

no test coverage detected