MCPcopy Create free account
hub / github.com/F-Stack/f-stack / test_alloc_socket

Function test_alloc_socket

dpdk/app/test/test_malloc.c:1009–1042  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1007}
1008
1009static int
1010test_alloc_socket(void)
1011{
1012 unsigned socket_count = 0;
1013 unsigned i;
1014
1015 if (test_alloc_single_socket(SOCKET_ID_ANY) < 0)
1016 return -1;
1017
1018 for (i = 0; i < RTE_MAX_NUMA_NODES; i++) {
1019 if (is_mem_on_socket(i)) {
1020 socket_count++;
1021 if (test_alloc_single_socket(i) < 0) {
1022 printf("Fail: rte_malloc_socket(..., %u) did not succeed\n",
1023 i);
1024 return -1;
1025 }
1026 }
1027 else {
1028 if (test_alloc_single_socket(i) == 0) {
1029 printf("Fail: rte_malloc_socket(..., %u) succeeded\n",
1030 i);
1031 return -1;
1032 }
1033 }
1034 }
1035
1036 /* Print warning if only a single socket, but don't fail the test */
1037 if (socket_count < 2) {
1038 printf("WARNING: alloc_socket test needs memory on multiple sockets!\n");
1039 }
1040
1041 return 0;
1042}
1043
1044static int
1045test_malloc(void)

Callers 1

test_mallocFunction · 0.85

Calls 3

test_alloc_single_socketFunction · 0.85
is_mem_on_socketFunction · 0.85
printfFunction · 0.50

Tested by

no test coverage detected