* 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 */
| 63 | * processes to run actual mp tests. Uses fork() and exec pair |
| 64 | */ |
| 65 | static int |
| 66 | run_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 |
no test coverage detected