| 1561 | } |
| 1562 | |
| 1563 | static int |
| 1564 | test_mode4_executor(int (*test_func)(void)) |
| 1565 | { |
| 1566 | struct member_conf *port; |
| 1567 | int test_result; |
| 1568 | uint8_t i; |
| 1569 | void *pkt; |
| 1570 | |
| 1571 | /* Check if environment is clean. Fail to launch a test if there was |
| 1572 | * a critical error before that prevented to reset environment. */ |
| 1573 | TEST_ASSERT_SUCCESS(check_environment(), |
| 1574 | "Refusing to launch test in dirty environment."); |
| 1575 | |
| 1576 | RTE_VERIFY(test_func != NULL); |
| 1577 | test_result = (*test_func)(); |
| 1578 | |
| 1579 | /* If test succeed check if environment wast left in good condition. */ |
| 1580 | if (test_result == TEST_SUCCESS) |
| 1581 | test_result = check_environment(); |
| 1582 | |
| 1583 | /* Reset environment in case test failed to do that. */ |
| 1584 | if (test_result != TEST_SUCCESS) { |
| 1585 | TEST_ASSERT_SUCCESS(remove_members_and_stop_bonding_device(), |
| 1586 | "Failed to stop bonding device"); |
| 1587 | |
| 1588 | FOR_EACH_PORT(i, port) { |
| 1589 | while (rte_ring_count(port->rx_queue) != 0) { |
| 1590 | if (rte_ring_dequeue(port->rx_queue, &pkt) == 0) |
| 1591 | rte_pktmbuf_free(pkt); |
| 1592 | } |
| 1593 | |
| 1594 | while (rte_ring_count(port->tx_queue) != 0) { |
| 1595 | if (rte_ring_dequeue(port->tx_queue, &pkt) == 0) |
| 1596 | rte_pktmbuf_free(pkt); |
| 1597 | } |
| 1598 | } |
| 1599 | } |
| 1600 | |
| 1601 | return test_result; |
| 1602 | } |
| 1603 | |
| 1604 | static int |
| 1605 | test_mode4_agg_mode_selection_wrapper(void){ |
no test coverage detected