test/threads: add unit test
[dpdk.git] / app / test / test_external_mem.c
index 97bde1c..0c64b61 100644 (file)
@@ -2,25 +2,36 @@
  * Copyright(c) 2018 Intel Corporation
  */
 
+#include "test.h"
+
 #include <errno.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <fcntl.h>
+
+#ifdef RTE_EXEC_ENV_WINDOWS
+static int
+test_external_mem(void)
+{
+       printf("external_mem not supported on Windows, skipping test\n");
+       return TEST_SKIPPED;
+}
+
+#else
+
 #include <sys/mman.h>
 #include <sys/wait.h>
 
 #include <rte_common.h>
 #include <rte_debug.h>
 #include <rte_eal.h>
-#include <rte_eal_memconfig.h>
+#include <rte_eal_paging.h>
 #include <rte_errno.h>
 #include <rte_malloc.h>
 #include <rte_ring.h>
 #include <rte_string_fns.h>
 
-#include "test.h"
-
 #define EXTERNAL_MEM_SZ (RTE_PGSIZE_4K << 10) /* 4M of data */
 
 static int
@@ -533,8 +544,8 @@ fail:
 static int
 test_external_mem(void)
 {
+       size_t pgsz = rte_mem_page_size();
        size_t len = EXTERNAL_MEM_SZ;
-       size_t pgsz = RTE_PGSIZE_4K;
        rte_iova_t iova[len / pgsz];
        void *addr;
        int ret, n_pages;
@@ -574,4 +585,6 @@ test_external_mem(void)
        return ret;
 }
 
+#endif /* !RTE_EXEC_ENV_WINDOWS */
+
 REGISTER_TEST_COMMAND(external_mem_autotest, test_external_mem);