From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id F0C6E1E514 for ; Mon, 11 Jun 2018 12:10:21 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Jun 2018 03:10:20 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,501,1520924400"; d="scan'208";a="63044254" Received: from silpixa00383879.ir.intel.com (HELO silpixa00383879.ger.corp.intel.com) ([10.237.223.127]) by fmsmga001.fm.intel.com with ESMTP; 11 Jun 2018 03:10:19 -0700 From: Radu Nicolau To: dev@dpdk.org Cc: david.hunt@intel.com, chris.macnamara@intel.com, michael.j.glynn@intel.com, Radu Nicolau Date: Mon, 11 Jun 2018 11:03:22 +0100 Message-Id: <1528711403-29776-2-git-send-email-radu.nicolau@intel.com> X-Mailer: git-send-email 2.7.5 In-Reply-To: <1528711403-29776-1-git-send-email-radu.nicolau@intel.com> References: <1528282041-20380-1-git-send-email-radu.nicolau@intel.com> <1528711403-29776-1-git-send-email-radu.nicolau@intel.com> Subject: [dpdk-dev] [PATCH v2 2/3] test/power: add unit test for get capabilities API X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jun 2018 10:10:22 -0000 Signed-off-by: Radu Nicolau --- test/test/test_power_acpi_cpufreq.c | 42 +++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/test/test/test_power_acpi_cpufreq.c b/test/test/test_power_acpi_cpufreq.c index 8da2dcc..67d5ee0 100644 --- a/test/test/test_power_acpi_cpufreq.c +++ b/test/test/test_power_acpi_cpufreq.c @@ -18,6 +18,12 @@ test_power_acpi_cpufreq(void) printf("Power management library not supported, skipping test\n"); return TEST_SKIPPED; } +static int +test_power_acpi_caps(void) +{ + printf("Power management library not supported, skipping test\n"); + return TEST_SKIPPED; +} #else #include @@ -517,6 +523,42 @@ test_power_acpi_cpufreq(void) rte_power_unset_env(); return -1; } + +static int +test_power_acpi_caps(void) +{ + struct rte_power_core_capabilities caps; + int ret; + + ret = rte_power_set_env(PM_ENV_ACPI_CPUFREQ); + if (ret) { + printf("Error setting ACPI environment\n"); + return -1; + } + + ret = rte_power_init(TEST_POWER_LCORE_ID); + if (ret < 0) { + printf("Cannot initialise power management for lcore %u, this " + "may occur if environment is not configured " + "correctly(APCI cpufreq) or operating in another valid " + "Power management environment\n", TEST_POWER_LCORE_ID); + rte_power_unset_env(); + return -1; + } + + ret = rte_power_get_capabilities(TEST_POWER_LCORE_ID, &caps); + if (ret) { + printf("ACPI: Error getting capabilities\n"); + return -1; + } + + printf("ACPI: Capabilities %lx\n", caps.capabilities); + + rte_power_unset_env(); + return 0; +} + #endif REGISTER_TEST_COMMAND(power_acpi_cpufreq_autotest, test_power_acpi_cpufreq); +REGISTER_TEST_COMMAND(power_acpi_caps_autotest, test_power_acpi_caps); -- 2.7.5