test/threads: add unit test
[dpdk.git] / app / test / test_member.c
index e2a3932..26a7124 100644 (file)
@@ -4,16 +4,27 @@
 
 /* This test is for membership library's simple feature test */
 
+#include "test.h"
+
 #include <rte_memcpy.h>
 #include <rte_malloc.h>
+
+#ifdef RTE_EXEC_ENV_WINDOWS
+static int
+test_member(void)
+{
+       printf("member not supported on Windows, skipping test\n");
+       return TEST_SKIPPED;
+}
+
+#else
+
 #include <rte_member.h>
 #include <rte_byteorder.h>
 #include <rte_random.h>
 #include <rte_debug.h>
 #include <rte_ip.h>
 
-#include "test.h"
-
 struct rte_member_setsum *setsum_ht;
 struct rte_member_setsum *setsum_cache;
 struct rte_member_setsum *setsum_vbf;
@@ -25,7 +36,7 @@ struct flow_key {
        uint16_t port_src;
        uint16_t port_dst;
        uint8_t proto;
-} __attribute__((packed));
+} __rte_packed;
 
 /* Set ID Macros for multimatch test usage */
 #define M_MATCH_S 1    /* Not start with 0 since by default 0 means no match */
@@ -41,36 +52,36 @@ struct flow_key {
 /* Keys used by unit test functions */
 static struct flow_key keys[NUM_SAMPLES] = {
        {
-               .ip_src = IPv4(0x03, 0x02, 0x01, 0x00),
-               .ip_dst = IPv4(0x07, 0x06, 0x05, 0x04),
+               .ip_src = RTE_IPV4(0x03, 0x02, 0x01, 0x00),
+               .ip_dst = RTE_IPV4(0x07, 0x06, 0x05, 0x04),
                .port_src = 0x0908,
                .port_dst = 0x0b0a,
                .proto = 0x0c,
        },
        {
-               .ip_src = IPv4(0x13, 0x12, 0x11, 0x10),
-               .ip_dst = IPv4(0x17, 0x16, 0x15, 0x14),
+               .ip_src = RTE_IPV4(0x13, 0x12, 0x11, 0x10),
+               .ip_dst = RTE_IPV4(0x17, 0x16, 0x15, 0x14),
                .port_src = 0x1918,
                .port_dst = 0x1b1a,
                .proto = 0x1c,
        },
        {
-               .ip_src = IPv4(0x23, 0x22, 0x21, 0x20),
-               .ip_dst = IPv4(0x27, 0x26, 0x25, 0x24),
+               .ip_src = RTE_IPV4(0x23, 0x22, 0x21, 0x20),
+               .ip_dst = RTE_IPV4(0x27, 0x26, 0x25, 0x24),
                .port_src = 0x2928,
                .port_dst = 0x2b2a,
                .proto = 0x2c,
        },
        {
-               .ip_src = IPv4(0x33, 0x32, 0x31, 0x30),
-               .ip_dst = IPv4(0x37, 0x36, 0x35, 0x34),
+               .ip_src = RTE_IPV4(0x33, 0x32, 0x31, 0x30),
+               .ip_dst = RTE_IPV4(0x37, 0x36, 0x35, 0x34),
                .port_src = 0x3938,
                .port_dst = 0x3b3a,
                .proto = 0x3c,
        },
        {
-               .ip_src = IPv4(0x43, 0x42, 0x41, 0x40),
-               .ip_dst = IPv4(0x47, 0x46, 0x45, 0x44),
+               .ip_src = RTE_IPV4(0x43, 0x42, 0x41, 0x40),
+               .ip_dst = RTE_IPV4(0x47, 0x46, 0x45, 0x44),
                .port_src = 0x4948,
                .port_dst = 0x4b4a,
                .proto = 0x4c,
@@ -459,7 +470,7 @@ static int test_member_multimatch(void)
                                                MAX_MATCH, set_ids_cache);
                /*
                 * For cache mode, keys overwrite when signature same.
-                * the mutimatch should work like single match.
+                * the multimatch should work like single match.
                 */
                TEST_ASSERT(ret_ht == M_MATCH_CNT && ret_vbf == M_MATCH_CNT &&
                                ret_cache == 1,
@@ -712,4 +723,6 @@ test_member(void)
        return 0;
 }
 
+#endif /* !RTE_EXEC_ENV_WINDOWS */
+
 REGISTER_TEST_COMMAND(member_autotest, test_member);