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

Function test_many_finalize_registrations

dpdk/app/test/test_dispatcher.c:997–1035  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

995#define MIN_FINALIZERS 16
996
997static int
998test_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
1037static struct unit_test_suite test_suite = {
1038 .suite_name = "Event dispatcher test suite",

Callers

nothing calls this directly

Tested by

no test coverage detected