| 995 | #define MIN_FINALIZERS 16 |
| 996 | |
| 997 | static int |
| 998 | test_many_finalize_registrations(void) |
| 999 | { |
| 1000 | int rc; |
| 1001 | int num_regs = 0; |
| 1002 | int reg_ids[MORE_THAN_MAX_FINALIZERS]; |
| 1003 | int reg_id; |
| 1004 | int i; |
| 1005 | |
| 1006 | rc = test_app_unregister_callbacks(test_app); |
| 1007 | if (rc != TEST_SUCCESS) |
| 1008 | return rc; |
| 1009 | |
| 1010 | for (i = 0; i < MORE_THAN_MAX_FINALIZERS; i++) { |
| 1011 | reg_id = rte_dispatcher_finalize_register( |
| 1012 | test_app->dispatcher, dummy_finalize, NULL |
| 1013 | ); |
| 1014 | |
| 1015 | if (reg_id < 0) |
| 1016 | break; |
| 1017 | |
| 1018 | reg_ids[num_regs++] = reg_id; |
| 1019 | } |
| 1020 | |
| 1021 | TEST_ASSERT_EQUAL(reg_id, -ENOMEM, "Incorrect return code. Expected " |
| 1022 | "%d but was %d", -ENOMEM, reg_id); |
| 1023 | TEST_ASSERT(num_regs >= MIN_FINALIZERS, "Finalize registration failed " |
| 1024 | "already after %d registrations.", num_regs); |
| 1025 | |
| 1026 | for (i = 0; i < num_regs; i++) { |
| 1027 | rc = rte_dispatcher_finalize_unregister( |
| 1028 | test_app->dispatcher, reg_ids[i] |
| 1029 | ); |
| 1030 | TEST_ASSERT_SUCCESS(rc, "Unable to unregister finalizer %d", |
| 1031 | reg_ids[i]); |
| 1032 | } |
| 1033 | |
| 1034 | return TEST_SUCCESS; |
| 1035 | } |
| 1036 | |
| 1037 | static struct unit_test_suite test_suite = { |
| 1038 | .suite_name = "Event dispatcher test suite", |
nothing calls this directly
no test coverage detected