test/bpf: skip test if libpcap is unavailable
[dpdk.git] / app / test / test_common.c
index 2b856f8..ef177ce 100644 (file)
@@ -30,9 +30,13 @@ test_macros(int __rte_unused unused_parm)
        return -1;}
 
        uintptr_t unused = 0;
+       unsigned int smaller = SMALLER, bigger  = BIGGER;
 
        RTE_SET_USED(unused);
 
+       RTE_SWAP(smaller, bigger);
+       if (smaller != BIGGER && bigger != SMALLER)
+               FAIL_MACRO(RTE_SWAP);
        if ((uintptr_t)RTE_PTR_ADD(SMALLER, PTR_DIFF) != BIGGER)
                FAIL_MACRO(RTE_PTR_ADD);
        if ((uintptr_t)RTE_PTR_SUB(BIGGER, PTR_DIFF) != SMALLER)
@@ -216,7 +220,19 @@ test_log2(void)
        const uint32_t max = 0x10000;
        const uint32_t step = 1;
 
-       for (i = 0; i < max; i = i + step) {
+       compare = rte_log2_u32(0);
+       if (compare != 0) {
+               printf("Wrong rte_log2_u32(0) val %x, expected 0\n", compare);
+               return TEST_FAILED;
+       }
+
+       compare = rte_log2_u64(0);
+       if (compare != 0) {
+               printf("Wrong rte_log2_u64(0) val %x, expected 0\n", compare);
+               return TEST_FAILED;
+       }
+
+       for (i = 1; i < max; i = i + step) {
                uint64_t i64;
 
                /* extend range for 64-bit */