aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMatias Elo <matias.elo@nokia.com>2023-04-18 10:53:20 +0300
committerMatias Elo <matias.elo@nokia.com>2023-04-20 09:49:26 +0300
commit04655dc8891711aea41a3b6d1dedd1d16d8ca786 (patch)
tree04f32dc63aa772cf2812d18d533efebc7c17025f /test
parentb90da27fefb3f12454f07fa1020c2003ad55dc5e (diff)
validation: pool: fix odp_pool_stats_t.alloc_ops test
odp_pool_stats_t.alloc_ops counter includes also failed alloc operations, so comparison should be made against the number of alloc rounds. Also, add same check for odp_pool_stats_t.cache_alloc_ops. Signed-off-by: Matias Elo <matias.elo@nokia.com> Reviewed-by: Tuomas Taipale <tuomas.taipale@nokia.com>
Diffstat (limited to 'test')
-rw-r--r--test/validation/api/pool/pool.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/test/validation/api/pool/pool.c b/test/validation/api/pool/pool.c
index cded05650..09b10238f 100644
--- a/test/validation/api/pool/pool.c
+++ b/test/validation/api/pool/pool.c
@@ -1164,8 +1164,8 @@ static void pool_test_pool_statistics(odp_pool_type_t pool_type)
CU_ASSERT_FATAL(max_pools != 0);
/* Extra alloc rounds for testing odp_pool_stats_t.alloc_fails */
- uint32_t num_alloc_rounds = num_obj + 100;
- odp_event_t event[max_pools][num_alloc_rounds];
+ uint32_t num_allocs = num_obj + 100;
+ odp_event_t event[max_pools][num_allocs];
uint32_t num_event[max_pools];
odp_pool_t pool[max_pools];
@@ -1202,7 +1202,7 @@ static void pool_test_pool_statistics(odp_pool_type_t pool_type)
CU_ASSERT(stats.thread.cache_available[j] <= stats.cache_available);
/* Allocate the events */
- for (j = 0; j < num_alloc_rounds; j++) {
+ for (j = 0; j < num_allocs; j++) {
odp_event_t new_event = ODP_EVENT_INVALID;
uint64_t total_cached = 0;
uint16_t first_id = 0;
@@ -1275,12 +1275,13 @@ static void pool_test_pool_statistics(odp_pool_type_t pool_type)
for (j = 0; j < ODP_POOL_MAX_THREAD_STATS; j++)
CU_ASSERT(stats.thread.cache_available[j] == 0);
if (supported.bit.alloc_ops)
- CU_ASSERT(stats.alloc_ops > 0 && stats.alloc_ops <= num_obj + 1);
+ CU_ASSERT(stats.alloc_ops > 0 && stats.alloc_ops <= num_allocs);
if (supported.bit.alloc_fails)
CU_ASSERT(stats.alloc_fails == num_fails);
if (supported.bit.total_ops)
- CU_ASSERT(stats.total_ops > 0 && stats.total_ops <= num_obj + 1);
+ CU_ASSERT(stats.total_ops > 0 && stats.total_ops <= num_allocs);
CU_ASSERT(stats.free_ops == 0);
+ CU_ASSERT(stats.cache_alloc_ops <= num_allocs);
CU_ASSERT(stats.cache_free_ops == 0);
}