Message ID | 1426844062-554-1-git-send-email-ciprian.barbu@linaro.org |
---|---|
State | Accepted |
Commit | 6623389927c906a8ded99dead56c2ffc09a7cf7b |
Headers | show |
On 20 March 2015 at 05:34, Ciprian Barbu <ciprian.barbu@linaro.org> wrote: > With the implementation of termination APIs it is now necessarry to > cleanup all > allocated resources, queues and pool in this case. > Fixes https://bugs.linaro.org/show_bug.cgi?id=1284 > > Signed-off-by: Ciprian Barbu <ciprian.barbu@linaro.org> > Tested-and-reviewed-by: Mike Holmes <mike.holmes@linaro.org> > --- > v5: > - add return -1 in termination routine > v4: > - check return code of destroy_queues > test/validation/odp_schedule.c | 61 > ++++++++++++++++++++++++++++++++++++++++-- > 1 file changed, 59 insertions(+), 2 deletions(-) > > diff --git a/test/validation/odp_schedule.c > b/test/validation/odp_schedule.c > index a9369c5..efc7c8b 100644 > --- a/test/validation/odp_schedule.c > +++ b/test/validation/odp_schedule.c > @@ -624,7 +624,63 @@ static int schd_suite_init(void) > return 0; > } > > -struct CU_TestInfo test_odp_schedule[] = { > +static int destroy_queue(const char *name) > +{ > + odp_queue_t q; > + > + q = odp_queue_lookup(name); > + > + if (q == ODP_QUEUE_INVALID) > + return -1; > + > + return odp_queue_destroy(q); > +} > + > +static int destroy_queues(void) > +{ > + int i, j, prios; > + > + prios = odp_schedule_num_prio(); > + > + for (i = 0; i < prios; i++) { > + for (j = 0; j < QUEUES_PER_PRIO; j++) { > + char name[32]; > + > + snprintf(name, sizeof(name), "sched_%d_%d_n", i, > j); > + if (destroy_queue(name) != 0) > + return -1; > + > + snprintf(name, sizeof(name), "sched_%d_%d_a", i, > j); > + if (destroy_queue(name) != 0) > + return -1; > + > + snprintf(name, sizeof(name), "sched_%d_%d_o", i, > j); > + if (destroy_queue(name) != 0) > + return -1; > + } > + } > + > + return 0; > +} > + > +static int schd_suite_term(void) > +{ > + odp_pool_t pool; > + > + if (destroy_queues() != 0) { > + fprintf(stderr, "error: failed to destroy queues\n"); > + return -1; > + } > + > + pool = odp_pool_lookup(MSG_POOL_NAME); > + if (odp_pool_destroy(pool) != 0) { > + fprintf(stderr, "error: failed to destroy pool\n"); > + } > + > + return 0; > +} > + > +struct CU_TestInfo schd_tests[] = { > {"schedule_wait_time", test_schedule_wait_time}, > {"schedule_num_prio", test_schedule_num_prio}, > {"schedule_1q_1t_n", test_schedule_1q_1t_n}, > @@ -658,6 +714,7 @@ struct CU_TestInfo test_odp_schedule[] = { > }; > > CU_SuiteInfo odp_testsuites[] = { > - {"Scheduler", schd_suite_init, NULL, NULL, NULL, > test_odp_schedule}, > + {"Scheduler", > + schd_suite_init, schd_suite_term, NULL, NULL, schd_tests}, > CU_SUITE_INFO_NULL, > }; > -- > 1.8.3.2 > > > _______________________________________________ > lng-odp mailing list > lng-odp@lists.linaro.org > http://lists.linaro.org/mailman/listinfo/lng-odp >
Applied, Maxim. On 03/23/15 20:50, Mike Holmes wrote: > > > On 20 March 2015 at 05:34, Ciprian Barbu <ciprian.barbu@linaro.org > <mailto:ciprian.barbu@linaro.org>> wrote: > > With the implementation of termination APIs it is now necessarry > to cleanup all > allocated resources, queues and pool in this case. > Fixes https://bugs.linaro.org/show_bug.cgi?id=1284 > > Signed-off-by: Ciprian Barbu <ciprian.barbu@linaro.org > <mailto:ciprian.barbu@linaro.org>> > > > Tested-and-reviewed-by: Mike Holmes <mike.holmes@linaro.org > <mailto:mike.holmes@linaro.org>> > > --- > v5: > - add return -1 in termination routine > v4: > - check return code of destroy_queues > test/validation/odp_schedule.c | 61 > ++++++++++++++++++++++++++++++++++++++++-- > 1 file changed, 59 insertions(+), 2 deletions(-) > > diff --git a/test/validation/odp_schedule.c > b/test/validation/odp_schedule.c > index a9369c5..efc7c8b 100644 > --- a/test/validation/odp_schedule.c > +++ b/test/validation/odp_schedule.c > @@ -624,7 +624,63 @@ static int schd_suite_init(void) > return 0; > } > > -struct CU_TestInfo test_odp_schedule[] = { > +static int destroy_queue(const char *name) > +{ > + odp_queue_t q; > + > + q = odp_queue_lookup(name); > + > + if (q == ODP_QUEUE_INVALID) > + return -1; > + > + return odp_queue_destroy(q); > +} > + > +static int destroy_queues(void) > +{ > + int i, j, prios; > + > + prios = odp_schedule_num_prio(); > + > + for (i = 0; i < prios; i++) { > + for (j = 0; j < QUEUES_PER_PRIO; j++) { > + char name[32]; > + > + snprintf(name, sizeof(name), > "sched_%d_%d_n", i, j); > + if (destroy_queue(name) != 0) > + return -1; > + > + snprintf(name, sizeof(name), > "sched_%d_%d_a", i, j); > + if (destroy_queue(name) != 0) > + return -1; > + > + snprintf(name, sizeof(name), > "sched_%d_%d_o", i, j); > + if (destroy_queue(name) != 0) > + return -1; > + } > + } > + > + return 0; > +} > + > +static int schd_suite_term(void) > +{ > + odp_pool_t pool; > + > + if (destroy_queues() != 0) { > + fprintf(stderr, "error: failed to destroy queues\n"); > + return -1; > + } > + > + pool = odp_pool_lookup(MSG_POOL_NAME); > + if (odp_pool_destroy(pool) != 0) { > + fprintf(stderr, "error: failed to destroy pool\n"); > + } > + > + return 0; > +} > + > +struct CU_TestInfo schd_tests[] = { > {"schedule_wait_time", test_schedule_wait_time}, > {"schedule_num_prio", test_schedule_num_prio}, > {"schedule_1q_1t_n", test_schedule_1q_1t_n}, > @@ -658,6 +714,7 @@ struct CU_TestInfo test_odp_schedule[] = { > }; > > CU_SuiteInfo odp_testsuites[] = { > - {"Scheduler", schd_suite_init, NULL, NULL, NULL, > test_odp_schedule}, > + {"Scheduler", > + schd_suite_init, schd_suite_term, NULL, NULL, > schd_tests}, > CU_SUITE_INFO_NULL, > }; > -- > 1.8.3.2 > > > _______________________________________________ > lng-odp mailing list > lng-odp@lists.linaro.org <mailto:lng-odp@lists.linaro.org> > http://lists.linaro.org/mailman/listinfo/lng-odp > > > > > -- > Mike Holmes > Technical Manager - Linaro Networking Group > Linaro.org <http://www.linaro.org/>***│ *Open source software for ARM SoCs > > > > _______________________________________________ > lng-odp mailing list > lng-odp@lists.linaro.org > http://lists.linaro.org/mailman/listinfo/lng-odp
diff --git a/test/validation/odp_schedule.c b/test/validation/odp_schedule.c index a9369c5..efc7c8b 100644 --- a/test/validation/odp_schedule.c +++ b/test/validation/odp_schedule.c @@ -624,7 +624,63 @@ static int schd_suite_init(void) return 0; } -struct CU_TestInfo test_odp_schedule[] = { +static int destroy_queue(const char *name) +{ + odp_queue_t q; + + q = odp_queue_lookup(name); + + if (q == ODP_QUEUE_INVALID) + return -1; + + return odp_queue_destroy(q); +} + +static int destroy_queues(void) +{ + int i, j, prios; + + prios = odp_schedule_num_prio(); + + for (i = 0; i < prios; i++) { + for (j = 0; j < QUEUES_PER_PRIO; j++) { + char name[32]; + + snprintf(name, sizeof(name), "sched_%d_%d_n", i, j); + if (destroy_queue(name) != 0) + return -1; + + snprintf(name, sizeof(name), "sched_%d_%d_a", i, j); + if (destroy_queue(name) != 0) + return -1; + + snprintf(name, sizeof(name), "sched_%d_%d_o", i, j); + if (destroy_queue(name) != 0) + return -1; + } + } + + return 0; +} + +static int schd_suite_term(void) +{ + odp_pool_t pool; + + if (destroy_queues() != 0) { + fprintf(stderr, "error: failed to destroy queues\n"); + return -1; + } + + pool = odp_pool_lookup(MSG_POOL_NAME); + if (odp_pool_destroy(pool) != 0) { + fprintf(stderr, "error: failed to destroy pool\n"); + } + + return 0; +} + +struct CU_TestInfo schd_tests[] = { {"schedule_wait_time", test_schedule_wait_time}, {"schedule_num_prio", test_schedule_num_prio}, {"schedule_1q_1t_n", test_schedule_1q_1t_n}, @@ -658,6 +714,7 @@ struct CU_TestInfo test_odp_schedule[] = { }; CU_SuiteInfo odp_testsuites[] = { - {"Scheduler", schd_suite_init, NULL, NULL, NULL, test_odp_schedule}, + {"Scheduler", + schd_suite_init, schd_suite_term, NULL, NULL, schd_tests}, CU_SUITE_INFO_NULL, };
With the implementation of termination APIs it is now necessarry to cleanup all allocated resources, queues and pool in this case. Fixes https://bugs.linaro.org/show_bug.cgi?id=1284 Signed-off-by: Ciprian Barbu <ciprian.barbu@linaro.org> --- v5: - add return -1 in termination routine v4: - check return code of destroy_queues test/validation/odp_schedule.c | 61 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 59 insertions(+), 2 deletions(-)