X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=app%2Ftest%2Ftest_mp_secondary.c;h=95a12e2a4b056d5f0fbf25ed9a4b1a3e2ad308af;hb=9aaccf1abdb2894ec23870e1d2199a657f85850e;hp=19af32c1ef80069574ffde23f49f5135032a22c8;hpb=1c1d4d7a923d4804f1926fc5264f9ecdd8977b04;p=dpdk.git diff --git a/app/test/test_mp_secondary.c b/app/test/test_mp_secondary.c index 19af32c1ef..95a12e2a4b 100644 --- a/app/test/test_mp_secondary.c +++ b/app/test/test_mp_secondary.c @@ -1,13 +1,13 @@ /*- * BSD LICENSE - * - * Copyright(c) 2010-2013 Intel Corporation. All rights reserved. + * + * Copyright(c) 2010-2014 Intel Corporation. All rights reserved. * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: - * + * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright @@ -17,7 +17,7 @@ * * Neither the name of Intel Corporation nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR @@ -33,11 +33,8 @@ #include -#include - #include "test.h" -#ifndef RTE_EXEC_ENV_BAREMETAL #include #include #include @@ -53,6 +50,7 @@ #include #include #include +#include #include #include @@ -93,18 +91,19 @@ get_current_prefix(char * prefix, int size) char buf[PATH_MAX] = {0}; /* get file for config (fd is always 3) */ - rte_snprintf(path, sizeof(path), "/proc/self/fd/%d", 3); + snprintf(path, sizeof(path), "/proc/self/fd/%d", 3); /* return NULL on error */ if (readlink(path, buf, sizeof(buf)) == -1) return NULL; /* get the basename */ - rte_snprintf(buf, sizeof(buf), "%s", basename(buf)); + snprintf(buf, sizeof(buf), "%s", basename(buf)); /* copy string all the way from second char up to start of _config */ - rte_snprintf(prefix, size, "%.*s", - strnlen(buf, sizeof(buf)) - sizeof("_config"), &buf[1]); + snprintf(prefix, size, "%.*s", + (int)(strnlen(buf, sizeof(buf)) - sizeof("_config")), + &buf[1]); return prefix; } @@ -124,7 +123,7 @@ run_secondary_instances(void) get_current_prefix(tmp, sizeof(tmp)); - rte_snprintf(prefix, sizeof(prefix), "--file-prefix=%s", tmp); + snprintf(prefix, sizeof(prefix), "--file-prefix=%s", tmp); /* good case, using secondary */ const char *argv1[] = { @@ -147,7 +146,7 @@ run_secondary_instances(void) "--file-prefix=ERROR" }; - rte_snprintf(coremask, sizeof(coremask), "%x", \ + snprintf(coremask, sizeof(coremask), "%x", \ (1 << rte_get_master_lcore())); ret |= launch_proc(argv1); @@ -175,7 +174,7 @@ run_object_creation_tests(void) printf("### Testing object creation - expect lots of mz reserve errors!\n"); rte_errno = 0; - if ((rte_memzone_reserve("test_mz", size, rte_socket_id(), + if ((rte_memzone_reserve("test_mz", size, rte_socket_id(), flags) == NULL) && (rte_memzone_lookup("test_mz") == NULL)) { printf("Error: unexpected return value from rte_memzone_reserve\n"); @@ -214,7 +213,7 @@ run_object_creation_tests(void) const struct rte_fbk_hash_params fbk_params = { .name = "test_fbk_mp_hash" }; rte_errno=0; - if ((rte_fbk_hash_create(&fbk_params) != NULL) && + if ((rte_fbk_hash_create(&fbk_params) != NULL) && (rte_fbk_hash_find_existing(fbk_params.name) == NULL)){ printf("Error: unexpected return value from rte_fbk_hash_create()\n"); return -1; @@ -265,16 +264,8 @@ test_mp_secondary(void) return run_object_creation_tests(); } -#else - -/* Baremetal version - * Multiprocess not applicable, so just return 0 always - */ -int -test_mp_secondary(void) -{ - printf("Multi-process not applicable for baremetal\n"); - return 0; -} - -#endif +static struct test_command multiprocess_cmd = { + .command = "multiprocess_autotest", + .callback = test_mp_secondary, +}; +REGISTER_TEST_COMMAND(multiprocess_cmd);