From: Bruce Richardson Date: Thu, 1 Feb 2018 14:20:09 +0000 (+0000) Subject: test: skip when required lib not available X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=0ea2dd44099ac124c0357d5d21d07ecfb52b74ef;p=dpdk.git test: skip when required lib not available The power management and KNI libraries are not compiled on a FreeBSD platform, which means that the tests can't run. Add in stub code for these cases, allowing the tests to still be compiled, but to report as skipped in those cases. Signed-off-by: Bruce Richardson Acked-by: David Hunt --- diff --git a/test/test/test_kni.c b/test/test/test_kni.c index c6867f256d..e4839cdb74 100644 --- a/test/test/test_kni.c +++ b/test/test/test_kni.c @@ -10,6 +10,17 @@ #include "test.h" +#ifndef RTE_LIBRTE_KNI + +static int +test_kni(void) +{ + printf("KNI not supported, skipping test\n"); + return TEST_SKIPPED; +} + +#else + #include #include #include @@ -609,4 +620,6 @@ fail: return ret; } +#endif + REGISTER_TEST_COMMAND(kni_autotest, test_kni); diff --git a/test/test/test_power.c b/test/test/test_power.c index d601a2730a..a0ee219830 100644 --- a/test/test/test_power.c +++ b/test/test/test_power.c @@ -10,6 +10,17 @@ #include "test.h" +#ifndef RTE_LIBRTE_POWER + +static int +test_power(void) +{ + printf("Power management library not supported, skipping test\n"); + return TEST_SKIPPED; +} + +#else + #include static int @@ -74,5 +85,6 @@ fail_all: rte_power_unset_env(); return -1; } +#endif REGISTER_TEST_COMMAND(power_autotest, test_power); diff --git a/test/test/test_power_acpi_cpufreq.c b/test/test/test_power_acpi_cpufreq.c index ad948fbe1f..3bfd033518 100644 --- a/test/test/test_power_acpi_cpufreq.c +++ b/test/test/test_power_acpi_cpufreq.c @@ -10,6 +10,16 @@ #include "test.h" +#ifndef RTE_LIBRTE_POWER + +static int +test_power_acpi_cpufreq(void) +{ + printf("Power management library not supported, skipping test\n"); + return TEST_SKIPPED; +} + +#else #include #define TEST_POWER_LCORE_ID 2U @@ -507,5 +517,6 @@ fail_all: rte_power_unset_env(); return -1; } +#endif REGISTER_TEST_COMMAND(power_acpi_cpufreq_autotest, test_power_acpi_cpufreq); diff --git a/test/test/test_power_kvm_vm.c b/test/test/test_power_kvm_vm.c index 97b8af9b5b..91b31c442a 100644 --- a/test/test/test_power_kvm_vm.c +++ b/test/test/test_power_kvm_vm.c @@ -10,6 +10,16 @@ #include "test.h" +#ifndef RTE_LIBRTE_POWER + +static int +test_power_kvm_vm(void) +{ + printf("Power management library not supported, skipping test\n"); + return TEST_SKIPPED; +} + +#else #include #define TEST_POWER_VM_LCORE_ID 0U @@ -270,5 +280,6 @@ fail_all: rte_power_unset_env(); return -1; } +#endif REGISTER_TEST_COMMAND(power_kvm_vm_autotest, test_power_kvm_vm);