4 * Copyright(c) 2010-2013 Intel Corporation. All rights reserved.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
11 * * Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * * Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in
15 * the documentation and/or other materials provided with the
17 * * Neither the name of Intel Corporation nor the names of its
18 * contributors may be used to endorse or promote products derived
19 * from this software without specific prior written permission.
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 #include <cmdline_parse.h>
40 #ifndef RTE_EXEC_ENV_BAREMETAL
52 #include <rte_debug.h>
53 #include <rte_string_fns.h>
57 #define mp_flag "--proc-type=secondary"
58 #define no_hpet "--no-hpet"
59 #define no_huge "--no-huge"
60 #define no_shconf "--no-shconf"
61 #define memtest "memtest"
62 #define memtest1 "memtest1"
63 #define memtest2 "memtest2"
64 #define SOCKET_MEM_STRLEN (RTE_MAX_NUMA_NODES * 10)
65 #define launch_proc(ARGV) process_dup(ARGV, \
66 sizeof(ARGV)/(sizeof(ARGV[0])), __func__)
68 enum hugepage_action {
69 HUGEPAGE_CHECK_EXISTS = 0,
70 HUGEPAGE_CHECK_LOCKED,
75 /* if string contains a hugepage path */
77 get_hugepage_path(char * src, int src_len, char * dst, int dst_len)
80 char *tokens[NUM_TOKENS];
82 /* if we couldn't properly split the string */
83 if (rte_strsplit(src, src_len, tokens, NUM_TOKENS, ' ') < NUM_TOKENS)
86 if (strncmp(tokens[2], "hugetlbfs", sizeof("hugetlbfs")) == 0) {
87 rte_snprintf(dst, dst_len, "%s", tokens[1]);
94 * Cycles through hugepage directories and looks for hugepage
95 * files associated with a given prefix. Depending on value of
96 * action, the hugepages are checked if they exist, checked if
97 * they can be locked, or are simply deleted.
99 * Returns 1 if it finds at least one hugepage matching the action
100 * Returns 0 if no matching hugepages were found
101 * Returns -1 if it encounters an error
104 process_hugefiles(const char * prefix, enum hugepage_action action)
106 FILE * hugedir_handle = NULL;
107 DIR * hugepage_dir = NULL;
108 struct dirent *dirent = NULL;
110 char hugefile_prefix[PATH_MAX] = {0};
111 char hugedir[PATH_MAX] = {0};
112 char line[PATH_MAX] = {0};
114 int fd, lck_result, result = 0;
116 const int prefix_len = rte_snprintf(hugefile_prefix,
117 sizeof(hugefile_prefix), "%smap_", prefix);
118 if (prefix_len <= 0 || prefix_len >= (int)sizeof(hugefile_prefix)
119 || prefix_len >= (int)sizeof(dirent->d_name)) {
120 printf("Error creating hugefile filename prefix\n");
124 /* get hugetlbfs mountpoints from /proc/mounts */
125 hugedir_handle = fopen("/proc/mounts", "r");
127 if (hugedir_handle == NULL) {
128 printf("Error parsing /proc/mounts!\n");
132 /* read and parse script output */
133 while (fgets(line, sizeof(line), hugedir_handle) != NULL) {
135 /* check if we have a hugepage filesystem path */
136 if (!get_hugepage_path(line, sizeof(line), hugedir, sizeof(hugedir)))
139 /* check if directory exists */
140 if ((hugepage_dir = opendir(hugedir)) == NULL) {
141 fclose(hugedir_handle);
142 printf("Error reading %s: %s\n", hugedir, strerror(errno));
146 while ((dirent = readdir(hugepage_dir)) != NULL) {
147 if (memcmp(dirent->d_name, hugefile_prefix, prefix_len) != 0)
151 case HUGEPAGE_CHECK_EXISTS:
153 /* file exists, return */
158 case HUGEPAGE_DELETE:
160 char file_path[PATH_MAX] = {0};
162 rte_snprintf(file_path, sizeof(file_path),
163 "%s/%s", hugedir, dirent->d_name);
166 if (remove(file_path) < 0) {
167 printf("Error deleting %s - %s!\n",
168 dirent->d_name, strerror(errno));
169 closedir(hugepage_dir);
176 case HUGEPAGE_CHECK_LOCKED:
178 /* try and lock the file */
179 fd = openat(dirfd(hugepage_dir), dirent->d_name, O_RDONLY);
181 /* this shouldn't happen */
183 printf("Error opening %s - %s!\n",
184 dirent->d_name, strerror(errno));
185 closedir(hugepage_dir);
190 /* non-blocking lock */
191 lck_result = flock(fd, LOCK_EX | LOCK_NB);
193 /* if lock succeeds, there's something wrong */
194 if (lck_result != -1) {
197 /* unlock the resulting lock */
200 closedir(hugepage_dir);
207 /* shouldn't happen */
212 } /* read hugepage directory */
213 closedir(hugepage_dir);
214 } /* read /proc/mounts */
216 fclose(hugedir_handle);
221 * count the number of "node*" files in /sys/devices/system/node/
224 get_number_of_sockets(void)
226 struct dirent *dirent = NULL;
227 const char * nodedir = "/sys/devices/system/node/";
231 /* check if directory exists */
232 if ((dir = opendir(nodedir)) == NULL) {
233 /* if errno==ENOENT this means we don't have NUMA support */
234 if (errno == ENOENT) {
235 printf("No NUMA nodes detected: assuming 1 available socket\n");
238 printf("Error opening %s: %s\n", nodedir, strerror(errno));
242 while ((dirent = readdir(dir)) != NULL)
243 if (strncmp(dirent->d_name, "node", sizeof("node") - 1) == 0)
251 get_current_prefix(char * prefix, int size)
253 char path[PATH_MAX] = {0};
254 char buf[PATH_MAX] = {0};
256 /* get file for config (fd is always 3) */
257 rte_snprintf(path, sizeof(path), "/proc/self/fd/%d", 3);
259 /* return NULL on error */
260 if (readlink(path, buf, sizeof(buf)) == -1)
263 /* get the basename */
264 rte_snprintf(buf, sizeof(buf), "%s", basename(buf));
266 /* copy string all the way from second char up to start of _config */
267 rte_snprintf(prefix, size, "%.*s",
268 strnlen(buf, sizeof(buf)) - sizeof("_config"), &buf[1]);
274 * Test that the app doesn't run without invalid blacklist option.
275 * Final test ensures it does run with valid options as sanity check
278 test_invalid_b_flag(void)
280 char prefix[PATH_MAX], tmp[PATH_MAX];
281 if (get_current_prefix(tmp, sizeof(tmp)) == NULL) {
282 printf("Error - unable to get current prefix!\n");
285 rte_snprintf(prefix, sizeof(prefix), "--file-prefix=%s", tmp);
287 const char *blinval[][9] = {
288 {prgname, prefix, mp_flag, "-n", "1", "-c", "1", "-b", "error"},
289 {prgname, prefix, mp_flag, "-n", "1", "-c", "1", "-b", "0:0:0"},
290 {prgname, prefix, mp_flag, "-n", "1", "-c", "1", "-b", "0:error:0.1"},
291 {prgname, prefix, mp_flag, "-n", "1", "-c", "1", "-b", "0:0:0.1error"},
292 {prgname, prefix, mp_flag, "-n", "1", "-c", "1", "-b", "error0:0:0.1"},
293 {prgname, prefix, mp_flag, "-n", "1", "-c", "1", "-b", "0:0:0.1.2"},
295 /* Test with valid blacklist option */
296 const char *blval[] = {prgname, prefix, mp_flag, "-n", "1", "-c", "1", "-b", "FF:09:0B.3"};
300 for (i = 0; i != sizeof (blinval) / sizeof (blinval[0]); i++) {
301 if (launch_proc(blinval[i]) == 0) {
302 printf("Error - process did run ok with invalid "
303 "blacklist parameter\n");
307 if (launch_proc(blval) != 0) {
308 printf("Error - process did not run ok with valid blacklist value\n");
316 * Test that the app doesn't run with invalid -r option.
319 test_invalid_r_flag(void)
321 char prefix[PATH_MAX], tmp[PATH_MAX];
322 if (get_current_prefix(tmp, sizeof(tmp)) == NULL) {
323 printf("Error - unable to get current prefix!\n");
326 rte_snprintf(prefix, sizeof(prefix), "--file-prefix=%s", tmp);
328 const char *rinval[][9] = {
329 {prgname, prefix, mp_flag, "-n", "1", "-c", "1", "-r", "error"},
330 {prgname, prefix, mp_flag, "-n", "1", "-c", "1", "-r", "0"},
331 {prgname, prefix, mp_flag, "-n", "1", "-c", "1", "-r", "-1"},
332 {prgname, prefix, mp_flag, "-n", "1", "-c", "1", "-r", "17"},
334 /* Test with valid blacklist option */
335 const char *rval[] = {prgname, prefix, mp_flag, "-n", "1", "-c", "1", "-r", "16"};
339 for (i = 0; i != sizeof (rinval) / sizeof (rinval[0]); i++) {
340 if (launch_proc(rinval[i]) == 0) {
341 printf("Error - process did run ok with invalid "
342 "-r (rank) parameter\n");
346 if (launch_proc(rval) != 0) {
347 printf("Error - process did not run ok with valid -r (rank) value\n");
354 * Test that the app doesn't run without the coremask flag. In all cases
355 * should give an error and fail to run
358 test_missing_c_flag(void)
360 char prefix[PATH_MAX], tmp[PATH_MAX];
361 if (get_current_prefix(tmp, sizeof(tmp)) == NULL) {
362 printf("Error - unable to get current prefix!\n");
365 rte_snprintf(prefix, sizeof(prefix), "--file-prefix=%s", tmp);
367 /* -c flag but no coremask value */
368 const char *argv1[] = { prgname, prefix, mp_flag, "-n", "3", "-c"};
369 /* No -c flag at all */
370 const char *argv2[] = { prgname, prefix, mp_flag, "-n", "3"};
371 /* bad coremask value */
372 const char *argv3[] = { prgname, prefix, mp_flag, "-n", "3", "-c", "error" };
373 /* sanity check of tests - valid coremask value */
374 const char *argv4[] = { prgname, prefix, mp_flag, "-n", "3", "-c", "1" };
376 if (launch_proc(argv1) == 0
377 || launch_proc(argv2) == 0
378 || launch_proc(argv3) == 0) {
379 printf("Error - process ran without error when missing -c flag\n");
382 if (launch_proc(argv4) != 0) {
383 printf("Error - process did not run ok with valid coremask value\n");
390 * Test that the app doesn't run without the -n flag. In all cases
391 * should give an error and fail to run.
392 * Since -n is not compulsory for MP, we instead use --no-huge and --no-shconf
396 test_missing_n_flag(void)
398 char prefix[PATH_MAX], tmp[PATH_MAX];
399 if (get_current_prefix(tmp, sizeof(tmp)) == NULL) {
400 printf("Error - unable to get current prefix!\n");
403 rte_snprintf(prefix, sizeof(prefix), "--file-prefix=%s", tmp);
405 /* -n flag but no value */
406 const char *argv1[] = { prgname, prefix, no_huge, no_shconf, "-c", "1", "-n"};
407 /* No -n flag at all */
408 const char *argv2[] = { prgname, prefix, no_huge, no_shconf, "-c", "1"};
409 /* bad numeric value */
410 const char *argv3[] = { prgname, prefix, no_huge, no_shconf, "-c", "1", "-n", "e" };
411 /* out-of-range value */
412 const char *argv4[] = { prgname, prefix, no_huge, no_shconf, "-c", "1", "-n", "9" };
413 /* sanity test - check with good value */
414 const char *argv5[] = { prgname, prefix, no_huge, no_shconf, "-c", "1", "-n", "2" };
416 if (launch_proc(argv1) == 0
417 || launch_proc(argv2) == 0
418 || launch_proc(argv3) == 0
419 || launch_proc(argv4) == 0) {
420 printf("Error - process ran without error when missing -n flag\n");
423 if (launch_proc(argv5) != 0) {
424 printf("Error - process did not run ok with valid num-channel value\n");
431 * Test that the app runs with HPET, and without HPET
434 test_no_hpet_flag(void)
436 char prefix[PATH_MAX], tmp[PATH_MAX];
437 if (get_current_prefix(tmp, sizeof(tmp)) == NULL) {
438 printf("Error - unable to get current prefix!\n");
441 rte_snprintf(prefix, sizeof(prefix), "--file-prefix=%s", tmp);
444 const char *argv1[] = {prgname, prefix, mp_flag, no_hpet, "-c", "1", "-n", "2"};
445 /* Without --no-hpet */
446 const char *argv2[] = {prgname, prefix, mp_flag, "-c", "1", "-n", "2"};
448 if (launch_proc(argv1) != 0) {
449 printf("Error - process did not run ok with --no-hpet flag\n");
452 if (launch_proc(argv2) != 0) {
453 printf("Error - process did not run ok without --no-hpet flag\n");
460 * Test that the app runs with --no-huge and doesn't run when either
461 * -m or --socket-mem are specified with --no-huge.
464 test_no_huge_flag(void)
466 char prefix[PATH_MAX], tmp[PATH_MAX];
467 if (get_current_prefix(tmp, sizeof(tmp)) == NULL) {
468 printf("Error - unable to get current prefix!\n");
471 rte_snprintf(prefix, sizeof(prefix), "--file-prefix=%s", tmp);
474 const char *argv1[] = {prgname, prefix, no_huge, "-c", "1", "-n", "2",
475 "--file-prefix=nohuge"};
476 /* With --no-huge and -m */
477 const char *argv2[] = {prgname, prefix, no_huge, "-c", "1", "-n", "2", "-m", "2",
478 "--file-prefix=nohuge"};
479 /* With --no-huge and --socket-mem */
480 const char *argv3[] = {prgname, prefix, no_huge, "-c", "1", "-n", "2",
481 "--socket-mem=2", "--file-prefix=nohuge"};
482 /* With --no-huge, -m and --socket-mem */
483 const char *argv4[] = {prgname, prefix, no_huge, "-c", "1", "-n", "2",
484 "-m", "2", "--socket-mem=2", "--file-prefix=nohuge"};
486 if (launch_proc(argv1) != 0) {
487 printf("Error - process did not run ok with --no-huge flag\n");
490 if (launch_proc(argv2) == 0) {
491 printf("Error - process run ok with --no-huge and -m flags\n");
494 if (launch_proc(argv3) == 0) {
495 printf("Error - process run ok with --no-huge and --socket-mem "
499 if (launch_proc(argv4) == 0) {
500 printf("Error - process run ok with --no-huge, -m and "
501 "--socket-mem flags\n");
508 test_misc_flags(void)
510 char prefix[PATH_MAX], tmp[PATH_MAX];
511 if (get_current_prefix(tmp, sizeof(tmp)) == NULL) {
512 printf("Error - unable to get current prefix!\n");
515 rte_snprintf(prefix, sizeof(prefix), "--file-prefix=%s", tmp);
517 /* check that some general flags don't prevent things from working.
518 * All cases, apart from the first, app should run.
519 * No futher testing of output done.
521 /* sanity check - failure with invalid option */
522 const char *argv0[] = {prgname, prefix, mp_flag, "-c", "1", "--invalid-opt"};
525 const char *argv1[] = {prgname, prefix, mp_flag, "-c", "1", "--no-pci"};
527 const char *argv2[] = {prgname, prefix, mp_flag, "-c", "1", "-v"};
529 if (launch_proc(argv0) == 0) {
530 printf("Error - process ran ok with invalid flag\n");
533 if (launch_proc(argv1) != 0) {
534 printf("Error - process did not run ok with --no-pci flag\n");
537 if (launch_proc(argv2) != 0) {
538 printf("Error - process did not run ok with -v flag\n");
545 test_file_prefix(void)
548 * 1. check if current process hugefiles are locked
549 * 2. try to run secondary process without a corresponding primary process
550 * (while failing to run, it will also remove any unused hugepage files)
551 * 3. check if current process hugefiles are still in place and are locked
552 * 4. run a primary process with memtest1 prefix
553 * 5. check if memtest1 hugefiles are created
554 * 6. run a primary process with memtest2 prefix
555 * 7. check that only memtest2 hugefiles are present in the hugedir
558 /* this should fail unless the test itself is run with "memtest" prefix */
559 const char *argv0[] = {prgname, mp_flag, "-c", "1", "-n", "2", "-m", "2",
560 "--file-prefix=" memtest };
562 /* primary process with memtest1 */
563 const char *argv1[] = {prgname, "-c", "1", "-n", "2", "-m", "2",
564 "--file-prefix=" memtest1 };
566 /* primary process with memtest2 */
567 const char *argv2[] = {prgname, "-c", "1", "-n", "2", "-m", "2",
568 "--file-prefix=" memtest2 };
571 if (get_current_prefix(prefix, sizeof(prefix)) == NULL) {
572 printf("Error - unable to get current prefix!\n");
576 /* check if files for current prefix are present */
577 if (process_hugefiles(prefix, HUGEPAGE_CHECK_EXISTS) != 1) {
578 printf("Error - hugepage files for %s were not created!\n", prefix);
582 /* checks if files for current prefix are locked */
583 if (process_hugefiles(prefix, HUGEPAGE_CHECK_LOCKED) != 1) {
584 printf("Error - hugepages for current process aren't locked!\n");
588 /* check if files for secondary process are present */
589 if (process_hugefiles(memtest, HUGEPAGE_CHECK_EXISTS) == 1) {
590 /* check if they are not locked */
591 if (process_hugefiles(memtest, HUGEPAGE_CHECK_LOCKED) == 1) {
592 printf("Error - hugepages for current process are locked!\n");
595 /* they aren't locked, delete them */
597 if (process_hugefiles(memtest, HUGEPAGE_DELETE) != 1) {
598 printf("Error - deleting hugepages failed!\n");
604 if (launch_proc(argv0) == 0) {
605 printf("Error - secondary process ran ok without primary process\n");
609 /* check if files for current prefix are present */
610 if (process_hugefiles(prefix, HUGEPAGE_CHECK_EXISTS) != 1) {
611 printf("Error - hugepage files for %s were not created!\n", prefix);
615 /* checks if files for current prefix are locked */
616 if (process_hugefiles(prefix, HUGEPAGE_CHECK_LOCKED) != 1) {
617 printf("Error - hugepages for current process aren't locked!\n");
621 if (launch_proc(argv1) != 0) {
622 printf("Error - failed to run with --file-prefix=%s\n", memtest);
626 /* check if memtest1_map0 is present */
627 if (process_hugefiles(memtest1, HUGEPAGE_CHECK_EXISTS) != 1) {
628 printf("Error - hugepage files for %s were not created!\n", memtest1);
632 if (launch_proc(argv2) != 0) {
633 printf("Error - failed to run with --file-prefix=%s\n", memtest2);
637 /* check if hugefiles for memtest2 are present */
638 if (process_hugefiles(memtest2, HUGEPAGE_CHECK_EXISTS) != 1) {
639 printf("Error - hugepage files for %s were not created!\n", memtest2);
643 /* check if hugefiles for memtest1 are present */
644 if (process_hugefiles(memtest1, HUGEPAGE_CHECK_EXISTS) != 0) {
645 printf("Error - hugepage files for %s were not deleted!\n", memtest1);
653 * Tests for correct handling of -m and --socket-mem flags
656 test_memory_flags(void)
658 char prefix[PATH_MAX], tmp[PATH_MAX];
659 if (get_current_prefix(tmp, sizeof(tmp)) == NULL) {
660 printf("Error - unable to get current prefix!\n");
663 rte_snprintf(prefix, sizeof(prefix), "--file-prefix=%s", tmp);
666 const char *argv0[] = {prgname, "-c", "10", "-n", "2",
667 "--file-prefix=" memtest, "-m", "2"};
669 /* valid -m flag and mp flag */
670 const char *argv1[] = {prgname, prefix, mp_flag, "-c", "10",
671 "-n", "2", "-m", "2"};
673 /* invalid (zero) --socket-mem flag */
674 const char *argv2[] = {prgname, "-c", "10", "-n", "2",
675 "--file-prefix=" memtest, "--socket-mem=0,0,0,0"};
677 /* invalid (incomplete) --socket-mem flag */
678 const char *argv3[] = {prgname, "-c", "10", "-n", "2",
679 "--file-prefix=" memtest, "--socket-mem=2,2,"};
681 /* invalid (mixed with invalid data) --socket-mem flag */
682 const char *argv4[] = {prgname, "-c", "10", "-n", "2",
683 "--file-prefix=" memtest, "--socket-mem=2,2,Fred"};
685 /* invalid (with numeric value as last character) --socket-mem flag */
686 const char *argv5[] = {prgname, "-c", "10", "-n", "2",
687 "--file-prefix=" memtest, "--socket-mem=2,2,Fred0"};
689 /* invalid (with empty socket) --socket-mem flag */
690 const char *argv6[] = {prgname, "-c", "10", "-n", "2",
691 "--file-prefix=" memtest, "--socket-mem=2,,2"};
693 /* invalid (null) --socket-mem flag */
694 const char *argv7[] = {prgname, "-c", "10", "-n", "2",
695 "--file-prefix=" memtest, "--socket-mem="};
697 /* valid --socket-mem specified together with -m flag */
698 const char *argv8[] = {prgname, "-c", "10", "-n", "2",
699 "--file-prefix=" memtest, "-m", "2", "--socket-mem=2,2"};
701 /* construct an invalid socket mask with 2 megs on each socket plus
702 * extra 2 megs on socket that doesn't exist on current system */
703 char invalid_socket_mem[SOCKET_MEM_STRLEN];
704 char buf[SOCKET_MEM_STRLEN]; /* to avoid copying string onto itself */
705 int i, num_sockets = get_number_of_sockets();
707 if (num_sockets <= 0 || num_sockets > RTE_MAX_NUMA_NODES) {
708 printf("Error - cannot get number of sockets!\n");
712 rte_snprintf(invalid_socket_mem, sizeof(invalid_socket_mem), "--socket-mem=");
714 /* add one extra socket */
715 for (i = 0; i < num_sockets + 1; i++) {
716 rte_snprintf(buf, sizeof(buf), "%s2", invalid_socket_mem);
717 rte_snprintf(invalid_socket_mem, sizeof(invalid_socket_mem), "%s", buf);
719 if (num_sockets + 1 - i > 1) {
720 rte_snprintf(buf, sizeof(buf), "%s,", invalid_socket_mem);
721 rte_snprintf(invalid_socket_mem, sizeof(invalid_socket_mem), "%s", buf);
725 /* construct a valid socket mask with 2 megs on each existing socket */
726 char valid_socket_mem[SOCKET_MEM_STRLEN];
728 rte_snprintf(valid_socket_mem, sizeof(valid_socket_mem), "--socket-mem=");
730 /* add one extra socket */
731 for (i = 0; i < num_sockets; i++) {
732 rte_snprintf(buf, sizeof(buf), "%s2", valid_socket_mem);
733 rte_snprintf(valid_socket_mem, sizeof(valid_socket_mem), "%s", buf);
735 if (num_sockets - i > 1) {
736 rte_snprintf(buf, sizeof(buf), "%s,", valid_socket_mem);
737 rte_snprintf(valid_socket_mem, sizeof(valid_socket_mem), "%s", buf);
741 /* invalid --socket-mem flag (with extra socket) */
742 const char *argv9[] = {prgname, "-c", "10", "-n", "2",
743 "--file-prefix=" memtest, invalid_socket_mem};
745 /* valid --socket-mem flag */
746 const char *argv10[] = {prgname, "-c", "10", "-n", "2",
747 "--file-prefix=" memtest, valid_socket_mem};
749 if (launch_proc(argv0) != 0) {
750 printf("Error - process failed with valid -m flag!\n");
754 if (launch_proc(argv1) != 0) {
755 printf("Error - secondary process failed with valid -m flag !\n");
759 if (launch_proc(argv2) == 0) {
760 printf("Error - process run ok with invalid (zero) --socket-mem!\n");
764 if (launch_proc(argv3) == 0) {
765 printf("Error - process run ok with invalid "
766 "(incomplete) --socket-mem!\n");
770 if (launch_proc(argv4) == 0) {
771 printf("Error - process run ok with invalid "
772 "(mixed with invalid input) --socket-mem!\n");
776 if (launch_proc(argv5) == 0) {
777 printf("Error - process run ok with invalid "
778 "(mixed with invalid input with a numeric value as "
779 "last character) --socket-mem!\n");
783 if (launch_proc(argv6) == 0) {
784 printf("Error - process run ok with invalid "
785 "(with empty socket) --socket-mem!\n");
789 if (launch_proc(argv7) == 0) {
790 printf("Error - process run ok with invalid (null) --socket-mem!\n");
794 if (launch_proc(argv8) == 0) {
795 printf("Error - process run ok with --socket-mem and -m specified!\n");
799 if (launch_proc(argv9) == 0) {
800 printf("Error - process run ok with extra socket in --socket-mem!\n");
804 if (launch_proc(argv10) != 0) {
805 printf("Error - process failed with valid --socket-mem!\n");
817 ret = test_missing_c_flag();
819 printf("Error in test_missing_c_flag()\n");
823 ret = test_missing_n_flag();
825 printf("Error in test_missing_n_flag()\n");
829 ret = test_no_hpet_flag();
831 printf("Error in test_no_hpet_flag()\n");
835 ret = test_no_huge_flag();
837 printf("Error in test_no_huge_flag()\n");
841 ret = test_invalid_b_flag();
843 printf("Error in test_invalid_b_flag()\n");
847 ret = test_invalid_r_flag();
849 printf("Error in test_invalid_r_flag()\n");
853 ret = test_memory_flags();
855 printf("Error in test_memory_flags()\n");
859 ret = test_file_prefix();
861 printf("Error in test_file_prefix()\n");
865 ret = test_misc_flags();
867 printf("Error in test_misc_flags()");
876 * Multiprocess not applicable, so just return 0 always
881 printf("Multi-process not possible for baremetal, cannot test EAL flags\n");