X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=app%2Ftest%2Ftest_memzone.c;h=c9255e576324e6d0e22157ca3ff527d9bea3d45e;hb=42902e810d34038754535cd0883e3621d16f34ae;hp=4d874445573ecfed1de90e1c988a69caa03bc38c;hpb=ab35397e7aea3db87a25249f8506105af4fbcafa;p=dpdk.git diff --git a/app/test/test_memzone.c b/app/test/test_memzone.c index 4d87444557..c9255e5763 100644 --- a/app/test/test_memzone.c +++ b/app/test/test_memzone.c @@ -18,7 +18,8 @@ #include #include #include -#include "../../lib/librte_eal/common/malloc_elem.h" + +#include "malloc_elem.h" #include "test.h" @@ -81,6 +82,26 @@ test_memzone_invalid_alignment(void) 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) { @@ -475,7 +496,8 @@ find_max_block_free_size(unsigned int align, unsigned int socket_id) struct rte_malloc_socket_stats stats; size_t len, overhead; - rte_malloc_get_socket_stats(socket_id, &stats); + if (rte_malloc_get_socket_stats(socket_id, &stats) < 0) + return 0; len = stats.greatest_free_size; overhead = MALLOC_ELEM_OVERHEAD; @@ -521,7 +543,7 @@ test_memzone_reserve_max(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); @@ -584,7 +606,7 @@ test_memzone_reserve_max_aligned(void) 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); @@ -1032,7 +1054,7 @@ test_memzone_basic(void) 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) @@ -1104,6 +1126,10 @@ test_memzone(void) 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;