From: Reshma Pattan Date: Tue, 24 Apr 2018 22:10:21 +0000 (+0100) Subject: test/power: fix build with shared library X-Git-Url: http://git.droids-corp.org/?p=dpdk.git;a=commitdiff_plain;h=4e96556a21bc60a89b05bd92163a5897ae2b43a4 test/power: fix build with shared library Using private api `guest_channel_host_connect()` will cause shared library build failure: test_power_kvm_vm.c:(.text+0x2cb): undefined reference to `guest_channel_host_connect' So revert the changes done. Fixes: d550a8cc31f3 ("app/test: enhance power manager unit tests") Reported-by: Bruce Richardson Suggested-by: David Hunt Signed-off-by: Jananee Parthasarathy Signed-off-by: Reshma Pattan --- diff --git a/test/test/test_power_kvm_vm.c b/test/test/test_power_kvm_vm.c index 2ac74912d7..bce706ded0 100644 --- a/test/test/test_power_kvm_vm.c +++ b/test/test/test_power_kvm_vm.c @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: BSD-3-Clause - * Copyright(c) 2010-2014 Intel Corporation + * Copyright(c) 2010-2018 Intel Corporation */ #include @@ -25,17 +25,12 @@ test_power_kvm_vm(void) #define TEST_POWER_VM_LCORE_ID 0U #define TEST_POWER_VM_LCORE_OUT_OF_BOUNDS (RTE_MAX_LCORE+1) #define TEST_POWER_VM_LCORE_INVALID 1U -#define TEMP_POWER_MANAGER_FILE_PATH "/tmp/testpm" - -int guest_channel_host_connect(const char *path, unsigned int lcore_id); static int test_power_kvm_vm(void) { int ret; enum power_management_env env; - char fPath[PATH_MAX]; - FILE *fPtr = NULL; ret = rte_power_set_env(PM_ENV_KVM_VM); if (ret != 0) { @@ -100,31 +95,13 @@ test_power_kvm_vm(void) /* Test initialisation of a valid lcore */ ret = rte_power_init(TEST_POWER_VM_LCORE_ID); if (ret < 0) { - printf("rte_power_init failed as expected in host\n"); - /* This test would be successful when run on VM, - * in order to run in Host itself, temporary file path - * is created and same is used for further communication - */ - - snprintf(fPath, PATH_MAX, "%s.%u", - TEMP_POWER_MANAGER_FILE_PATH, TEST_POWER_VM_LCORE_ID); - fPtr = fopen(fPath, "w"); - if (fPtr == NULL) { - printf(" Unable to create file\n"); - rte_power_unset_env(); - return -1; - } - ret = guest_channel_host_connect(TEMP_POWER_MANAGER_FILE_PATH, - TEST_POWER_VM_LCORE_ID); - if (ret == 0) - printf("guest_channel_host_connect successful\n"); - else { - printf("guest_channel_host_connect failed\n"); - rte_power_unset_env(); - fclose(fPtr); - remove(fPath); - return -1; - } + printf("Cannot initialise power management for lcore %u, this " + "may occur if environment is not configured " + "correctly(KVM VM) or operating in another valid " + "Power management environment\n", + TEST_POWER_VM_LCORE_ID); + rte_power_unset_env(); + return -1; } /* Test initialisation of previously initialised lcore */ @@ -314,18 +291,10 @@ test_power_kvm_vm(void) return -1; } rte_power_unset_env(); - if (fPtr != NULL) { - fclose(fPtr); - remove(fPath); - } return 0; fail_all: rte_power_exit(TEST_POWER_VM_LCORE_ID); rte_power_unset_env(); - if (fPtr != NULL) { - fclose(fPtr); - remove(fPath); - } return -1; } #endif