* Copyright(c) 2010-2019 Intel Corporation
*/
+#include "test.h"
+
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include <stdarg.h>
#include <errno.h>
#include <stdlib.h>
+#ifndef RTE_EXEC_ENV_WINDOWS
#include <sys/mman.h>
+#endif
#include <sys/queue.h>
#include <unistd.h>
#include <rte_random.h>
#include <rte_string_fns.h>
-#include "test.h"
-
#define N 10000
-
static int
is_mem_on_socket(int32_t socket);
static int
is_memory_overlap(void *p1, size_t len1, void *p2, size_t len2)
{
- unsigned long ptr1 = (unsigned long)p1;
- unsigned long ptr2 = (unsigned long)p2;
+ uintptr_t ptr1 = (uintptr_t)p1;
+ uintptr_t ptr2 = (uintptr_t)p2;
if (ptr2 >= ptr1 && (ptr2 - ptr1) < len1)
return 1;
static int
is_aligned(void *p, int align)
{
- unsigned long addr = (unsigned long)p;
+ uintptr_t addr = (uintptr_t)p;
unsigned mask = align - 1;
if (addr & mask)
return 0;
}
+#ifdef RTE_EXEC_ENV_WINDOWS
+static int
+test_realloc(void)
+{
+ return TEST_SKIPPED;
+}
+#else
+
static int
test_realloc_socket(int socket)
{
}
}
- /* Print warnign if only a single socket, but don't fail the test */
+ /* Print warning if only a single socket, but don't fail the test */
if (socket_count < 2)
printf("WARNING: realloc_socket test needs memory on multiple sockets!\n");
return ret;
}
+#endif /* !RTE_EXEC_ENV_WINDOWS */
+
static int
test_random_alloc_free(void *_ __rte_unused)
{
err_return:
/*clean up */
- if (p1) rte_free(p1);
+ rte_free(p1);
return -1;
}
err_return:
/* clean up pointer */
- if (bad_ptr)
- rte_free(bad_ptr);
+ rte_free(bad_ptr);
return -1;
}
}
}
- /* Print warnign if only a single socket, but don't fail the test */
+ /* Print warning if only a single socket, but don't fail the test */
if (socket_count < 2) {
printf("WARNING: alloc_socket test needs memory on multiple sockets!\n");
}
else printf("test_realloc() passed\n");
/*----------------------------*/
- RTE_LCORE_FOREACH_SLAVE(lcore_id) {
+ RTE_LCORE_FOREACH_WORKER(lcore_id) {
rte_eal_remote_launch(test_align_overlap_per_lcore, NULL, lcore_id);
}
- RTE_LCORE_FOREACH_SLAVE(lcore_id) {
+ RTE_LCORE_FOREACH_WORKER(lcore_id) {
if (rte_eal_wait_lcore(lcore_id) < 0)
ret = -1;
}
else printf("test_align_overlap_per_lcore() passed\n");
/*----------------------------*/
- RTE_LCORE_FOREACH_SLAVE(lcore_id) {
+ RTE_LCORE_FOREACH_WORKER(lcore_id) {
rte_eal_remote_launch(test_reordered_free_per_lcore, NULL, lcore_id);
}
- RTE_LCORE_FOREACH_SLAVE(lcore_id) {
+ RTE_LCORE_FOREACH_WORKER(lcore_id) {
if (rte_eal_wait_lcore(lcore_id) < 0)
ret = -1;
}
else printf("test_reordered_free_per_lcore() passed\n");
/*----------------------------*/
- RTE_LCORE_FOREACH_SLAVE(lcore_id) {
+ RTE_LCORE_FOREACH_WORKER(lcore_id) {
rte_eal_remote_launch(test_random_alloc_free, NULL, lcore_id);
}
- RTE_LCORE_FOREACH_SLAVE(lcore_id) {
+ RTE_LCORE_FOREACH_WORKER(lcore_id) {
if (rte_eal_wait_lcore(lcore_id) < 0)
ret = -1;
}