* check if functions accept invalid parameters * * First, all functions will be called without initialized PIE * 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. */
| 981 | * don't do any parameter checking. |
| 982 | */ |
| 983 | static int |
| 984 | test_invalid_parameters(void) |
| 985 | { |
| 986 | struct rte_pie_config config; |
| 987 | static const char *shf_str = "rte_pie_config_init should have failed!"; |
| 988 | static const char *shf_rt_str = "rte_pie_rt_data_init should have failed!"; |
| 989 | |
| 990 | /* NULL config */ |
| 991 | if (rte_pie_rt_data_init(NULL) == 0) { |
| 992 | printf("%i: %s\n", __LINE__, shf_rt_str); |
| 993 | return -1; |
| 994 | } |
| 995 | |
| 996 | /* NULL config */ |
| 997 | if (rte_pie_config_init(NULL, 0, 0, 0, 0) == 0) { |
| 998 | printf("%i%s\n", __LINE__, shf_str); |
| 999 | return -1; |
| 1000 | } |
| 1001 | |
| 1002 | /* qdelay_ref <= 0 */ |
| 1003 | if (rte_pie_config_init(&config, 0, 1, 1, 1) == 0) { |
| 1004 | printf("%i%s\n", __LINE__, shf_str); |
| 1005 | return -1; |
| 1006 | } |
| 1007 | |
| 1008 | /* dp_update_interval <= 0 */ |
| 1009 | if (rte_pie_config_init(&config, 1, 0, 1, 1) == 0) { |
| 1010 | printf("%i%s\n", __LINE__, shf_str); |
| 1011 | return -1; |
| 1012 | } |
| 1013 | |
| 1014 | /* max_burst <= 0 */ |
| 1015 | if (rte_pie_config_init(&config, 1, 1, 0, 1) == 0) { |
| 1016 | printf("%i%s\n", __LINE__, shf_str); |
| 1017 | return -1; |
| 1018 | } |
| 1019 | |
| 1020 | /* tailq_th <= 0 */ |
| 1021 | if (rte_pie_config_init(&config, 1, 1, 1, 0) == 0) { |
| 1022 | printf("%i%s\n", __LINE__, shf_str); |
| 1023 | return -1; |
| 1024 | } |
| 1025 | |
| 1026 | RTE_SET_USED(config); |
| 1027 | |
| 1028 | return 0; |
| 1029 | } |
| 1030 | |
| 1031 | static void |
| 1032 | show_stats(const uint32_t num_tests, const uint32_t num_pass) |
no test coverage detected