4 * Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
11 * * Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * * Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in
15 * the documentation and/or other materials provided with the
17 * * Neither the name of Intel Corporation nor the names of its
18 * contributors may be used to endorse or promote products derived
19 * from this software without specific prior written permission.
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
40 #include <sys/queue.h>
42 #include <rte_common.h>
43 #include <rte_memory.h>
44 #include <rte_memzone.h>
45 #include <rte_per_lcore.h>
46 #include <rte_launch.h>
47 #include <rte_tailq.h>
49 #include <rte_per_lcore.h>
50 #include <rte_lcore.h>
51 #include <rte_malloc.h>
52 #include <rte_cycles.h>
53 #include <rte_random.h>
54 #include <rte_string_fns.h>
61 #define QUOTE(x) QUOTE_(x)
62 #define MALLOC_MEMZONE_SIZE QUOTE(RTE_MALLOC_MEMZONE_SIZE)
68 * Allocate some dynamic memory from heap (3 areas). Check that areas
69 * don't overlap and that alignment constraints match. This test is
70 * done many times on different lcores simultaneously.
73 /* Test if memory overlaps: return 1 if true, or 0 if false. */
75 is_memory_overlap(void *p1, size_t len1, void *p2, size_t len2)
77 unsigned long ptr1 = (unsigned long)p1;
78 unsigned long ptr2 = (unsigned long)p2;
80 if (ptr2 >= ptr1 && (ptr2 - ptr1) < len1)
82 else if (ptr2 < ptr1 && (ptr1 - ptr2) < len2)
88 is_aligned(void *p, int align)
90 unsigned long addr = (unsigned long)p;
91 unsigned mask = align - 1;
99 test_align_overlap_per_lcore(__attribute__((unused)) void *arg)
101 const unsigned align1 = 8,
105 void *p1 = NULL, *p2 = NULL, *p3 = NULL;
108 for (i = 0; i < N; i++) {
109 p1 = rte_zmalloc("dummy", 1000, align1);
111 printf("rte_zmalloc returned NULL (i=%u)\n", i);
115 for(j = 0; j < 1000 ; j++) {
116 if( *(char *)p1 != 0) {
117 printf("rte_zmalloc didn't zero"
118 "the allocated memory\n");
122 p2 = rte_malloc("dummy", 1000, align2);
124 printf("rte_malloc returned NULL (i=%u)\n", i);
129 p3 = rte_malloc("dummy", 1000, align3);
131 printf("rte_malloc returned NULL (i=%u)\n", i);
137 if (is_memory_overlap(p1, 1000, p2, 1000)) {
138 printf("p1 and p2 overlaps\n");
141 if (is_memory_overlap(p2, 1000, p3, 1000)) {
142 printf("p2 and p3 overlaps\n");
145 if (is_memory_overlap(p1, 1000, p3, 1000)) {
146 printf("p1 and p3 overlaps\n");
149 if (!is_aligned(p1, align1)) {
150 printf("p1 is not aligned\n");
153 if (!is_aligned(p2, align2)) {
154 printf("p2 is not aligned\n");
157 if (!is_aligned(p3, align3)) {
158 printf("p3 is not aligned\n");
165 rte_malloc_dump_stats(stdout, "dummy");
171 test_reordered_free_per_lcore(__attribute__((unused)) void *arg)
173 const unsigned align1 = 8,
180 for (i = 0; i < 30; i++) {
181 p1 = rte_zmalloc("dummy", 1000, align1);
183 printf("rte_zmalloc returned NULL (i=%u)\n", i);
187 for(j = 0; j < 1000 ; j++) {
188 if( *(char *)p1 != 0) {
189 printf("rte_zmalloc didn't zero"
190 "the allocated memory\n");
194 /* use calloc to allocate 1000 16-byte items this time */
195 p2 = rte_calloc("dummy", 1000, 16, align2);
196 /* for third request use regular malloc again */
197 p3 = rte_malloc("dummy", 1000, align3);
199 printf("rte_malloc returned NULL (i=%u)\n", i);
203 if (is_memory_overlap(p1, 1000, p2, 1000)) {
204 printf("p1 and p2 overlaps\n");
207 if (is_memory_overlap(p2, 1000, p3, 1000)) {
208 printf("p2 and p3 overlaps\n");
211 if (is_memory_overlap(p1, 1000, p3, 1000)) {
212 printf("p1 and p3 overlaps\n");
215 if (!is_aligned(p1, align1)) {
216 printf("p1 is not aligned\n");
219 if (!is_aligned(p2, align2)) {
220 printf("p2 is not aligned\n");
223 if (!is_aligned(p3, align3)) {
224 printf("p3 is not aligned\n");
227 /* try freeing in every possible order */
261 rte_malloc_dump_stats(stdout, "dummy");
266 /* test function inside the malloc lib*/
268 test_str_to_size(void)
274 {{ "5G", (uint64_t)5 * 1024 * 1024 *1024 },
275 {"0x20g", (uint64_t)0x20 * 1024 * 1024 *1024},
276 {"10M", 10 * 1024 * 1024},
277 {"050m", 050 * 1024 * 1024},
283 {"-1", 0}, /* negative values return 0 */
286 {"18446744073709551616", 0} /* ULLONG_MAX + 1 == out of range*/
289 for (i = 0; i < sizeof(test_values)/sizeof(test_values[0]); i++)
290 if (rte_str_to_size(test_values[i].str) != test_values[i].value)
299 struct rte_malloc_socket_stats pre_stats, post_stats;
300 size_t size =rte_str_to_size(MALLOC_MEMZONE_SIZE)*2;
302 #ifndef RTE_LIBRTE_MALLOC_DEBUG
303 int overhead = 64 + 64;
305 int overhead = 64 + 64 + 64;
308 rte_malloc_get_socket_stats(socket, &pre_stats);
310 void *p1 = rte_malloc_socket("BIG", size , align, socket);
313 rte_malloc_get_socket_stats(socket,&post_stats);
315 /* Check statistics reported are correct */
316 /* Allocation may increase, or may be the same as before big allocation */
317 if (post_stats.heap_totalsz_bytes < pre_stats.heap_totalsz_bytes) {
318 printf("Malloc statistics are incorrect - heap_totalsz_bytes\n");
321 /* Check that allocated size adds up correctly */
322 if (post_stats.heap_allocsz_bytes !=
323 pre_stats.heap_allocsz_bytes + size + align + overhead) {
324 printf("Malloc statistics are incorrect - alloc_size\n");
327 /* Check free size against tested allocated size */
328 if (post_stats.heap_freesz_bytes !=
329 post_stats.heap_totalsz_bytes - post_stats.heap_allocsz_bytes) {
330 printf("Malloc statistics are incorrect - heap_freesz_bytes\n");
333 /* Number of allocated blocks must increase after allocation */
334 if (post_stats.alloc_count != pre_stats.alloc_count + 1) {
335 printf("Malloc statistics are incorrect - alloc_count\n");
338 /* New blocks now available - just allocated 1 but also 1 new free */
339 if (post_stats.free_count != pre_stats.free_count &&
340 post_stats.free_count != pre_stats.free_count - 1) {
341 printf("Malloc statistics are incorrect - free_count\n");
350 test_multi_alloc_statistics(void)
353 struct rte_malloc_socket_stats pre_stats, post_stats ,first_stats, second_stats;
356 #ifndef RTE_LIBRTE_MALLOC_DEBUG
357 int trailer_size = 0;
359 int trailer_size = 64;
361 int overhead = 64 + trailer_size;
363 rte_malloc_get_socket_stats(socket, &pre_stats);
365 void *p1 = rte_malloc_socket("stats", size , align, socket);
369 rte_malloc_dump_stats(stdout, "stats");
371 rte_malloc_get_socket_stats(socket,&post_stats);
372 /* Check statistics reported are correct */
373 /* All post stats should be equal to pre stats after alloc freed */
374 if ((post_stats.heap_totalsz_bytes != pre_stats.heap_totalsz_bytes) &&
375 (post_stats.heap_freesz_bytes!=pre_stats.heap_freesz_bytes) &&
376 (post_stats.heap_allocsz_bytes!=pre_stats.heap_allocsz_bytes)&&
377 (post_stats.alloc_count!=pre_stats.alloc_count)&&
378 (post_stats.free_count!=pre_stats.free_count)) {
379 printf("Malloc statistics are incorrect - freed alloc\n");
382 /* Check two consecutive allocations */
385 rte_malloc_get_socket_stats(socket,&pre_stats);
386 void *p2 = rte_malloc_socket("add", size ,align, socket);
389 rte_malloc_get_socket_stats(socket,&first_stats);
391 void *p3 = rte_malloc_socket("add2", size,align, socket);
395 rte_malloc_get_socket_stats(socket,&second_stats);
400 /* After freeing both allocations check stats return to original */
401 rte_malloc_get_socket_stats(socket, &post_stats);
404 * Check that no new blocks added after small allocations
405 * i.e. < RTE_MALLOC_MEMZONE_SIZE
407 if(second_stats.heap_totalsz_bytes != first_stats.heap_totalsz_bytes) {
408 printf("Incorrect heap statistics: Total size \n");
411 /* Check allocated size is equal to two additions plus overhead */
412 if(second_stats.heap_allocsz_bytes !=
413 size + overhead + first_stats.heap_allocsz_bytes) {
414 printf("Incorrect heap statistics: Allocated size \n");
417 /* Check that allocation count increments correctly i.e. +1 */
418 if (second_stats.alloc_count != first_stats.alloc_count + 1) {
419 printf("Incorrect heap statistics: Allocated count \n");
423 if (second_stats.free_count != first_stats.free_count){
424 printf("Incorrect heap statistics: Free count \n");
428 /* Make sure that we didn't touch our greatest chunk: 2 * 11M) */
429 if (post_stats.greatest_free_size != pre_stats.greatest_free_size) {
430 printf("Incorrect heap statistics: Greatest free size \n");
433 /* Free size must equal the original free size minus the new allocation*/
434 if (first_stats.heap_freesz_bytes <= second_stats.heap_freesz_bytes) {
435 printf("Incorrect heap statistics: Free size \n");
439 if ((post_stats.heap_totalsz_bytes != pre_stats.heap_totalsz_bytes) &&
440 (post_stats.heap_freesz_bytes!=pre_stats.heap_freesz_bytes) &&
441 (post_stats.heap_allocsz_bytes!=pre_stats.heap_allocsz_bytes)&&
442 (post_stats.alloc_count!=pre_stats.alloc_count)&&
443 (post_stats.free_count!=pre_stats.free_count)) {
444 printf("Malloc statistics are incorrect - freed alloc\n");
451 test_memzone_size_alloc(void)
453 void *p1 = rte_malloc("BIG", (size_t)(rte_str_to_size(MALLOC_MEMZONE_SIZE) - 128), 64);
457 /* one extra check - check no crashes if free(NULL) */
463 test_rte_malloc_type_limits(void)
465 /* The type-limits functionality is not yet implemented,
466 * so always return 0 no matter what the retval.
468 const char *typename = "limit_test";
469 rte_malloc_set_limit(typename, 64 * 1024);
470 rte_malloc_dump_stats(stdout, typename);
477 const char hello_str[] = "Hello, world!";
478 const unsigned size1 = 1024;
479 const unsigned size2 = size1 + 1024;
480 const unsigned size3 = size2;
481 const unsigned size4 = size3 + 1024;
483 /* test data is the same even if element is moved*/
484 char *ptr1 = rte_zmalloc(NULL, size1, CACHE_LINE_SIZE);
486 printf("NULL pointer returned from rte_zmalloc\n");
489 snprintf(ptr1, size1, "%s" ,hello_str);
490 char *ptr2 = rte_realloc(ptr1, size2, CACHE_LINE_SIZE);
493 printf("NULL pointer returned from rte_realloc\n");
497 printf("unexpected - ptr1 == ptr2\n");
499 if (strcmp(ptr2, hello_str) != 0){
500 printf("Error - lost data from pointed area\n");
505 for (i = strnlen(hello_str, sizeof(hello_str)); i < size1; i++)
507 printf("Bad data in realloc\n");
511 /* now allocate third element, free the second
512 * and resize third. It should not move. (ptr1 is now invalid)
514 char *ptr3 = rte_zmalloc(NULL, size3, CACHE_LINE_SIZE);
516 printf("NULL pointer returned from rte_zmalloc\n");
520 for (i = 0; i < size3; i++)
522 printf("Bad data in zmalloc\n");
528 /* first resize to half the size of the freed block */
529 char *ptr4 = rte_realloc(ptr3, size4, CACHE_LINE_SIZE);
531 printf("NULL pointer returned from rte_realloc\n");
536 printf("Unexpected - ptr4 != ptr3\n");
540 /* now resize again to the full size of the freed block */
541 ptr4 = rte_realloc(ptr3, size3 + size2 + size1, CACHE_LINE_SIZE);
543 printf("Unexpected - ptr4 != ptr3 on second resize\n");
549 /* now try a resize to a smaller size, see if it works */
550 const unsigned size5 = 1024;
551 const unsigned size6 = size5 / 2;
552 char *ptr5 = rte_malloc(NULL, size5, CACHE_LINE_SIZE);
554 printf("NULL pointer returned from rte_malloc\n");
557 char *ptr6 = rte_realloc(ptr5, size6, CACHE_LINE_SIZE);
559 printf("NULL pointer returned from rte_realloc\n");
564 printf("Error, resizing to a smaller size moved data\n");
570 /* check for behaviour changing alignment */
571 const unsigned size7 = 1024;
572 const unsigned orig_align = CACHE_LINE_SIZE;
573 unsigned new_align = CACHE_LINE_SIZE * 2;
574 char *ptr7 = rte_malloc(NULL, size7, orig_align);
576 printf("NULL pointer returned from rte_malloc\n");
579 /* calc an alignment we don't already have */
580 while(RTE_PTR_ALIGN(ptr7, new_align) == ptr7)
582 char *ptr8 = rte_realloc(ptr7, size7, new_align);
584 printf("NULL pointer returned from rte_realloc\n");
588 if (RTE_PTR_ALIGN(ptr8, new_align) != ptr8){
589 printf("Failure to re-align data\n");
595 /* test behaviour when there is a free block after current one,
596 * but its not big enough
598 unsigned size9 = 1024, size10 = 1024;
599 unsigned size11 = size9 + size10 + 256;
600 char *ptr9 = rte_malloc(NULL, size9, CACHE_LINE_SIZE);
602 printf("NULL pointer returned from rte_malloc\n");
605 char *ptr10 = rte_malloc(NULL, size10, CACHE_LINE_SIZE);
607 printf("NULL pointer returned from rte_malloc\n");
611 char *ptr11 = rte_realloc(ptr10, size11, CACHE_LINE_SIZE);
613 printf("NULL pointer returned from rte_realloc\n");
618 printf("Error, unexpected that realloc has not created new buffer\n");
624 /* check we don't crash if we pass null to realloc
625 * We should get a malloc of the size requested*/
626 const size_t size12 = 1024;
628 char *ptr12 = rte_realloc(NULL, size12, CACHE_LINE_SIZE);
630 printf("NULL pointer returned from rte_realloc\n");
633 if (rte_malloc_validate(ptr12, &size12_check) < 0 ||
634 size12_check != size12){
643 test_random_alloc_free(void *_ __attribute__((unused)))
646 struct mem_list *next;
652 rte_srand((unsigned)rte_rdtsc());
654 for (i = 0; i < N; i++){
655 unsigned free_mem = 0;
656 size_t allocated_size;
658 const unsigned mem_size = sizeof(struct mem_list) + \
659 rte_rand() % (64 * 1024);
660 const unsigned align = 1 << (rte_rand() % 12); /* up to 4k alignment */
661 struct mem_list *entry = rte_malloc(NULL,
665 if (RTE_PTR_ALIGN(entry, align)!= entry)
667 if (rte_malloc_validate(entry, &allocated_size) == -1
668 || allocated_size < mem_size)
670 memset(entry->data, rte_lcore_id(),
671 mem_size - sizeof(*entry));
672 entry->next = list_head;
673 if (rte_malloc_validate(entry, NULL) == -1)
678 /* switch to freeing the memory with a 20% probability */
679 free_mem = ((rte_rand() % 10) >= 8);
682 struct mem_list *entry = list_head;
683 list_head = list_head->next;
687 printf("Lcore %u allocated/freed %u blocks\n", rte_lcore_id(), count);
691 #define err_return() do { \
692 printf("%s: %d - Error\n", __func__, __LINE__); \
697 test_rte_malloc_validate(void)
699 const size_t request_size = 1024;
700 size_t allocated_size;
701 char *data_ptr = rte_malloc(NULL, request_size, CACHE_LINE_SIZE);
702 #ifdef RTE_LIBRTE_MALLOC_DEBUG
704 char *over_write_vals = NULL;
707 if (data_ptr == NULL) {
708 printf("%s: %d - Allocation error\n", __func__, __LINE__);
712 /* check that a null input returns -1 */
713 if (rte_malloc_validate(NULL, NULL) != -1)
716 /* check that we get ok on a valid pointer */
717 if (rte_malloc_validate(data_ptr, &allocated_size) < 0)
720 /* check that the returned size is ok */
721 if (allocated_size < request_size)
724 #ifdef RTE_LIBRTE_MALLOC_DEBUG
726 /****** change the header to be bad */
728 over_write_vals = (char *)((uintptr_t)data_ptr - sizeof(save_buf));
729 /* first save the data as a backup before overwriting it */
730 memcpy(save_buf, over_write_vals, sizeof(save_buf));
731 memset(over_write_vals, 1, sizeof(save_buf));
732 /* then run validate */
733 retval = rte_malloc_validate(data_ptr, NULL);
734 /* finally restore the data again */
735 memcpy(over_write_vals, save_buf, sizeof(save_buf));
736 /* check we previously had an error */
740 /* check all ok again */
741 if (rte_malloc_validate(data_ptr, &allocated_size) < 0)
744 /**** change the trailer to be bad */
745 over_write_vals = (char *)((uintptr_t)data_ptr + allocated_size);
746 /* first save the data as a backup before overwriting it */
747 memcpy(save_buf, over_write_vals, sizeof(save_buf));
748 memset(over_write_vals, 1, sizeof(save_buf));
749 /* then run validate */
750 retval = rte_malloc_validate(data_ptr, NULL);
751 /* finally restore the data again */
752 memcpy(over_write_vals, save_buf, sizeof(save_buf));
756 /* check all ok again */
757 if (rte_malloc_validate(data_ptr, &allocated_size) < 0)
771 test_zero_aligned_alloc(void)
773 char *p1 = rte_malloc(NULL,1024, 0);
776 if (!rte_is_aligned(p1, CACHE_LINE_SIZE))
783 if (p1) rte_free(p1);
788 test_malloc_bad_params(void)
790 const char *type = NULL;
792 unsigned align = CACHE_LINE_SIZE;
794 /* rte_malloc expected to return null with inappropriate size */
795 char *bad_ptr = rte_malloc(type, size, align);
799 /* rte_malloc expected to return null with inappropriate alignment */
803 bad_ptr = rte_malloc(type, size, align);
810 /* clean up pointer */
816 /* Check if memory is avilable on a specific socket */
818 is_mem_on_socket(int32_t socket)
820 const struct rte_memseg *ms = rte_eal_get_physmem_layout();
823 for (i = 0; i < RTE_MAX_MEMSEG; i++) {
824 if (socket == ms[i].socket_id)
831 * Find what socket a memory address is on. Only works for addresses within
832 * memsegs, not heap or stack...
835 addr_to_socket(void * addr)
837 const struct rte_memseg *ms = rte_eal_get_physmem_layout();
840 for (i = 0; i < RTE_MAX_MEMSEG; i++) {
841 if ((ms[i].addr <= addr) &&
843 ((uintptr_t)ms[i].addr + (uintptr_t)ms[i].len)))
844 return ms[i].socket_id;
849 /* Test using rte_[c|m|zm]alloc_socket() on a specific socket */
851 test_alloc_single_socket(int32_t socket)
853 const char *type = NULL;
854 const size_t size = 10;
855 const unsigned align = 0;
857 int32_t desired_socket = (socket == SOCKET_ID_ANY) ?
858 (int32_t)rte_socket_id() : socket;
860 /* Test rte_calloc_socket() */
861 mem = rte_calloc_socket(type, size, sizeof(char), align, socket);
864 if (addr_to_socket(mem) != desired_socket) {
870 /* Test rte_malloc_socket() */
871 mem = rte_malloc_socket(type, size, align, socket);
874 if (addr_to_socket(mem) != desired_socket) {
879 /* Test rte_zmalloc_socket() */
880 mem = rte_zmalloc_socket(type, size, align, socket);
883 if (addr_to_socket(mem) != desired_socket) {
893 test_alloc_socket(void)
895 unsigned socket_count = 0;
898 if (test_alloc_single_socket(SOCKET_ID_ANY) < 0)
901 for (i = 0; i < RTE_MAX_NUMA_NODES; i++) {
902 if (is_mem_on_socket(i)) {
904 if (test_alloc_single_socket(i) < 0) {
905 printf("Fail: rte_malloc_socket(..., %u) did not succeed\n",
911 if (test_alloc_single_socket(i) == 0) {
912 printf("Fail: rte_malloc_socket(..., %u) succeeded\n",
919 /* Print warnign if only a single socket, but don't fail the test */
920 if (socket_count < 2) {
921 printf("WARNING: alloc_socket test needs memory on multiple sockets!\n");
933 if (test_str_to_size() < 0){
934 printf("test_str_to_size() failed\n");
937 else printf("test_str_to_size() passed\n");
939 if (test_memzone_size_alloc() < 0){
940 printf("test_memzone_size_alloc() failed\n");
943 else printf("test_memzone_size_alloc() passed\n");
945 if (test_big_alloc() < 0){
946 printf("test_big_alloc() failed\n");
949 else printf("test_big_alloc() passed\n");
951 if (test_zero_aligned_alloc() < 0){
952 printf("test_zero_aligned_alloc() failed\n");
955 else printf("test_zero_aligned_alloc() passed\n");
957 if (test_malloc_bad_params() < 0){
958 printf("test_malloc_bad_params() failed\n");
961 else printf("test_malloc_bad_params() passed\n");
963 if (test_realloc() < 0){
964 printf("test_realloc() failed\n");
967 else printf("test_realloc() passed\n");
969 /*----------------------------*/
970 RTE_LCORE_FOREACH_SLAVE(lcore_id) {
971 rte_eal_remote_launch(test_align_overlap_per_lcore, NULL, lcore_id);
974 RTE_LCORE_FOREACH_SLAVE(lcore_id) {
975 if (rte_eal_wait_lcore(lcore_id) < 0)
979 printf("test_align_overlap_per_lcore() failed\n");
982 else printf("test_align_overlap_per_lcore() passed\n");
984 /*----------------------------*/
985 RTE_LCORE_FOREACH_SLAVE(lcore_id) {
986 rte_eal_remote_launch(test_reordered_free_per_lcore, NULL, lcore_id);
989 RTE_LCORE_FOREACH_SLAVE(lcore_id) {
990 if (rte_eal_wait_lcore(lcore_id) < 0)
994 printf("test_reordered_free_per_lcore() failed\n");
997 else printf("test_reordered_free_per_lcore() passed\n");
999 /*----------------------------*/
1000 RTE_LCORE_FOREACH_SLAVE(lcore_id) {
1001 rte_eal_remote_launch(test_random_alloc_free, NULL, lcore_id);
1004 RTE_LCORE_FOREACH_SLAVE(lcore_id) {
1005 if (rte_eal_wait_lcore(lcore_id) < 0)
1009 printf("test_random_alloc_free() failed\n");
1012 else printf("test_random_alloc_free() passed\n");
1014 /*----------------------------*/
1015 ret = test_rte_malloc_type_limits();
1017 printf("test_rte_malloc_type_limits() failed\n");
1020 /* TODO: uncomment following line once type limits are valid */
1021 /*else printf("test_rte_malloc_type_limits() passed\n");*/
1023 /*----------------------------*/
1024 ret = test_rte_malloc_validate();
1026 printf("test_rte_malloc_validate() failed\n");
1029 else printf("test_rte_malloc_validate() passed\n");
1031 ret = test_alloc_socket();
1033 printf("test_alloc_socket() failed\n");
1036 else printf("test_alloc_socket() passed\n");
1038 ret = test_multi_alloc_statistics();
1040 printf("test_multi_alloc_statistics() failed\n");
1044 printf("test_multi_alloc_statistics() passed\n");