Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/52363/?format=api
http://patches.dpdk.org/api/patches/52363/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/patch/20190405162205.4824-4-marcinx.hajkowski@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": "<20190405162205.4824-4-marcinx.hajkowski@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20190405162205.4824-4-marcinx.hajkowski@intel.com", "date": "2019-04-05T16:22:05", "name": "[3/3] power: add UTs for all power env types", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": true, "hash": "461886b74e1e4050cdae4cac82b2fba8e2558e67", "submitter": { "id": 1246, "url": "http://patches.dpdk.org/api/people/1246/?format=api", "name": "Marcin Hajkowski", "email": "marcinx.hajkowski@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/20190405162205.4824-4-marcinx.hajkowski@intel.com/mbox/", "series": [ { "id": 4147, "url": "http://patches.dpdk.org/api/series/4147/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=4147", "date": "2019-04-05T16:22:02", "name": "rte_power enhancement", "version": 1, "mbox": "http://patches.dpdk.org/series/4147/mbox/" } ], "comments": "http://patches.dpdk.org/api/patches/52363/comments/", "check": "success", "checks": "http://patches.dpdk.org/api/patches/52363/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 48BD81B579;\n\tFri, 5 Apr 2019 18:23:49 +0200 (CEST)", "from mga01.intel.com (mga01.intel.com [192.55.52.88])\n\tby dpdk.org (Postfix) with ESMTP id A179F1B569\n\tfor <dev@dpdk.org>; Fri, 5 Apr 2019 18:23:40 +0200 (CEST)", "from fmsmga002.fm.intel.com ([10.253.24.26])\n\tby fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t05 Apr 2019 09:23:40 -0700", "from mhajkowx-mobl.ger.corp.intel.com ([10.104.116.181])\n\tby fmsmga002.fm.intel.com with ESMTP; 05 Apr 2019 09:23:39 -0700" ], "X-Amp-Result": "SKIPPED(no attachment in message)", "X-Amp-File-Uploaded": "False", "X-ExtLoop1": "1", "X-IronPort-AV": "E=Sophos;i=\"5.60,313,1549958400\"; d=\"scan'208\";a=\"158588057\"", "From": "Hajkowski <marcinx.hajkowski@intel.com>", "To": "david.hunt@intel.com", "Cc": "dev@dpdk.org, Marcin Hajkowski <marcinx.hajkowski@intel.com>,\n\tAnatoly Burakov <anatoly.burakov@intel.com>", "Date": "Fri, 5 Apr 2019 18:22:05 +0200", "Message-Id": "<20190405162205.4824-4-marcinx.hajkowski@intel.com>", "X-Mailer": "git-send-email 2.20.1.windows.1", "In-Reply-To": "<20190405162205.4824-1-marcinx.hajkowski@intel.com>", "References": "<20190405162205.4824-1-marcinx.hajkowski@intel.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[dpdk-dev] [PATCH 3/3] power: add UTs for all power env types", "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": "From: Marcin Hajkowski <marcinx.hajkowski@intel.com>\n\nTest all existing power environment configuration to verify if related\ndata is properly initialized and clean in set/unset scenarios.\n\nSigned-off-by: Marcin Hajkowski <marcinx.hajkowski@intel.com>\nAcked-by: Anatoly Burakov <anatoly.burakov@intel.com>\n---\n app/test/test_power.c | 156 ++++++++++++++++++++++++++++++++----------\n 1 file changed, 121 insertions(+), 35 deletions(-)", "diff": "diff --git a/app/test/test_power.c b/app/test/test_power.c\nindex a0ee21983..0ff2aa0d1 100644\n--- a/app/test/test_power.c\n+++ b/app/test/test_power.c\n@@ -7,6 +7,7 @@\n #include <unistd.h>\n #include <limits.h>\n #include <string.h>\n+#include <stdbool.h>\n \n #include \"test.h\"\n \n@@ -23,6 +24,86 @@ test_power(void)\n \n #include <rte_power.h>\n \n+static int\n+check_function_ptrs(void)\n+{\n+\tenum power_management_env env = rte_power_get_env();\n+\n+\tconst bool not_null_expected = !(env == PM_ENV_NOT_SET);\n+\n+\tconst char *inject_not_string1 = not_null_expected ? \" not\" : \"\";\n+\tconst char *inject_not_string2 = not_null_expected ? \"\" : \" not\";\n+\n+\tif ((rte_power_freqs == NULL) == not_null_expected) {\n+\t\tprintf(\"rte_power_freqs should%s be NULL, environment has%s been \"\n+\t\t\t\t\"initialised\\n\", inject_not_string1,\n+\t\t\t\t\tinject_not_string2);\n+\t\treturn -1;\n+\t}\n+\tif ((rte_power_get_freq == NULL) == not_null_expected) {\n+\t\tprintf(\"rte_power_get_freq should%s be NULL, environment has%s been \"\n+\t\t\t\t\"initialised\\n\", inject_not_string1,\n+\t\t\t\t\tinject_not_string2);\n+\t\treturn -1;\n+\t}\n+\tif ((rte_power_set_freq == NULL) == not_null_expected) {\n+\t\tprintf(\"rte_power_set_freq should%s be NULL, environment has%s been \"\n+\t\t\t\t\"initialised\\n\", inject_not_string1,\n+\t\t\t\tinject_not_string2);\n+\t\treturn -1;\n+\t}\n+\tif ((rte_power_freq_up == NULL) == not_null_expected) {\n+\t\tprintf(\"rte_power_freq_up should%s be NULL, environment has%s been \"\n+\t\t\t\t\"initialised\\n\", inject_not_string1,\n+\t\t\t\tinject_not_string2);\n+\t\treturn -1;\n+\t}\n+\tif ((rte_power_freq_down == NULL) == not_null_expected) {\n+\t\tprintf(\"rte_power_freq_down should%s be NULL, environment has%s been \"\n+\t\t\t\t\"initialised\\n\", inject_not_string1,\n+\t\t\t\tinject_not_string2);\n+\t\treturn -1;\n+\t}\n+\tif ((rte_power_freq_max == NULL) == not_null_expected) {\n+\t\tprintf(\"rte_power_freq_max should%s be NULL, environment has%s been \"\n+\t\t\t\t\"initialised\\n\", inject_not_string1,\n+\t\t\t\tinject_not_string2);\n+\t\treturn -1;\n+\t}\n+\tif ((rte_power_freq_min == NULL) == not_null_expected) {\n+\t\tprintf(\"rte_power_freq_min should%s be NULL, environment has%s been \"\n+\t\t\t\t\"initialised\\n\", inject_not_string1,\n+\t\t\t\tinject_not_string2);\n+\t\treturn -1;\n+\t}\n+\tif ((rte_power_turbo_status == NULL) == not_null_expected) {\n+\t\tprintf(\"rte_power_turbo_status should%s be NULL, environment has%s been \"\n+\t\t\t\t\"initialised\\n\", inject_not_string1,\n+\t\t\t\tinject_not_string2);\n+\t\treturn -1;\n+\t}\n+\tif ((rte_power_freq_enable_turbo == NULL) == not_null_expected) {\n+\t\tprintf(\"rte_power_freq_enable_turbo should%s be NULL, environment has%s been \"\n+\t\t\t\t\"initialised\\n\", inject_not_string1,\n+\t\t\t\tinject_not_string2);\n+\t\treturn -1;\n+\t}\n+\tif ((rte_power_freq_disable_turbo == NULL) == not_null_expected) {\n+\t\tprintf(\"rte_power_freq_disable_turbo should%s be NULL, environment has%s been \"\n+\t\t\t\t\"initialised\\n\", inject_not_string1,\n+\t\t\t\tinject_not_string2);\n+\t\treturn -1;\n+\t}\n+\tif ((rte_power_get_capabilities == NULL) == not_null_expected) {\n+\t\tprintf(\"rte_power_get_capabilities should%s be NULL, environment has%s been \"\n+\t\t\t\t\"initialised\\n\", inject_not_string1,\n+\t\t\t\tinject_not_string2);\n+\t\treturn -1;\n+\t}\n+\n+\treturn 0;\n+}\n+\n static int\n test_power(void)\n {\n@@ -43,43 +124,48 @@ test_power(void)\n \t\treturn -1;\n \t}\n \n-\t/* verify that function pointers are NULL */\n-\tif (rte_power_freqs != NULL) {\n-\t\tprintf(\"rte_power_freqs should be NULL, environment has not been \"\n-\t\t\t\t\"initialised\\n\");\n-\t\tgoto fail_all;\n-\t}\n-\tif (rte_power_get_freq != NULL) {\n-\t\tprintf(\"rte_power_get_freq should be NULL, environment has not been \"\n-\t\t\t\t\"initialised\\n\");\n-\t\tgoto fail_all;\n-\t}\n-\tif (rte_power_set_freq != NULL) {\n-\t\tprintf(\"rte_power_set_freq should be NULL, environment has not been \"\n-\t\t\t\t\"initialised\\n\");\n-\t\tgoto fail_all;\n-\t}\n-\tif (rte_power_freq_up != NULL) {\n-\t\tprintf(\"rte_power_freq_up should be NULL, environment has not been \"\n-\t\t\t\t\"initialised\\n\");\n-\t\tgoto fail_all;\n-\t}\n-\tif (rte_power_freq_down != NULL) {\n-\t\tprintf(\"rte_power_freq_down should be NULL, environment has not been \"\n-\t\t\t\t\"initialised\\n\");\n-\t\tgoto fail_all;\n-\t}\n-\tif (rte_power_freq_max != NULL) {\n-\t\tprintf(\"rte_power_freq_max should be NULL, environment has not been \"\n-\t\t\t\t\"initialised\\n\");\n-\t\tgoto fail_all;\n-\t}\n-\tif (rte_power_freq_min != NULL) {\n-\t\tprintf(\"rte_power_freq_min should be NULL, environment has not been \"\n-\t\t\t\t\"initialised\\n\");\n+\t/* Verify that function pointers are NULL */\n+\tif (check_function_ptrs() < 0)\n \t\tgoto fail_all;\n-\t}\n+\n \trte_power_unset_env();\n+\n+\t/* Perform tests for valid environments.*/\n+\tconst enum power_management_env envs[] = {PM_ENV_ACPI_CPUFREQ,\n+\t\t\tPM_ENV_KVM_VM,\n+\t\t\tPM_ENV_PSTATE_CPUFREQ};\n+\n+\tconst int envs_size = sizeof(envs)/sizeof(enum power_management_env);\n+\n+\tint i;\n+\tfor (i = 0; i < envs_size; ++i) {\n+\n+\t\t/* Test setting a valid environment */\n+\t\tret = rte_power_set_env(envs[i]);\n+\t\tif (ret != 0) {\n+\t\t\tprintf(\"Unexpectedly unsucceeded on setting a valid environment\\n\");\n+\t\t\treturn -1;\n+\t\t}\n+\n+\t\t/* Test that the environment has been set */\n+\t\tenv = rte_power_get_env();\n+\t\tif (env != envs[i]) {\n+\t\t\tprintf(\"Not expected environment configuration\\n\");\n+\t\t\treturn -1;\n+\t\t}\n+\n+\t\t/* Verify that function pointers are NOT NULL */\n+\t\tif (check_function_ptrs() < 0)\n+\t\t\tgoto fail_all;\n+\n+\t\trte_power_unset_env();\n+\n+\t\t/* Verify that function pointers are NULL */\n+\t\tif (check_function_ptrs() < 0)\n+\t\t\tgoto fail_all;\n+\n+\t}\n+\n \treturn 0;\n fail_all:\n \trte_power_unset_env();\n", "prefixes": [ "3/3" ] }{ "id": 52363, "url": "