MCPcopy Create free account
hub / github.com/F-Stack/f-stack / test_many_handler_registrations

Function test_many_handler_registrations

dpdk/app/test/test_dispatcher.c:949–985  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

947#define MIN_HANDLERS 32
948
949static int
950test_many_handler_registrations(void)
951{
952 int rc;
953 int num_regs = 0;
954 int reg_ids[MORE_THAN_MAX_HANDLERS];
955 int reg_id;
956 int i;
957
958 rc = test_app_unregister_callbacks(test_app);
959 if (rc != TEST_SUCCESS)
960 return rc;
961
962 for (i = 0; i < MORE_THAN_MAX_HANDLERS; i++) {
963 reg_id = rte_dispatcher_register(test_app->dispatcher,
964 never_match, NULL,
965 test_app_never_process, NULL);
966 if (reg_id < 0)
967 break;
968
969 reg_ids[num_regs++] = reg_id;
970 }
971
972 TEST_ASSERT_EQUAL(reg_id, -ENOMEM, "Incorrect return code. Expected "
973 "%d but was %d", -ENOMEM, reg_id);
974 TEST_ASSERT(num_regs >= MIN_HANDLERS, "Registration failed already "
975 "after %d handler registrations.", num_regs);
976
977 for (i = 0; i < num_regs; i++) {
978 rc = rte_dispatcher_unregister(test_app->dispatcher,
979 reg_ids[i]);
980 TEST_ASSERT_SUCCESS(rc, "Unable to unregister handler %d",
981 reg_ids[i]);
982 }
983
984 return TEST_SUCCESS;
985}
986
987static void
988dummy_finalize(uint8_t event_dev_id __rte_unused,

Callers

nothing calls this directly

Calls 3

rte_dispatcher_registerFunction · 0.85

Tested by

no test coverage detected