Message ID | 1436548133-10426-1-git-send-email-mike.holmes@linaro.org |
---|---|
State | Accepted |
Commit | 9ce4c3abbcf10d13f17e43db9fa0346698e32bc5 |
Headers | show |
On Fri, Jul 10, 2015 at 12:08 PM, Mike Holmes <mike.holmes@linaro.org> wrote: > Signed-off-by: Mike Holmes <mike.holmes@linaro.org> > Reviewed-and-Tested-by: Bill Fischofer <bill.fischofer@linaro.org> > --- > test/validation/cpumask/cpumask.c | 57 > +++++++++++++++++++++++++++++++++++++++ > 1 file changed, 57 insertions(+) > > diff --git a/test/validation/cpumask/cpumask.c > b/test/validation/cpumask/cpumask.c > index 943a8e0..b8a47b9 100644 > --- a/test/validation/cpumask/cpumask.c > +++ b/test/validation/cpumask/cpumask.c > @@ -30,6 +30,9 @@ > /* padding pattern used to check buffer overflow: */ > #define FILLING_PATTERN 0x55 > > +/* default worker paramiter to get all that may be available */ > +#define ALL_AVAILABLE 0 > + > /* > * returns the length of a string, excluding terminating NULL. > * As its C lib strlen equivalent. Just rewritten here to avoid C lib > @@ -456,6 +459,56 @@ static void cpumask_test_odp_cpumask_next(void) > CU_ASSERT(odp_cpumask_next(&mask1, i) == expected[i]); > } > > +static void cpumask_test_odp_cpumask_setall(void) > +{ > + int num_cpus; > + int max_cpus = get_max_number_of_cpus_in_a_mask(); > + odp_cpumask_t mask; > + > + odp_cpumask_setall(&mask); > + num_cpus = odp_cpumask_count(&mask); > + > + CU_ASSERT(num_cpus > 0); > + CU_ASSERT(num_cpus >= max_cpus); > +} > + > +static void cpumask_test_odp_cpumask_def_control(void) > +{ > + int num; > + int max_cpus = get_max_number_of_cpus_in_a_mask(); > + odp_cpumask_t mask; > + > + num = odp_cpumask_def_control(&mask, ALL_AVAILABLE); > + > + CU_ASSERT(num >= 0); > + CU_ASSERT(num <= max_cpus); > +} > + > +static void cpumask_test_odp_cpumask_def_worker(void) > +{ > + int num; > + int max_cpus = get_max_number_of_cpus_in_a_mask(); > + odp_cpumask_t mask; > + > + num = odp_cpumask_def_worker(&mask, ALL_AVAILABLE); > + > + CU_ASSERT(num >= 0); > + CU_ASSERT(num <= max_cpus); > +} > + > +static void cpumask_test_odp_cpumask_def(void) > +{ > + int num_worker; > + int num_control; > + int max_cpus = get_max_number_of_cpus_in_a_mask(); > + odp_cpumask_t mask; > + > + num_worker = odp_cpumask_def_worker(&mask, max_cpus - 1); > + num_control = odp_cpumask_def_worker(&mask, 1); > + > + CU_ASSERT((num_control + num_worker) == max_cpus); > +} > + > static CU_TestInfo cpumask_suite[] = { > {"odp_cpumask_to/from_str()", > cpumask_test_odp_cpumask_to_from_str}, > {"odp_cpumask_equal()", cpumask_test_odp_cpumask_equal}, > @@ -471,6 +524,10 @@ static CU_TestInfo cpumask_suite[] = { > {"odp_cpumask_first()", cpumask_test_odp_cpumask_first}, > {"odp_cpumask_last()", cpumask_test_odp_cpumask_last}, > {"odp_cpumask_next()", cpumask_test_odp_cpumask_next}, > + {"odp_cpumask_setall()", cpumask_test_odp_cpumask_setall}, > + {"odp_cpumask_def_control()", > cpumask_test_odp_cpumask_def_control}, > + {"odp_cpumask_def_worker()", cpumask_test_odp_cpumask_def_worker}, > + {"odp_cpumask_def()", cpumask_test_odp_cpumask_def}, > CU_TEST_INFO_NULL, > }; > > -- > 2.1.4 > > _______________________________________________ > lng-odp mailing list > lng-odp@lists.linaro.org > https://lists.linaro.org/mailman/listinfo/lng-odp >
diff --git a/test/validation/cpumask/cpumask.c b/test/validation/cpumask/cpumask.c index 943a8e0..b8a47b9 100644 --- a/test/validation/cpumask/cpumask.c +++ b/test/validation/cpumask/cpumask.c @@ -30,6 +30,9 @@ /* padding pattern used to check buffer overflow: */ #define FILLING_PATTERN 0x55 +/* default worker paramiter to get all that may be available */ +#define ALL_AVAILABLE 0 + /* * returns the length of a string, excluding terminating NULL. * As its C lib strlen equivalent. Just rewritten here to avoid C lib @@ -456,6 +459,56 @@ static void cpumask_test_odp_cpumask_next(void) CU_ASSERT(odp_cpumask_next(&mask1, i) == expected[i]); } +static void cpumask_test_odp_cpumask_setall(void) +{ + int num_cpus; + int max_cpus = get_max_number_of_cpus_in_a_mask(); + odp_cpumask_t mask; + + odp_cpumask_setall(&mask); + num_cpus = odp_cpumask_count(&mask); + + CU_ASSERT(num_cpus > 0); + CU_ASSERT(num_cpus >= max_cpus); +} + +static void cpumask_test_odp_cpumask_def_control(void) +{ + int num; + int max_cpus = get_max_number_of_cpus_in_a_mask(); + odp_cpumask_t mask; + + num = odp_cpumask_def_control(&mask, ALL_AVAILABLE); + + CU_ASSERT(num >= 0); + CU_ASSERT(num <= max_cpus); +} + +static void cpumask_test_odp_cpumask_def_worker(void) +{ + int num; + int max_cpus = get_max_number_of_cpus_in_a_mask(); + odp_cpumask_t mask; + + num = odp_cpumask_def_worker(&mask, ALL_AVAILABLE); + + CU_ASSERT(num >= 0); + CU_ASSERT(num <= max_cpus); +} + +static void cpumask_test_odp_cpumask_def(void) +{ + int num_worker; + int num_control; + int max_cpus = get_max_number_of_cpus_in_a_mask(); + odp_cpumask_t mask; + + num_worker = odp_cpumask_def_worker(&mask, max_cpus - 1); + num_control = odp_cpumask_def_worker(&mask, 1); + + CU_ASSERT((num_control + num_worker) == max_cpus); +} + static CU_TestInfo cpumask_suite[] = { {"odp_cpumask_to/from_str()", cpumask_test_odp_cpumask_to_from_str}, {"odp_cpumask_equal()", cpumask_test_odp_cpumask_equal}, @@ -471,6 +524,10 @@ static CU_TestInfo cpumask_suite[] = { {"odp_cpumask_first()", cpumask_test_odp_cpumask_first}, {"odp_cpumask_last()", cpumask_test_odp_cpumask_last}, {"odp_cpumask_next()", cpumask_test_odp_cpumask_next}, + {"odp_cpumask_setall()", cpumask_test_odp_cpumask_setall}, + {"odp_cpumask_def_control()", cpumask_test_odp_cpumask_def_control}, + {"odp_cpumask_def_worker()", cpumask_test_odp_cpumask_def_worker}, + {"odp_cpumask_def()", cpumask_test_odp_cpumask_def}, CU_TEST_INFO_NULL, };
Signed-off-by: Mike Holmes <mike.holmes@linaro.org> --- test/validation/cpumask/cpumask.c | 57 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+)