| 464 | } |
| 465 | |
| 466 | static int |
| 467 | test_lookup_functions(void) |
| 468 | { |
| 469 | test_main_t *tm = &test_main; |
| 470 | int i; |
| 471 | |
| 472 | /* Verify the name with ID */ |
| 473 | for (i = 1; i < MAX_NODES; i++) { |
| 474 | char *name = rte_node_id_to_name(tm->test_node[i].idx); |
| 475 | if (strcmp(name, node_names[i]) != 0) { |
| 476 | printf("Test node name verify by ID = %d failed " |
| 477 | "Expected = %s, got %s\n", |
| 478 | i, node_names[i], name); |
| 479 | return -1; |
| 480 | } |
| 481 | } |
| 482 | |
| 483 | /* Verify by name */ |
| 484 | for (i = 1; i < MAX_NODES; i++) { |
| 485 | uint32_t idx = rte_node_from_name(node_names[i]); |
| 486 | if (idx != tm->test_node[i].idx) { |
| 487 | printf("Test node ID verify by name = %s failed " |
| 488 | "Expected = %d, got %d\n", |
| 489 | node_names[i], tm->test_node[i].idx, idx); |
| 490 | return -1; |
| 491 | } |
| 492 | } |
| 493 | |
| 494 | /* Verify edge count */ |
| 495 | for (i = 1; i < MAX_NODES; i++) { |
| 496 | uint32_t count = rte_node_edge_count(tm->test_node[i].idx); |
| 497 | if (count != tm->test_node[i].node.nb_edges) { |
| 498 | printf("Test number of edges for node = %s failed Expected = %d, got = %d\n", |
| 499 | tm->test_node[i].node.name, |
| 500 | tm->test_node[i].node.nb_edges, count); |
| 501 | return -1; |
| 502 | } |
| 503 | } |
| 504 | |
| 505 | /* Verify edge names */ |
| 506 | for (i = 1; i < MAX_NODES; i++) { |
| 507 | uint32_t j, count; |
| 508 | char **next_edges; |
| 509 | |
| 510 | count = rte_node_edge_get(tm->test_node[i].idx, NULL); |
| 511 | if (count != tm->test_node[i].node.nb_edges * sizeof(char *)) { |
| 512 | printf("Test number of edge count for node = %s failed Expected = %d, got = %d\n", |
| 513 | tm->test_node[i].node.name, |
| 514 | tm->test_node[i].node.nb_edges, count); |
| 515 | return -1; |
| 516 | } |
| 517 | next_edges = malloc(count); |
| 518 | count = rte_node_edge_get(tm->test_node[i].idx, next_edges); |
| 519 | if (count != tm->test_node[i].node.nb_edges) { |
| 520 | printf("Test number of edges for node = %s failed Expected = %d, got %d\n", |
| 521 | tm->test_node[i].node.name, |
| 522 | tm->test_node[i].node.nb_edges, count); |
| 523 | free(next_edges); |
nothing calls this directly
no test coverage detected