* check if functions accept invalid parameters * * First, all functions will be called without initialized RED * Then, all of them will be called with NULL/invalid parameters * * Some functions are not tested as they are performance-critical and thus * don't do any parameter checking. */
| 1757 | * don't do any parameter checking. |
| 1758 | */ |
| 1759 | static int |
| 1760 | test_invalid_parameters(void) |
| 1761 | { |
| 1762 | struct rte_red_config config; |
| 1763 | |
| 1764 | if (rte_red_rt_data_init(NULL) == 0) { |
| 1765 | printf("rte_red_rt_data_init should have failed!\n"); |
| 1766 | return -1; |
| 1767 | } |
| 1768 | |
| 1769 | if (rte_red_config_init(NULL, 0, 0, 0, 0) == 0) { |
| 1770 | printf("rte_red_config_init should have failed!\n"); |
| 1771 | return -1; |
| 1772 | } |
| 1773 | |
| 1774 | if (rte_red_rt_data_init(NULL) == 0) { |
| 1775 | printf("rte_red_rt_data_init should have failed!\n"); |
| 1776 | return -1; |
| 1777 | } |
| 1778 | |
| 1779 | /* NULL config */ |
| 1780 | if (rte_red_config_init(NULL, 0, 0, 0, 0) == 0) { |
| 1781 | printf("%i: rte_red_config_init should have failed!\n", __LINE__); |
| 1782 | return -1; |
| 1783 | } |
| 1784 | /* min_threshold == max_threshold */ |
| 1785 | if (rte_red_config_init(&config, 0, 1, 1, 0) == 0) { |
| 1786 | printf("%i: rte_red_config_init should have failed!\n", __LINE__); |
| 1787 | return -1; |
| 1788 | } |
| 1789 | /* min_threshold > max_threshold */ |
| 1790 | if (rte_red_config_init(&config, 0, 2, 1, 0) == 0) { |
| 1791 | printf("%i: rte_red_config_init should have failed!\n", __LINE__); |
| 1792 | return -1; |
| 1793 | } |
| 1794 | /* wq_log2 > RTE_RED_WQ_LOG2_MAX */ |
| 1795 | if (rte_red_config_init(&config, |
| 1796 | RTE_RED_WQ_LOG2_MAX + 1, 1, 2, 0) == 0) { |
| 1797 | printf("%i: rte_red_config_init should have failed!\n", __LINE__); |
| 1798 | return -1; |
| 1799 | } |
| 1800 | /* wq_log2 < RTE_RED_WQ_LOG2_MIN */ |
| 1801 | if (rte_red_config_init(&config, |
| 1802 | RTE_RED_WQ_LOG2_MIN - 1, 1, 2, 0) == 0) { |
| 1803 | printf("%i: rte_red_config_init should have failed!\n", __LINE__); |
| 1804 | return -1; |
| 1805 | } |
| 1806 | /* maxp_inv > RTE_RED_MAXP_INV_MAX */ |
| 1807 | if (rte_red_config_init(&config, |
| 1808 | RTE_RED_WQ_LOG2_MIN, 1, 2, RTE_RED_MAXP_INV_MAX + 1) == 0) { |
| 1809 | printf("%i: rte_red_config_init should have failed!\n", __LINE__); |
| 1810 | return -1; |
| 1811 | } |
| 1812 | /* maxp_inv < RTE_RED_MAXP_INV_MIN */ |
| 1813 | if (rte_red_config_init(&config, |
| 1814 | RTE_RED_WQ_LOG2_MIN, 1, 2, RTE_RED_MAXP_INV_MIN - 1) == 0) { |
| 1815 | printf("%i: rte_red_config_init should have failed!\n", __LINE__); |
| 1816 | return -1; |
no test coverage detected