* Check the full path of a specified type of interrupt simulated. */
| 379 | * Check the full path of a specified type of interrupt simulated. |
| 380 | */ |
| 381 | static int |
| 382 | test_interrupt_full_path_check(enum test_interrupt_handle_type intr_type) |
| 383 | { |
| 384 | int count; |
| 385 | struct rte_intr_handle *test_intr_handle; |
| 386 | |
| 387 | flag = 0; |
| 388 | test_intr_handle = intr_handles[intr_type]; |
| 389 | test_intr_type = intr_type; |
| 390 | if (rte_intr_callback_register(test_intr_handle, |
| 391 | test_interrupt_callback, test_intr_handle) < 0) { |
| 392 | printf("fail to register callback\n"); |
| 393 | return -1; |
| 394 | } |
| 395 | |
| 396 | if (test_interrupt_trigger_interrupt() < 0) |
| 397 | return -1; |
| 398 | |
| 399 | /* check flag */ |
| 400 | for (count = 0; flag == 0 && count < 3; count++) |
| 401 | rte_delay_ms(TEST_INTERRUPT_CHECK_INTERVAL); |
| 402 | |
| 403 | rte_delay_ms(TEST_INTERRUPT_CHECK_INTERVAL); |
| 404 | while ((count = |
| 405 | rte_intr_callback_unregister(test_intr_handle, |
| 406 | test_interrupt_callback, |
| 407 | test_intr_handle)) < 0) { |
| 408 | if (count != -EAGAIN) |
| 409 | return -1; |
| 410 | } |
| 411 | |
| 412 | if (flag == 0) { |
| 413 | printf("callback has not been called\n"); |
| 414 | return -1; |
| 415 | } else if (flag < 0) { |
| 416 | printf("it has internal error in callback\n"); |
| 417 | return -1; |
| 418 | } |
| 419 | |
| 420 | return 0; |
| 421 | } |
| 422 | |
| 423 | /** |
| 424 | * Main function of testing interrupt. |
no test coverage detected