| 627 | } |
| 628 | |
| 629 | static int |
| 630 | test_realloc_numa(void) |
| 631 | { |
| 632 | /* check realloc_socket part */ |
| 633 | int32_t socket_count = 0, socket_allocated, socket; |
| 634 | void *ptr1, *ptr2; |
| 635 | int ret = -1; |
| 636 | size_t size = 1024; |
| 637 | |
| 638 | ptr1 = NULL; |
| 639 | for (socket = 0; socket < RTE_MAX_NUMA_NODES; socket++) { |
| 640 | if (is_mem_on_socket(socket)) { |
| 641 | int j = 2; |
| 642 | |
| 643 | socket_count++; |
| 644 | while (j--) { |
| 645 | /* j == 1 -> resizing */ |
| 646 | ptr2 = rte_realloc_socket(ptr1, size, |
| 647 | RTE_CACHE_LINE_SIZE, |
| 648 | socket); |
| 649 | if (ptr2 == NULL) { |
| 650 | printf("NULL pointer returned from rte_realloc_socket\n"); |
| 651 | goto end; |
| 652 | } |
| 653 | |
| 654 | ptr1 = ptr2; |
| 655 | socket_allocated = addr_to_socket(ptr2); |
| 656 | if (socket_allocated != socket) { |
| 657 | printf("Requested socket (%d) doesn't mach allocated one (%d)\n", |
| 658 | socket, socket_allocated); |
| 659 | goto end; |
| 660 | } |
| 661 | size += RTE_CACHE_LINE_SIZE; |
| 662 | } |
| 663 | } |
| 664 | } |
| 665 | |
| 666 | /* Print warning if only a single socket, but don't fail the test */ |
| 667 | if (socket_count < 2) |
| 668 | printf("WARNING: realloc_socket test needs memory on multiple sockets!\n"); |
| 669 | |
| 670 | ret = 0; |
| 671 | end: |
| 672 | rte_free(ptr1); |
| 673 | return ret; |
| 674 | } |
| 675 | |
| 676 | static int |
| 677 | test_realloc(void) |
no test coverage detected