#include <rte_string_fns.h>
#include <rte_errno.h>
#include <rte_malloc.h>
-#include "../../lib/librte_eal/common/malloc_elem.h"
+
+#include "malloc_elem.h"
#include "test.h"
return 0;
}
+static int
+test_memzone_invalid_flags(void)
+{
+ const struct rte_memzone *mz;
+
+ mz = rte_memzone_lookup(TEST_MEMZONE_NAME("invalid_flags"));
+ if (mz != NULL) {
+ printf("Zone with invalid flags has been reserved\n");
+ return -1;
+ }
+
+ mz = rte_memzone_reserve(TEST_MEMZONE_NAME("invalid_flags"),
+ 100, SOCKET_ID_ANY, RTE_MEMZONE_IOVA_CONTIG << 1);
+ if (mz != NULL) {
+ printf("Zone with invalid flags has been reserved\n");
+ return -1;
+ }
+ return 0;
+}
+
static int
test_memzone_reserving_zone_size_bigger_than_the_maximum(void)
{
}
if (mz->len != maxlen) {
- printf("Memzone reserve with 0 size did not return bigest block\n");
+ printf("Memzone reserve with 0 size did not return biggest block\n");
printf("Expected size = %zu, actual size = %zu\n",
maxlen, mz->len);
rte_dump_physmem_layout(stdout);
if (mz->len < minlen || mz->len > maxlen) {
printf("Memzone reserve with 0 size and alignment %u did not return"
- " bigest block\n", align);
+ " biggest block\n", align);
printf("Expected size = %zu-%zu, actual size = %zu\n",
minlen, maxlen, mz->len);
rte_dump_physmem_layout(stdout);
if (mz != memzone1)
return -1;
- printf("test duplcate zone name\n");
+ printf("test duplicate zone name\n");
mz = rte_memzone_reserve(TEST_MEMZONE_NAME("testzone1"), 100,
SOCKET_ID_ANY, 0);
if (mz != NULL)
if (test_memzone_invalid_alignment() < 0)
return -1;
+ printf("test invalid flags for memzone_reserve\n");
+ if (test_memzone_invalid_flags() < 0)
+ return -1;
+
printf("test reserving the largest size memzone possible\n");
if (test_memzone_reserve_max() < 0)
return -1;