[PATCH 4/4] test/malloc: fix case expectation
Ruifeng Wang
ruifeng.wang at arm.com
Fri May 19 06:29:23 CEST 2023
The case expects all stats to be equal. Therefor the conditions
in check should be logically or'ed.
Fixes: a40a1f8231b4 ("app: various tests update")
Cc: stable at dpdk.org
Signed-off-by: Ruifeng Wang <ruifeng.wang at arm.com>
Reviewed-by: Feifei Wang <feifei.wang2 at arm.com>
---
app/test/test_malloc.c | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/app/test/test_malloc.c b/app/test/test_malloc.c
index f144b89d88..ff081dd931 100644
--- a/app/test/test_malloc.c
+++ b/app/test/test_malloc.c
@@ -302,11 +302,11 @@ test_multi_alloc_statistics(void)
rte_malloc_get_socket_stats(socket,&post_stats);
/* Check statistics reported are correct */
/* All post stats should be equal to pre stats after alloc freed */
- if ((post_stats.heap_totalsz_bytes != pre_stats.heap_totalsz_bytes) &&
- (post_stats.heap_freesz_bytes!=pre_stats.heap_freesz_bytes) &&
- (post_stats.heap_allocsz_bytes!=pre_stats.heap_allocsz_bytes)&&
- (post_stats.alloc_count!=pre_stats.alloc_count)&&
- (post_stats.free_count!=pre_stats.free_count)) {
+ if ((post_stats.heap_totalsz_bytes != pre_stats.heap_totalsz_bytes) ||
+ (post_stats.heap_freesz_bytes != pre_stats.heap_freesz_bytes) ||
+ (post_stats.heap_allocsz_bytes != pre_stats.heap_allocsz_bytes) ||
+ (post_stats.alloc_count != pre_stats.alloc_count) ||
+ (post_stats.free_count != pre_stats.free_count)) {
printf("Malloc statistics are incorrect - freed alloc\n");
return -1;
}
@@ -363,11 +363,11 @@ test_multi_alloc_statistics(void)
return -1;
}
- if ((post_stats.heap_totalsz_bytes != pre_stats.heap_totalsz_bytes) &&
- (post_stats.heap_freesz_bytes!=pre_stats.heap_freesz_bytes) &&
- (post_stats.heap_allocsz_bytes!=pre_stats.heap_allocsz_bytes)&&
- (post_stats.alloc_count!=pre_stats.alloc_count)&&
- (post_stats.free_count!=pre_stats.free_count)) {
+ if ((post_stats.heap_totalsz_bytes != pre_stats.heap_totalsz_bytes) ||
+ (post_stats.heap_freesz_bytes != pre_stats.heap_freesz_bytes) ||
+ (post_stats.heap_allocsz_bytes != pre_stats.heap_allocsz_bytes) ||
+ (post_stats.alloc_count != pre_stats.alloc_count) ||
+ (post_stats.free_count != pre_stats.free_count)) {
printf("Malloc statistics are incorrect - freed alloc\n");
return -1;
}
--
2.25.1
More information about the stable
mailing list