* Tests for rte_intr_enable(). */
| 252 | * Tests for rte_intr_enable(). |
| 253 | */ |
| 254 | static int |
| 255 | test_interrupt_enable(void) |
| 256 | { |
| 257 | struct rte_intr_handle *test_intr_handle; |
| 258 | |
| 259 | /* check with null intr_handle */ |
| 260 | if (rte_intr_enable(NULL) == 0) { |
| 261 | printf("unexpectedly enable null intr_handle successfully\n"); |
| 262 | return -1; |
| 263 | } |
| 264 | |
| 265 | /* check with invalid intr_handle */ |
| 266 | test_intr_handle = intr_handles[TEST_INTERRUPT_HANDLE_INVALID]; |
| 267 | if (rte_intr_enable(test_intr_handle) == 0) { |
| 268 | printf("unexpectedly enable invalid intr_handle " |
| 269 | "successfully\n"); |
| 270 | return -1; |
| 271 | } |
| 272 | |
| 273 | /* check with valid intr_handle */ |
| 274 | test_intr_handle = intr_handles[TEST_INTERRUPT_HANDLE_VALID]; |
| 275 | if (rte_intr_enable(test_intr_handle) == 0) { |
| 276 | printf("unexpectedly enable a specific intr_handle " |
| 277 | "successfully\n"); |
| 278 | return -1; |
| 279 | } |
| 280 | |
| 281 | /* check with specific valid intr_handle */ |
| 282 | test_intr_handle = intr_handles[TEST_INTERRUPT_HANDLE_VALID_ALARM]; |
| 283 | if (rte_intr_enable(test_intr_handle) == 0) { |
| 284 | printf("unexpectedly enable a specific intr_handle " |
| 285 | "successfully\n"); |
| 286 | return -1; |
| 287 | } |
| 288 | |
| 289 | /* check with specific valid intr_handle */ |
| 290 | test_intr_handle = intr_handles[TEST_INTERRUPT_HANDLE_VALID_DEV_EVENT]; |
| 291 | if (rte_intr_enable(test_intr_handle) == 0) { |
| 292 | printf("unexpectedly enable a specific intr_handle " |
| 293 | "successfully\n"); |
| 294 | return -1; |
| 295 | } |
| 296 | |
| 297 | /* check with valid handler and its type */ |
| 298 | test_intr_handle = intr_handles[TEST_INTERRUPT_HANDLE_CASE1]; |
| 299 | if (rte_intr_enable(test_intr_handle) < 0) { |
| 300 | printf("fail to enable interrupt on a simulated handler\n"); |
| 301 | return -1; |
| 302 | } |
| 303 | |
| 304 | test_intr_handle = intr_handles[TEST_INTERRUPT_HANDLE_VALID_UIO]; |
| 305 | if (rte_intr_enable(test_intr_handle) == 0) { |
| 306 | printf("unexpectedly enable a specific intr_handle " |
| 307 | "successfully\n"); |
| 308 | return -1; |
| 309 | } |
| 310 | |
| 311 | return 0; |
no test coverage detected