app/test: remove file prefix option for bsd

eal_flags and multiprocess unit tests use --file-prefix option
which is not supported in FreeBSD, so it has been removed
if compiled for this OS.

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
This commit is contained in:
Pablo de Lara 2014-11-15 20:34:09 +00:00 committed by Thomas Monjalon
parent 9c2c27f8c4
commit 21cdbc4254
2 changed files with 22 additions and 4 deletions

View File

@ -400,18 +400,26 @@ test_invalid_b_flag(void)
static int static int
test_invalid_vdev_flag(void) test_invalid_vdev_flag(void)
{ {
#ifdef RTE_EXEC_ENV_BSDAPP
/* BSD target doesn't support prefixes at this point, and we also need to
* run another primary process here */
const char * prefix = no_shconf;
#else
const char * prefix = "--file-prefix=vdev";
#endif
/* Test with invalid vdev option */ /* Test with invalid vdev option */
const char *vdevinval[] = {prgname, "--file-prefix=vdev","-n", "1", const char *vdevinval[] = {prgname, prefix, "-n", "1",
"-c", "1", vdev, "eth_dummy"}; "-c", "1", vdev, "eth_dummy"};
/* Test with valid vdev option */ /* Test with valid vdev option */
const char *vdevval1[] = {prgname, "--file-prefix=vdev", "-n", "1", const char *vdevval1[] = {prgname, prefix, "-n", "1",
"-c", "1", vdev, "eth_ring0"}; "-c", "1", vdev, "eth_ring0"};
const char *vdevval2[] = {prgname, "--file-prefix=vdev", "-n", "1", const char *vdevval2[] = {prgname, prefix, "-n", "1",
"-c", "1", vdev, "eth_ring0,args=test"}; "-c", "1", vdev, "eth_ring0,args=test"};
const char *vdevval3[] = {prgname, "--file-prefix=vdev", "-n", "1", const char *vdevval3[] = {prgname, prefix, "-n", "1",
"-c", "1", vdev, "eth_ring0,nodeaction=r1:0:CREATE"}; "-c", "1", vdev, "eth_ring0,nodeaction=r1:0:CREATE"};
if (launch_proc(vdevinval) == 0) { if (launch_proc(vdevinval) == 0) {

View File

@ -84,6 +84,7 @@
#define launch_proc(ARGV) process_dup(ARGV, \ #define launch_proc(ARGV) process_dup(ARGV, \
sizeof(ARGV)/(sizeof(ARGV[0])), __func__) sizeof(ARGV)/(sizeof(ARGV[0])), __func__)
#ifdef RTE_EXEC_ENV_LINUXAPP
static char* static char*
get_current_prefix(char * prefix, int size) get_current_prefix(char * prefix, int size)
{ {
@ -107,6 +108,7 @@ get_current_prefix(char * prefix, int size)
return prefix; return prefix;
} }
#endif
/* /*
* This function is called in the primary i.e. main test, to spawn off secondary * This function is called in the primary i.e. main test, to spawn off secondary
@ -118,12 +120,16 @@ run_secondary_instances(void)
int ret = 0; int ret = 0;
char coremask[10]; char coremask[10];
#ifdef RTE_EXEC_ENV_LINUXAPP
char tmp[PATH_MAX] = {0}; char tmp[PATH_MAX] = {0};
char prefix[PATH_MAX] = {0}; char prefix[PATH_MAX] = {0};
get_current_prefix(tmp, sizeof(tmp)); get_current_prefix(tmp, sizeof(tmp));
snprintf(prefix, sizeof(prefix), "--file-prefix=%s", tmp); snprintf(prefix, sizeof(prefix), "--file-prefix=%s", tmp);
#else
const char *prefix = "";
#endif
/* good case, using secondary */ /* good case, using secondary */
const char *argv1[] = { const char *argv1[] = {
@ -140,11 +146,13 @@ run_secondary_instances(void)
prgname, "-c", coremask, "--proc-type=ERROR", prgname, "-c", coremask, "--proc-type=ERROR",
prefix prefix
}; };
#ifdef RTE_EXEC_ENV_LINUXAPP
/* bad case, using invalid file prefix */ /* bad case, using invalid file prefix */
const char *argv4[] = { const char *argv4[] = {
prgname, "-c", coremask, "--proc-type=secondary", prgname, "-c", coremask, "--proc-type=secondary",
"--file-prefix=ERROR" "--file-prefix=ERROR"
}; };
#endif
snprintf(coremask, sizeof(coremask), "%x", \ snprintf(coremask, sizeof(coremask), "%x", \
(1 << rte_get_master_lcore())); (1 << rte_get_master_lcore()));
@ -153,7 +161,9 @@ run_secondary_instances(void)
ret |= launch_proc(argv2); ret |= launch_proc(argv2);
ret |= !(launch_proc(argv3)); ret |= !(launch_proc(argv3));
#ifdef RTE_EXEC_ENV_LINUXAPP
ret |= !(launch_proc(argv4)); ret |= !(launch_proc(argv4));
#endif
return ret; return ret;
} }