[4/4] test/malloc: fix case expectation
Checks
Commit Message
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@dpdk.org
Signed-off-by: Ruifeng Wang <ruifeng.wang@arm.com>
Reviewed-by: Feifei Wang <feifei.wang2@arm.com>
---
app/test/test_malloc.c | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
Comments
On 5/19/2023 5:29 AM, Ruifeng Wang wrote:
> 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@dpdk.org
>
> Signed-off-by: Ruifeng Wang <ruifeng.wang@arm.com>
> Reviewed-by: Feifei Wang <feifei.wang2@arm.com>
> ---
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
@@ -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;
}