Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

selftests: cgroup: Use values_close_report in test_cpu

Convert test_cpu to use the newly added values_close_report() helper
to print detailed diagnostics when a tolerance check fails. This
provides clearer insight into deviations while run in the CI.

Signed-off-by: Sebastian Chlad <sebastian.chlad@suse.com>
Signed-off-by: Tejun Heo <tj@kernel.org>

authored by

Sebastian Chlad and committed by
Tejun Heo
4cdde87d 3f9c60f4

+9 -9
+9 -9
tools/testing/selftests/cgroup/test_cpu.c
··· 219 219 if (user_usec <= 0) 220 220 goto cleanup; 221 221 222 - if (!values_close(usage_usec, expected_usage_usec, 1)) 222 + if (!values_close_report(usage_usec, expected_usage_usec, 1)) 223 223 goto cleanup; 224 224 225 225 ret = KSFT_PASS; ··· 291 291 292 292 user_usec = cg_read_key_long(cpucg, "cpu.stat", "user_usec"); 293 293 nice_usec = cg_read_key_long(cpucg, "cpu.stat", "nice_usec"); 294 - if (!values_close(nice_usec, expected_nice_usec, 1)) 294 + if (!values_close_report(nice_usec, expected_nice_usec, 1)) 295 295 goto cleanup; 296 296 297 297 ret = KSFT_PASS; ··· 404 404 goto cleanup; 405 405 406 406 delta = children[i + 1].usage - children[i].usage; 407 - if (!values_close(delta, children[0].usage, 35)) 407 + if (!values_close_report(delta, children[0].usage, 35)) 408 408 goto cleanup; 409 409 } 410 410 ··· 444 444 int ret = KSFT_FAIL, i; 445 445 446 446 for (i = 0; i < num_children - 1; i++) { 447 - if (!values_close(children[i + 1].usage, children[0].usage, 15)) 447 + if (!values_close_report(children[i + 1].usage, children[0].usage, 15)) 448 448 goto cleanup; 449 449 } 450 450 ··· 573 573 574 574 nested_leaf_usage = leaf[1].usage + leaf[2].usage; 575 575 if (overprovisioned) { 576 - if (!values_close(leaf[0].usage, nested_leaf_usage, 15)) 576 + if (!values_close_report(leaf[0].usage, nested_leaf_usage, 15)) 577 577 goto cleanup; 578 - } else if (!values_close(leaf[0].usage * 2, nested_leaf_usage, 15)) 578 + } else if (!values_close_report(leaf[0].usage * 2, nested_leaf_usage, 15)) 579 579 goto cleanup; 580 580 581 581 582 582 child_usage = cg_read_key_long(child, "cpu.stat", "usage_usec"); 583 583 if (child_usage <= 0) 584 584 goto cleanup; 585 - if (!values_close(child_usage, nested_leaf_usage, 1)) 585 + if (!values_close_report(child_usage, nested_leaf_usage, 1)) 586 586 goto cleanup; 587 587 588 588 ret = KSFT_PASS; ··· 691 691 expected_usage_usec 692 692 = n_periods * quota_usec + MIN(remainder_usec, quota_usec); 693 693 694 - if (!values_close(usage_usec, expected_usage_usec, 10)) 694 + if (!values_close_report(usage_usec, expected_usage_usec, 10)) 695 695 goto cleanup; 696 696 697 697 ret = KSFT_PASS; ··· 762 762 expected_usage_usec 763 763 = n_periods * quota_usec + MIN(remainder_usec, quota_usec); 764 764 765 - if (!values_close(usage_usec, expected_usage_usec, 10)) 765 + if (!values_close_report(usage_usec, expected_usage_usec, 10)) 766 766 goto cleanup; 767 767 768 768 ret = KSFT_PASS;