Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/53768/?format=api
http://patches.dpdk.org/api/patches/53768/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/patch/20190528115158.73245-2-ray.kinsella@intel.com/", "project": { "id": 1, "url": "http://patches.dpdk.org/api/projects/1/?format=api", "name": "DPDK", "link_name": "dpdk", "list_id": "dev.dpdk.org", "list_email": "dev@dpdk.org", "web_url": "http://core.dpdk.org", "scm_url": "git://dpdk.org/dpdk", "webscm_url": "http://git.dpdk.org/dpdk", "list_archive_url": "https://inbox.dpdk.org/dev", "list_archive_url_format": "https://inbox.dpdk.org/dev/{}", "commit_url_format": "" }, "msgid": "<20190528115158.73245-2-ray.kinsella@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20190528115158.73245-2-ray.kinsella@intel.com", "date": "2019-05-28T11:51:57", "name": "[1/2] app/test: Add ABI Version Testing functionality", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "8f78c3679faa8e09e6de1e7b7a6be193b57d36e5", "submitter": { "id": 956, "url": "http://patches.dpdk.org/api/people/956/?format=api", "name": "Kinsella, Ray", "email": "ray.kinsella@intel.com" }, "delegate": { "id": 1, "url": "http://patches.dpdk.org/api/users/1/?format=api", "username": "tmonjalo", "first_name": "Thomas", "last_name": "Monjalon", "email": "thomas@monjalon.net" }, "mbox": "http://patches.dpdk.org/project/dpdk/patch/20190528115158.73245-2-ray.kinsella@intel.com/mbox/", "series": [ { "id": 4797, "url": "http://patches.dpdk.org/api/series/4797/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=4797", "date": "2019-05-28T11:51:56", "name": "Add ABI Version Testing to app/test", "version": 1, "mbox": "http://patches.dpdk.org/series/4797/mbox/" } ], "comments": "http://patches.dpdk.org/api/patches/53768/comments/", "check": "fail", "checks": "http://patches.dpdk.org/api/patches/53768/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<dev-bounces@dpdk.org>", "X-Original-To": "patchwork@dpdk.org", "Delivered-To": "patchwork@dpdk.org", "Received": [ "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 9CBE41B95B;\n\tTue, 28 May 2019 15:13:03 +0200 (CEST)", "from mga14.intel.com (mga14.intel.com [192.55.52.115])\n\tby dpdk.org (Postfix) with ESMTP id D32AD2C55\n\tfor <dev@dpdk.org>; Tue, 28 May 2019 13:53:01 +0200 (CEST)", "from fmsmga001.fm.intel.com ([10.253.24.23])\n\tby fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t28 May 2019 04:53:01 -0700", "from silpixa00395806.ir.intel.com (HELO\n\tsilpixa00395806.ger.corp.intel.com) ([10.237.222.41])\n\tby fmsmga001.fm.intel.com with ESMTP; 28 May 2019 04:53:00 -0700" ], "X-Amp-Result": "SKIPPED(no attachment in message)", "X-Amp-File-Uploaded": "False", "X-ExtLoop1": "1", "From": "Ray Kinsella <ray.kinsella@intel.com>", "To": "bruce.richardson@intel.com,\n\tvladimir.medvedkin@intel.com", "Cc": "dev@dpdk.org,\n\tRay Kinsella <ray.kinsella@intel.com>", "Date": "Tue, 28 May 2019 12:51:57 +0100", "Message-Id": "<20190528115158.73245-2-ray.kinsella@intel.com>", "X-Mailer": "git-send-email 2.17.1", "In-Reply-To": "<20190528115158.73245-1-ray.kinsella@intel.com>", "References": "<20190528115158.73245-1-ray.kinsella@intel.com>", "X-Mailman-Approved-At": "Tue, 28 May 2019 15:12:47 +0200", "Subject": "[dpdk-dev] [PATCH 1/2] app/test: Add ABI Version Testing\n\tfunctionality", "X-BeenThere": "dev@dpdk.org", "X-Mailman-Version": "2.1.15", "Precedence": "list", "List-Id": "DPDK patches and discussions <dev.dpdk.org>", "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>", "List-Archive": "<http://mails.dpdk.org/archives/dev/>", "List-Post": "<mailto:dev@dpdk.org>", "List-Help": "<mailto:dev-request@dpdk.org?subject=help>", "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>", "Errors-To": "dev-bounces@dpdk.org", "Sender": "\"dev\" <dev-bounces@dpdk.org>" }, "content": "This patchset adds ABI Version Testing functionality to the app/test\nunit test framework, comprised of\n\n1. The TEST_DPDK_ABI_VERSION_* and REISTER_TEST_ABI_VERSION macros to\n register abi versions with infrastructure.\n2. The MAP_ABI_SYMBOL_VERSION macro to remap symbols based on their ABI\n Version.\n3. The set_abi_version command, to switch between ABI Versions.\n\nSigned-off-by: Ray Kinsella <ray.kinsella@intel.com>\n---\n app/test/commands.c | 131 ++++++++++++++++++++++++++++++++++++++------\n app/test/test.c | 2 +\n app/test/test.h | 52 +++++++++++++++---\n 3 files changed, 159 insertions(+), 26 deletions(-)", "diff": "diff --git a/app/test/commands.c b/app/test/commands.c\nindex 8d5a03a95..06fc33ee5 100644\n--- a/app/test/commands.c\n+++ b/app/test/commands.c\n@@ -50,12 +50,22 @@\n \n /****************/\n \n+static uint8_t test_abi_version = TEST_DPDK_ABI_VERSION_DEFAULT;\n+\n+static struct test_abi_version_list abi_version_list =\n+\tTAILQ_HEAD_INITIALIZER(abi_version_list);\n+\n static struct test_commands_list commands_list =\n \tTAILQ_HEAD_INITIALIZER(commands_list);\n \n-void\n-add_test_command(struct test_command *t)\n+void add_abi_version(struct test_abi_version *av)\n+{\n+\tTAILQ_INSERT_TAIL(&abi_version_list, av, next);\n+}\n+\n+void add_test_command(struct test_command *t, uint8_t abi_version)\n {\n+\tt->abi_version = abi_version;\n \tTAILQ_INSERT_TAIL(&commands_list, t, next);\n }\n \n@@ -63,6 +73,12 @@ struct cmd_autotest_result {\n \tcmdline_fixed_string_t autotest;\n };\n \n+cmdline_parse_token_string_t\n+cmd_autotest_autotest[TEST_DPDK_ABI_VERSION_MAX] = {\n+\t[0 ... TEST_DPDK_ABI_VERSION_MAX-1] =\n+\tTOKEN_STRING_INITIALIZER(struct cmd_autotest_result, autotest, \"\")\n+};\n+\n static void cmd_autotest_parsed(void *parsed_result,\n \t\t\t\t__attribute__((unused)) struct cmdline *cl,\n \t\t\t\t__attribute__((unused)) void *data)\n@@ -72,7 +88,8 @@ static void cmd_autotest_parsed(void *parsed_result,\n \tint ret = 0;\n \n \tTAILQ_FOREACH(t, &commands_list, next) {\n-\t\tif (!strcmp(res->autotest, t->command))\n+\t\tif (!strcmp(res->autotest, t->command)\n+\t\t\t\t&& t->abi_version == test_abi_version)\n \t\t\tret = t->callback();\n \t}\n \n@@ -86,10 +103,6 @@ static void cmd_autotest_parsed(void *parsed_result,\n \tfflush(stdout);\n }\n \n-cmdline_parse_token_string_t cmd_autotest_autotest =\n-\tTOKEN_STRING_INITIALIZER(struct cmd_autotest_result, autotest,\n-\t\t\t\t \"\");\n-\n cmdline_parse_inst_t cmd_autotest = {\n \t.f = cmd_autotest_parsed, /* function to call */\n \t.data = NULL, /* 2nd arg of func */\n@@ -244,6 +257,53 @@ cmdline_parse_inst_t cmd_quit = {\n \n /****************/\n \n+struct cmd_set_abi_version_result {\n+\tcmdline_fixed_string_t set;\n+\tcmdline_fixed_string_t abi_version_name;\n+};\n+\n+static void cmd_set_abi_version_parsed(\n+\t\t\t\tvoid *parsed_result,\n+\t\t\t\t__attribute__((unused)) struct cmdline *cl,\n+\t\t\t\t__attribute__((unused)) void *data)\n+{\n+\tstruct test_abi_version *av;\n+\tstruct cmd_set_abi_version_result *res = parsed_result;\n+\n+\tTAILQ_FOREACH(av, &abi_version_list, next) {\n+\t\tif (!strcmp(res->abi_version_name, av->version_name)) {\n+\n+\t\t\tprintf(\"abi version set to %s\\n\", av->version_name);\n+\t\t\ttest_abi_version = av->version_id;\n+\t\t\tcmd_autotest.tokens[0] =\n+\t\t\t\t(void *)&cmd_autotest_autotest[av->version_id];\n+\t\t}\n+\t}\n+\n+\tfflush(stdout);\n+}\n+\n+cmdline_parse_token_string_t cmd_set_abi_version_set =\n+\tTOKEN_STRING_INITIALIZER(struct cmd_set_abi_version_result, set,\n+\t\t\t\t\"set_abi_version\");\n+\n+cmdline_parse_token_string_t cmd_set_abi_version_abi_version =\n+\tTOKEN_STRING_INITIALIZER(struct cmd_set_abi_version_result,\n+\t\t\t\tabi_version_name, NULL);\n+\n+cmdline_parse_inst_t cmd_set_abi_version = {\n+\t.f = cmd_set_abi_version_parsed, /* function to call */\n+\t.data = NULL, /* 2nd arg of func */\n+\t.help_str = \"set abi version: \",\n+\t.tokens = { /* token list, NULL terminated */\n+\t\t(void *)&cmd_set_abi_version_set,\n+\t\t(void *)&cmd_set_abi_version_abi_version,\n+\t\tNULL,\n+\t},\n+};\n+\n+/****************/\n+\n struct cmd_set_rxtx_result {\n \tcmdline_fixed_string_t set;\n \tcmdline_fixed_string_t mode;\n@@ -259,7 +319,7 @@ static void cmd_set_rxtx_parsed(void *parsed_result, struct cmdline *cl,\n \n cmdline_parse_token_string_t cmd_set_rxtx_set =\n \tTOKEN_STRING_INITIALIZER(struct cmd_set_rxtx_result, set,\n-\t\t\t\t \"set_rxtx_mode\");\n+\t\t\t\t\"set_rxtx_mode\");\n \n cmdline_parse_token_string_t cmd_set_rxtx_mode =\n \tTOKEN_STRING_INITIALIZER(struct cmd_set_rxtx_result, mode, NULL);\n@@ -360,29 +420,66 @@ cmdline_parse_ctx_t main_ctx[] = {\n \t(cmdline_parse_inst_t *)&cmd_set_rxtx,\n \t(cmdline_parse_inst_t *)&cmd_set_rxtx_anchor,\n \t(cmdline_parse_inst_t *)&cmd_set_rxtx_sc,\n+\t(cmdline_parse_inst_t *)&cmd_set_abi_version,\n \tNULL,\n };\n \n int commands_init(void)\n {\n+\tstruct test_abi_version *av;\n \tstruct test_command *t;\n-\tchar *commands;\n-\tint commands_len = 0;\n+\tchar *commands[TEST_DPDK_ABI_VERSION_MAX];\n+\tchar *help;\n+\n+\tint commands_len[TEST_DPDK_ABI_VERSION_MAX] = {\n+\t\t[0 ... TEST_DPDK_ABI_VERSION_MAX-1] = 0\n+\t};\n+\tint help_len = strlen(cmd_set_abi_version.help_str);\n+\tint abi_version;\n+\n+\t/* set the set_abi_version command help string */\n+\tTAILQ_FOREACH(av, &abi_version_list, next) {\n+\t\thelp_len += strlen(av->version_name) + 1;\n+\t}\n+\n+\thelp = (char *)calloc(help_len, sizeof(char));\n+\tif (!help)\n+\t\treturn -1;\n+\n+\tstrlcat(help, cmd_set_abi_version.help_str, help_len);\n+\tTAILQ_FOREACH(av, &abi_version_list, next) {\n+\t\tstrlcat(help, av->version_name, help_len);\n+\t\tif (TAILQ_NEXT(av, next) != NULL)\n+\t\t\tstrlcat(help, \"|\", help_len);\n+\t}\n+\n+\tcmd_set_abi_version.help_str = help;\n \n+\t/* set the parse strings for the command lists */\n \tTAILQ_FOREACH(t, &commands_list, next) {\n-\t\tcommands_len += strlen(t->command) + 1;\n+\t\tcommands_len[t->abi_version] += strlen(t->command) + 1;\n \t}\n \n-\tcommands = (char *)calloc(commands_len, sizeof(char));\n-\tif (!commands)\n-\t\treturn -1;\n+\tfor (abi_version = 0; abi_version < TEST_DPDK_ABI_VERSION_MAX;\n+\t\tabi_version++) {\n+\t\tcommands[abi_version] =\n+\t\t\t(char *)calloc(commands_len[abi_version], sizeof(char));\n+\t\tif (!commands[abi_version])\n+\t\t\treturn -1;\n+\t}\n \n \tTAILQ_FOREACH(t, &commands_list, next) {\n-\t\tstrlcat(commands, t->command, commands_len);\n+\t\tstrlcat(commands[t->abi_version],\n+\t\t\tt->command, commands_len[t->abi_version]);\n \t\tif (TAILQ_NEXT(t, next) != NULL)\n-\t\t\tstrlcat(commands, \"#\", commands_len);\n+\t\t\tstrlcat(commands[t->abi_version],\n+\t\t\t\t\"#\", commands_len[t->abi_version]);\n \t}\n \n-\tcmd_autotest_autotest.string_data.str = commands;\n+\tfor (abi_version = 0; abi_version < TEST_DPDK_ABI_VERSION_MAX;\n+\t\tabi_version++)\n+\t\tcmd_autotest_autotest[abi_version].string_data.str =\n+\t\t\tcommands[abi_version];\n+\n \treturn 0;\n }\ndiff --git a/app/test/test.c b/app/test/test.c\nindex ea1e98f2e..4bc9df4c2 100644\n--- a/app/test/test.c\n+++ b/app/test/test.c\n@@ -297,3 +297,5 @@ unit_test_suite_runner(struct unit_test_suite *suite)\n \n \treturn 0;\n }\n+\n+REGISTER_TEST_ABI_VERSION(default, TEST_DPDK_ABI_VERSION_DEFAULT)\ndiff --git a/app/test/test.h b/app/test/test.h\nindex ac0c50616..5ec3728d0 100644\n--- a/app/test/test.h\n+++ b/app/test/test.h\n@@ -162,25 +162,59 @@ int test_set_rxtx_conf(cmdline_fixed_string_t mode);\n int test_set_rxtx_anchor(cmdline_fixed_string_t type);\n int test_set_rxtx_sc(cmdline_fixed_string_t type);\n \n+#define MAP_ABI_SYMBOL_VERSION(name, abi_version) \\\n+\t__asm(\".symver \"RTE_STR(name)\",\"RTE_STR(name)\"@\"RTE_STR(abi_version))\n+\n+#define TEST_DPDK_ABI_VERSION_DEFAULT 0\n+#define TEST_DPDK_ABI_VERSION_V1604 1\n+#define TEST_DPDK_ABI_VERSION_V20 2\n+#define TEST_DPDK_ABI_VERSION_MAX 3\n+\n+TAILQ_HEAD(test_abi_version_list, test_abi_version);\n+struct test_abi_version {\n+\tTAILQ_ENTRY(test_abi_version) next;\n+\tconst char *version_name;\n+\tuint8_t version_id;\n+};\n+\n+void add_abi_version(struct test_abi_version *av);\n+\n+/* Register a test function with its command string */\n+#define REGISTER_TEST_ABI_VERSION(name, id) \\\n+\tstatic struct test_abi_version test_struct_##name = { \\\n+\t\t.version_name = RTE_STR(name), \\\n+\t\t.version_id = id, \\\n+\t}; \\\n+\tRTE_INIT(test_register_##name) \\\n+\t{ \\\n+\t\tadd_abi_version(&test_struct_##name); \\\n+\t}\n+\n typedef int (test_callback)(void);\n TAILQ_HEAD(test_commands_list, test_command);\n struct test_command {\n \tTAILQ_ENTRY(test_command) next;\n \tconst char *command;\n \ttest_callback *callback;\n+\tuint8_t abi_version;\n };\n \n-void add_test_command(struct test_command *t);\n+void add_test_command(struct test_command *t, uint8_t abi_version);\n+\n+/* Register a test function with its command string and abi version */\n+#define REGISTER_TEST_COMMAND_VERSION(cmd, func, abi_version) \\\n+\tstatic struct test_command test_struct_##cmd = { \\\n+\t\t.command = RTE_STR(cmd), \\\n+\t\t.callback = func, \\\n+\t}; \\\n+\tRTE_INIT(test_register_##cmd) \\\n+\t{ \\\n+\t\tadd_test_command(&test_struct_##cmd, abi_version); \\\n+\t}\n \n /* Register a test function with its command string */\n+\n #define REGISTER_TEST_COMMAND(cmd, func) \\\n-\tstatic struct test_command test_struct_##cmd = { \\\n-\t\t.command = RTE_STR(cmd), \\\n-\t\t.callback = func, \\\n-\t}; \\\n-\tRTE_INIT(test_register_##cmd) \\\n-\t{ \\\n-\t\tadd_test_command(&test_struct_##cmd); \\\n-\t}\n+\tREGISTER_TEST_COMMAND_VERSION(cmd, func, TEST_DPDK_ABI_VERSION_DEFAULT)\n \n #endif\n", "prefixes": [ "1/2" ] }{ "id": 53768, "url": "