* [PATCH 0/2] selftests: cgroup: improve diagnostics for CPU test failures
@ 2025-10-14 14:31 Sebastian Chlad
2025-10-14 14:31 ` [PATCH 1/2] selftests: cgroup: add values_close_assert helper Sebastian Chlad
` (2 more replies)
0 siblings, 3 replies; 11+ messages in thread
From: Sebastian Chlad @ 2025-10-14 14:31 UTC (permalink / raw)
To: cgroups; +Cc: mkoutny, Sebastian Chlad
Hi,
While running cgroup selftests under CI, the `test_cpu` tests sometimes fail
and it is impossible to tell how significant is the deviation. Often times the failures
are very marginal, but the existing output does not provide enough context to
understand how far the actual values were from the expected ones.
This is an initial idea to get this sorted by adding a new helper: `values_close_assert()`,
which prints detailed diagnostic information when two values differ by more than
a given tolerance.
This makes CI logs much more informative in the event of a close
failure without changing normal test behavior.
If the direction is fine, the next steps will be to extend this verbosity to additional
cgroup selftests for easier CI runs and debugging.
Thanks,
SebChlad
Sebastian Chlad (2):
selftests: cgroup: add values_close_assert helper
selftests: cgroup: Use values_close_assert in test_cpu
.../cgroup/lib/include/cgroup_util.h | 21 +++++++++++++++++++
tools/testing/selftests/cgroup/test_cpu.c | 18 ++++++++--------
2 files changed, 30 insertions(+), 9 deletions(-)
--
2.51.0
^ permalink raw reply [flat|nested] 11+ messages in thread* [PATCH 1/2] selftests: cgroup: add values_close_assert helper 2025-10-14 14:31 [PATCH 0/2] selftests: cgroup: improve diagnostics for CPU test failures Sebastian Chlad @ 2025-10-14 14:31 ` Sebastian Chlad 2025-10-14 19:32 ` Tejun Heo 2025-10-14 14:31 ` [PATCH 2/2] selftests: cgroup: Use values_close_assert in test_cpu Sebastian Chlad 2025-10-15 8:00 ` [PATCH v2 0/2] selftests: cgroup: improve diagnostics for CPU test failures Sebastian Chlad 2 siblings, 1 reply; 11+ messages in thread From: Sebastian Chlad @ 2025-10-14 14:31 UTC (permalink / raw) To: cgroups; +Cc: mkoutny, Sebastian Chlad Some cgroup selftests, such as test_cpu, occasionally fail by a very small margin and if run in the CI context, it is useful to have detailed diagnostic output to understand the deviation. Introduce a values_close_assert() helper which performs the same comparison as values_close(), but prints detailed information when the values differ beyond the allowed tolerance. Signed-off-by: Sebastian Chlad <sebastian.chlad@suse.com> --- .../cgroup/lib/include/cgroup_util.h | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/tools/testing/selftests/cgroup/lib/include/cgroup_util.h b/tools/testing/selftests/cgroup/lib/include/cgroup_util.h index 9dc90a1b386d..1ed0c6d96c66 100644 --- a/tools/testing/selftests/cgroup/lib/include/cgroup_util.h +++ b/tools/testing/selftests/cgroup/lib/include/cgroup_util.h @@ -25,6 +25,27 @@ static inline int values_close(long a, long b, int err) return labs(a - b) <= (a + b) / 100 * err; } +/* + * Checks if two given values differ by less than err% of their sum and assert + * with detailed debug info if not. + */ +static inline int values_close_assert(long a, long b, int err) +{ + long diff = labs(a - b); + long limit = (a + b) / 100 * err; + double actual_err = (a + b) ? (100.0 * diff / (a + b)) : 0.0; + int close = diff <= limit; + + if (!close) { + fprintf(stderr, + "[FAIL] actual=%ld expected=%ld | diff=%ld | limit=%ld | " + "tolerance=%d%% | actual_error=%.2f%%\n", + a, b, diff, limit, err, actual_err); + } + + return close; +} + extern ssize_t read_text(const char *path, char *buf, size_t max_len); extern ssize_t write_text(const char *path, char *buf, ssize_t len); -- 2.51.0 ^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH 1/2] selftests: cgroup: add values_close_assert helper 2025-10-14 14:31 ` [PATCH 1/2] selftests: cgroup: add values_close_assert helper Sebastian Chlad @ 2025-10-14 19:32 ` Tejun Heo 0 siblings, 0 replies; 11+ messages in thread From: Tejun Heo @ 2025-10-14 19:32 UTC (permalink / raw) To: Sebastian Chlad; +Cc: cgroups, mkoutny, Sebastian Chlad Hello, On Tue, Oct 14, 2025 at 04:31:50PM +0200, Sebastian Chlad wrote: > +/* > + * Checks if two given values differ by less than err% of their sum and assert > + * with detailed debug info if not. > + */ > +static inline int values_close_assert(long a, long b, int err) I wonder whether assert is a bit misleading given that asserts are generally expected to terminate the program on failure. Maybe sth like values_close_verbose() or values_close_report()? > +{ > + long diff = labs(a - b); > + long limit = (a + b) / 100 * err; > + double actual_err = (a + b) ? (100.0 * diff / (a + b)) : 0.0; > + int close = diff <= limit; > + > + if (!close) { > + fprintf(stderr, > + "[FAIL] actual=%ld expected=%ld | diff=%ld | limit=%ld | " > + "tolerance=%d%% | actual_error=%.2f%%\n", > + a, b, diff, limit, err, actual_err); > + } {} are unnecessary here. Can you please drop them? Thanks. -- tejun ^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 2/2] selftests: cgroup: Use values_close_assert in test_cpu 2025-10-14 14:31 [PATCH 0/2] selftests: cgroup: improve diagnostics for CPU test failures Sebastian Chlad 2025-10-14 14:31 ` [PATCH 1/2] selftests: cgroup: add values_close_assert helper Sebastian Chlad @ 2025-10-14 14:31 ` Sebastian Chlad 2025-10-15 8:00 ` [PATCH v2 0/2] selftests: cgroup: improve diagnostics for CPU test failures Sebastian Chlad 2 siblings, 0 replies; 11+ messages in thread From: Sebastian Chlad @ 2025-10-14 14:31 UTC (permalink / raw) To: cgroups; +Cc: mkoutny, Sebastian Chlad Convert test_cpu to use the newly added values_close_assert() 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> --- tools/testing/selftests/cgroup/test_cpu.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/tools/testing/selftests/cgroup/test_cpu.c b/tools/testing/selftests/cgroup/test_cpu.c index 2a60e6c41940..b411684791f2 100644 --- a/tools/testing/selftests/cgroup/test_cpu.c +++ b/tools/testing/selftests/cgroup/test_cpu.c @@ -219,7 +219,7 @@ static int test_cpucg_stats(const char *root) if (user_usec <= 0) goto cleanup; - if (!values_close(usage_usec, expected_usage_usec, 1)) + if (!values_close_assert(usage_usec, expected_usage_usec, 1)) goto cleanup; ret = KSFT_PASS; @@ -291,7 +291,7 @@ static int test_cpucg_nice(const char *root) user_usec = cg_read_key_long(cpucg, "cpu.stat", "user_usec"); nice_usec = cg_read_key_long(cpucg, "cpu.stat", "nice_usec"); - if (!values_close(nice_usec, expected_nice_usec, 1)) + if (!values_close_assert(nice_usec, expected_nice_usec, 1)) goto cleanup; ret = KSFT_PASS; @@ -404,7 +404,7 @@ overprovision_validate(const struct cpu_hogger *children, int num_children) goto cleanup; delta = children[i + 1].usage - children[i].usage; - if (!values_close(delta, children[0].usage, 35)) + if (!values_close_assert(delta, children[0].usage, 35)) goto cleanup; } @@ -444,7 +444,7 @@ underprovision_validate(const struct cpu_hogger *children, int num_children) int ret = KSFT_FAIL, i; for (i = 0; i < num_children - 1; i++) { - if (!values_close(children[i + 1].usage, children[0].usage, 15)) + if (!values_close_assert(children[i + 1].usage, children[0].usage, 15)) goto cleanup; } @@ -573,16 +573,16 @@ run_cpucg_nested_weight_test(const char *root, bool overprovisioned) nested_leaf_usage = leaf[1].usage + leaf[2].usage; if (overprovisioned) { - if (!values_close(leaf[0].usage, nested_leaf_usage, 15)) + if (!values_close_assert(leaf[0].usage, nested_leaf_usage, 15)) goto cleanup; - } else if (!values_close(leaf[0].usage * 2, nested_leaf_usage, 15)) + } else if (!values_close_assert(leaf[0].usage * 2, nested_leaf_usage, 15)) goto cleanup; child_usage = cg_read_key_long(child, "cpu.stat", "usage_usec"); if (child_usage <= 0) goto cleanup; - if (!values_close(child_usage, nested_leaf_usage, 1)) + if (!values_close_assert(child_usage, nested_leaf_usage, 1)) goto cleanup; ret = KSFT_PASS; @@ -691,7 +691,7 @@ static int test_cpucg_max(const char *root) expected_usage_usec = n_periods * quota_usec + MIN(remainder_usec, quota_usec); - if (!values_close(usage_usec, expected_usage_usec, 10)) + if (!values_close_assert(usage_usec, expected_usage_usec, 10)) goto cleanup; ret = KSFT_PASS; @@ -762,7 +762,7 @@ static int test_cpucg_max_nested(const char *root) expected_usage_usec = n_periods * quota_usec + MIN(remainder_usec, quota_usec); - if (!values_close(usage_usec, expected_usage_usec, 10)) + if (!values_close_assert(usage_usec, expected_usage_usec, 10)) goto cleanup; ret = KSFT_PASS; -- 2.51.0 ^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH v2 0/2] selftests: cgroup: improve diagnostics for CPU test failures 2025-10-14 14:31 [PATCH 0/2] selftests: cgroup: improve diagnostics for CPU test failures Sebastian Chlad 2025-10-14 14:31 ` [PATCH 1/2] selftests: cgroup: add values_close_assert helper Sebastian Chlad 2025-10-14 14:31 ` [PATCH 2/2] selftests: cgroup: Use values_close_assert in test_cpu Sebastian Chlad @ 2025-10-15 8:00 ` Sebastian Chlad 2025-10-15 8:00 ` [PATCH v2 1/2] selftests: cgroup: add values_close_assert helper Sebastian Chlad ` (2 more replies) 2 siblings, 3 replies; 11+ messages in thread From: Sebastian Chlad @ 2025-10-15 8:00 UTC (permalink / raw) To: cgroups; +Cc: tejun, mkoutny, Sebastian Chlad Hi, While running cgroup selftests under CI, the `test_cpu` tests sometimes fail and it is impossible to tell how significant is the deviation. Often times the failures are very marginal, but the existing output does not provide enough context to understand how far the actual values were from the expected ones. This is an initial idea to get this sorted by adding a new helper: `values_close_report()`, which prints detailed diagnostic information when two values differ by more than a given tolerance. This makes CI logs much more informative in the event of a close failure without changing normal test behavior. If the direction is fine, the next steps will be to extend this verbosity to additional cgroup selftests for easier CI runs and debugging. Changes since v1: - Rename values_close_assert() -> values_close_report() - Remove braces around single-line fprintf() Thanks, SebChlad Sebastian Chlad (2): selftests: cgroup: add values_close_assert helper selftests: cgroup: Use values_close_assert in test_cpu .../cgroup/lib/include/cgroup_util.h | 20 +++++++++++++++++++ tools/testing/selftests/cgroup/test_cpu.c | 18 ++++++++--------- 2 files changed, 29 insertions(+), 9 deletions(-) -- 2.51.0 ^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH v2 1/2] selftests: cgroup: add values_close_assert helper 2025-10-15 8:00 ` [PATCH v2 0/2] selftests: cgroup: improve diagnostics for CPU test failures Sebastian Chlad @ 2025-10-15 8:00 ` Sebastian Chlad 2025-10-15 8:00 ` [PATCH v2 2/2] selftests: cgroup: Use values_close_assert in test_cpu Sebastian Chlad 2025-10-15 10:33 ` [PATCH v3 0/2] selftests: cgroup: improve diagnostics for CPU test failures Sebastian Chlad 2 siblings, 0 replies; 11+ messages in thread From: Sebastian Chlad @ 2025-10-15 8:00 UTC (permalink / raw) To: cgroups; +Cc: tejun, mkoutny, Sebastian Chlad Some cgroup selftests, such as test_cpu, occasionally fail by a very small margin and if run in the CI context, it is useful to have detailed diagnostic output to understand the deviation. Introduce a values_close_assert() helper which performs the same comparison as values_close(), but prints detailed information when the values differ beyond the allowed tolerance. Signed-off-by: Sebastian Chlad <sebastian.chlad@suse.com> --- .../cgroup/lib/include/cgroup_util.h | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tools/testing/selftests/cgroup/lib/include/cgroup_util.h b/tools/testing/selftests/cgroup/lib/include/cgroup_util.h index 9dc90a1b386d..7ab2824ed7b5 100644 --- a/tools/testing/selftests/cgroup/lib/include/cgroup_util.h +++ b/tools/testing/selftests/cgroup/lib/include/cgroup_util.h @@ -25,6 +25,26 @@ static inline int values_close(long a, long b, int err) return labs(a - b) <= (a + b) / 100 * err; } +/* + * Checks if two given values differ by less than err% of their sum and assert + * with detailed debug info if not. + */ +static inline int values_close_report(long a, long b, int err) +{ + long diff = labs(a - b); + long limit = (a + b) / 100 * err; + double actual_err = (a + b) ? (100.0 * diff / (a + b)) : 0.0; + int close = diff <= limit; + + if (!close) + fprintf(stderr, + "[FAIL] actual=%ld expected=%ld | diff=%ld | limit=%ld | " + "tolerance=%d%% | actual_error=%.2f%%\n", + a, b, diff, limit, err, actual_err); + + return close; +} + extern ssize_t read_text(const char *path, char *buf, size_t max_len); extern ssize_t write_text(const char *path, char *buf, ssize_t len); -- 2.51.0 ^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH v2 2/2] selftests: cgroup: Use values_close_assert in test_cpu 2025-10-15 8:00 ` [PATCH v2 0/2] selftests: cgroup: improve diagnostics for CPU test failures Sebastian Chlad 2025-10-15 8:00 ` [PATCH v2 1/2] selftests: cgroup: add values_close_assert helper Sebastian Chlad @ 2025-10-15 8:00 ` Sebastian Chlad 2025-10-15 10:33 ` [PATCH v3 0/2] selftests: cgroup: improve diagnostics for CPU test failures Sebastian Chlad 2 siblings, 0 replies; 11+ messages in thread From: Sebastian Chlad @ 2025-10-15 8:00 UTC (permalink / raw) To: cgroups; +Cc: tejun, mkoutny, Sebastian Chlad Convert test_cpu to use the newly added values_close_assert() 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> --- tools/testing/selftests/cgroup/test_cpu.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/tools/testing/selftests/cgroup/test_cpu.c b/tools/testing/selftests/cgroup/test_cpu.c index 2a60e6c41940..d54e2317efff 100644 --- a/tools/testing/selftests/cgroup/test_cpu.c +++ b/tools/testing/selftests/cgroup/test_cpu.c @@ -219,7 +219,7 @@ static int test_cpucg_stats(const char *root) if (user_usec <= 0) goto cleanup; - if (!values_close(usage_usec, expected_usage_usec, 1)) + if (!values_close_report(usage_usec, expected_usage_usec, 1)) goto cleanup; ret = KSFT_PASS; @@ -291,7 +291,7 @@ static int test_cpucg_nice(const char *root) user_usec = cg_read_key_long(cpucg, "cpu.stat", "user_usec"); nice_usec = cg_read_key_long(cpucg, "cpu.stat", "nice_usec"); - if (!values_close(nice_usec, expected_nice_usec, 1)) + if (!values_close_report(nice_usec, expected_nice_usec, 1)) goto cleanup; ret = KSFT_PASS; @@ -404,7 +404,7 @@ overprovision_validate(const struct cpu_hogger *children, int num_children) goto cleanup; delta = children[i + 1].usage - children[i].usage; - if (!values_close(delta, children[0].usage, 35)) + if (!values_close_report(delta, children[0].usage, 35)) goto cleanup; } @@ -444,7 +444,7 @@ underprovision_validate(const struct cpu_hogger *children, int num_children) int ret = KSFT_FAIL, i; for (i = 0; i < num_children - 1; i++) { - if (!values_close(children[i + 1].usage, children[0].usage, 15)) + if (!values_close_report(children[i + 1].usage, children[0].usage, 15)) goto cleanup; } @@ -573,16 +573,16 @@ run_cpucg_nested_weight_test(const char *root, bool overprovisioned) nested_leaf_usage = leaf[1].usage + leaf[2].usage; if (overprovisioned) { - if (!values_close(leaf[0].usage, nested_leaf_usage, 15)) + if (!values_close_report(leaf[0].usage, nested_leaf_usage, 15)) goto cleanup; - } else if (!values_close(leaf[0].usage * 2, nested_leaf_usage, 15)) + } else if (!values_close_report(leaf[0].usage * 2, nested_leaf_usage, 15)) goto cleanup; child_usage = cg_read_key_long(child, "cpu.stat", "usage_usec"); if (child_usage <= 0) goto cleanup; - if (!values_close(child_usage, nested_leaf_usage, 1)) + if (!values_close_report(child_usage, nested_leaf_usage, 1)) goto cleanup; ret = KSFT_PASS; @@ -691,7 +691,7 @@ static int test_cpucg_max(const char *root) expected_usage_usec = n_periods * quota_usec + MIN(remainder_usec, quota_usec); - if (!values_close(usage_usec, expected_usage_usec, 10)) + if (!values_close_report(usage_usec, expected_usage_usec, 10)) goto cleanup; ret = KSFT_PASS; @@ -762,7 +762,7 @@ static int test_cpucg_max_nested(const char *root) expected_usage_usec = n_periods * quota_usec + MIN(remainder_usec, quota_usec); - if (!values_close(usage_usec, expected_usage_usec, 10)) + if (!values_close_report(usage_usec, expected_usage_usec, 10)) goto cleanup; ret = KSFT_PASS; -- 2.51.0 ^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH v3 0/2] selftests: cgroup: improve diagnostics for CPU test failures 2025-10-15 8:00 ` [PATCH v2 0/2] selftests: cgroup: improve diagnostics for CPU test failures Sebastian Chlad 2025-10-15 8:00 ` [PATCH v2 1/2] selftests: cgroup: add values_close_assert helper Sebastian Chlad 2025-10-15 8:00 ` [PATCH v2 2/2] selftests: cgroup: Use values_close_assert in test_cpu Sebastian Chlad @ 2025-10-15 10:33 ` Sebastian Chlad 2025-10-15 10:33 ` [PATCH v3 1/2] selftests: cgroup: add values_close_report helper Sebastian Chlad ` (2 more replies) 2 siblings, 3 replies; 11+ messages in thread From: Sebastian Chlad @ 2025-10-15 10:33 UTC (permalink / raw) To: cgroups; +Cc: mkoutny, Sebastian Chlad Hi, While running cgroup selftests under CI, the `test_cpu` tests sometimes fail and it is impossible to tell how significant is the deviation. Often times the failures are very marginal, but the existing output does not provide enough context to understand how far the actual values were from the expected ones. This is an initial idea to get this sorted by adding a new helper: `values_close_report()`, which prints detailed diagnostic information when two values differ by more than a given tolerance. This makes CI logs much more informative in the event of a close failure without changing normal test behavior. If the direction is fine, the next steps will be to extend this verbosity to additional cgroup selftests for easier CI runs and debugging. Changes since v1: - Rename values_close_assert() -> values_close_report() - Remove braces around single-line fprintf() Changes since v2: - sorry, I forgot to amend the git commit messages, so corrected here Thanks, SebChlad Sebastian Chlad (2): selftests: cgroup: add values_close_report helper selftests: cgroup: Use values_close_report in test_cpu .../cgroup/lib/include/cgroup_util.h | 20 +++++++++++++++++++ tools/testing/selftests/cgroup/test_cpu.c | 18 ++++++++--------- 2 files changed, 29 insertions(+), 9 deletions(-) -- 2.51.0 ^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH v3 1/2] selftests: cgroup: add values_close_report helper 2025-10-15 10:33 ` [PATCH v3 0/2] selftests: cgroup: improve diagnostics for CPU test failures Sebastian Chlad @ 2025-10-15 10:33 ` Sebastian Chlad 2025-10-15 10:33 ` [PATCH v3 2/2] selftests: cgroup: Use values_close_report in test_cpu Sebastian Chlad 2025-10-15 15:00 ` [PATCH v3 0/2] selftests: cgroup: improve diagnostics for CPU test failures Tejun Heo 2 siblings, 0 replies; 11+ messages in thread From: Sebastian Chlad @ 2025-10-15 10:33 UTC (permalink / raw) To: cgroups; +Cc: mkoutny, Sebastian Chlad Some cgroup selftests, such as test_cpu, occasionally fail by a very small margin and if run in the CI context, it is useful to have detailed diagnostic output to understand the deviation. Introduce a values_close_report() helper which performs the same comparison as values_close(), but prints detailed information when the values differ beyond the allowed tolerance. Signed-off-by: Sebastian Chlad <sebastian.chlad@suse.com> --- .../cgroup/lib/include/cgroup_util.h | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tools/testing/selftests/cgroup/lib/include/cgroup_util.h b/tools/testing/selftests/cgroup/lib/include/cgroup_util.h index 9dc90a1b386d..7ab2824ed7b5 100644 --- a/tools/testing/selftests/cgroup/lib/include/cgroup_util.h +++ b/tools/testing/selftests/cgroup/lib/include/cgroup_util.h @@ -25,6 +25,26 @@ static inline int values_close(long a, long b, int err) return labs(a - b) <= (a + b) / 100 * err; } +/* + * Checks if two given values differ by less than err% of their sum and assert + * with detailed debug info if not. + */ +static inline int values_close_report(long a, long b, int err) +{ + long diff = labs(a - b); + long limit = (a + b) / 100 * err; + double actual_err = (a + b) ? (100.0 * diff / (a + b)) : 0.0; + int close = diff <= limit; + + if (!close) + fprintf(stderr, + "[FAIL] actual=%ld expected=%ld | diff=%ld | limit=%ld | " + "tolerance=%d%% | actual_error=%.2f%%\n", + a, b, diff, limit, err, actual_err); + + return close; +} + extern ssize_t read_text(const char *path, char *buf, size_t max_len); extern ssize_t write_text(const char *path, char *buf, ssize_t len); -- 2.51.0 ^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH v3 2/2] selftests: cgroup: Use values_close_report in test_cpu 2025-10-15 10:33 ` [PATCH v3 0/2] selftests: cgroup: improve diagnostics for CPU test failures Sebastian Chlad 2025-10-15 10:33 ` [PATCH v3 1/2] selftests: cgroup: add values_close_report helper Sebastian Chlad @ 2025-10-15 10:33 ` Sebastian Chlad 2025-10-15 15:00 ` [PATCH v3 0/2] selftests: cgroup: improve diagnostics for CPU test failures Tejun Heo 2 siblings, 0 replies; 11+ messages in thread From: Sebastian Chlad @ 2025-10-15 10:33 UTC (permalink / raw) To: cgroups; +Cc: mkoutny, Sebastian Chlad 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> --- tools/testing/selftests/cgroup/test_cpu.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/tools/testing/selftests/cgroup/test_cpu.c b/tools/testing/selftests/cgroup/test_cpu.c index 2a60e6c41940..d54e2317efff 100644 --- a/tools/testing/selftests/cgroup/test_cpu.c +++ b/tools/testing/selftests/cgroup/test_cpu.c @@ -219,7 +219,7 @@ static int test_cpucg_stats(const char *root) if (user_usec <= 0) goto cleanup; - if (!values_close(usage_usec, expected_usage_usec, 1)) + if (!values_close_report(usage_usec, expected_usage_usec, 1)) goto cleanup; ret = KSFT_PASS; @@ -291,7 +291,7 @@ static int test_cpucg_nice(const char *root) user_usec = cg_read_key_long(cpucg, "cpu.stat", "user_usec"); nice_usec = cg_read_key_long(cpucg, "cpu.stat", "nice_usec"); - if (!values_close(nice_usec, expected_nice_usec, 1)) + if (!values_close_report(nice_usec, expected_nice_usec, 1)) goto cleanup; ret = KSFT_PASS; @@ -404,7 +404,7 @@ overprovision_validate(const struct cpu_hogger *children, int num_children) goto cleanup; delta = children[i + 1].usage - children[i].usage; - if (!values_close(delta, children[0].usage, 35)) + if (!values_close_report(delta, children[0].usage, 35)) goto cleanup; } @@ -444,7 +444,7 @@ underprovision_validate(const struct cpu_hogger *children, int num_children) int ret = KSFT_FAIL, i; for (i = 0; i < num_children - 1; i++) { - if (!values_close(children[i + 1].usage, children[0].usage, 15)) + if (!values_close_report(children[i + 1].usage, children[0].usage, 15)) goto cleanup; } @@ -573,16 +573,16 @@ run_cpucg_nested_weight_test(const char *root, bool overprovisioned) nested_leaf_usage = leaf[1].usage + leaf[2].usage; if (overprovisioned) { - if (!values_close(leaf[0].usage, nested_leaf_usage, 15)) + if (!values_close_report(leaf[0].usage, nested_leaf_usage, 15)) goto cleanup; - } else if (!values_close(leaf[0].usage * 2, nested_leaf_usage, 15)) + } else if (!values_close_report(leaf[0].usage * 2, nested_leaf_usage, 15)) goto cleanup; child_usage = cg_read_key_long(child, "cpu.stat", "usage_usec"); if (child_usage <= 0) goto cleanup; - if (!values_close(child_usage, nested_leaf_usage, 1)) + if (!values_close_report(child_usage, nested_leaf_usage, 1)) goto cleanup; ret = KSFT_PASS; @@ -691,7 +691,7 @@ static int test_cpucg_max(const char *root) expected_usage_usec = n_periods * quota_usec + MIN(remainder_usec, quota_usec); - if (!values_close(usage_usec, expected_usage_usec, 10)) + if (!values_close_report(usage_usec, expected_usage_usec, 10)) goto cleanup; ret = KSFT_PASS; @@ -762,7 +762,7 @@ static int test_cpucg_max_nested(const char *root) expected_usage_usec = n_periods * quota_usec + MIN(remainder_usec, quota_usec); - if (!values_close(usage_usec, expected_usage_usec, 10)) + if (!values_close_report(usage_usec, expected_usage_usec, 10)) goto cleanup; ret = KSFT_PASS; -- 2.51.0 ^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH v3 0/2] selftests: cgroup: improve diagnostics for CPU test failures 2025-10-15 10:33 ` [PATCH v3 0/2] selftests: cgroup: improve diagnostics for CPU test failures Sebastian Chlad 2025-10-15 10:33 ` [PATCH v3 1/2] selftests: cgroup: add values_close_report helper Sebastian Chlad 2025-10-15 10:33 ` [PATCH v3 2/2] selftests: cgroup: Use values_close_report in test_cpu Sebastian Chlad @ 2025-10-15 15:00 ` Tejun Heo 2 siblings, 0 replies; 11+ messages in thread From: Tejun Heo @ 2025-10-15 15:00 UTC (permalink / raw) To: Sebastian Chlad; +Cc: cgroups, mkoutny, Sebastian Chlad On Wed, Oct 15, 2025 at 12:33:55PM +0200, Sebastian Chlad wrote: > Sebastian Chlad (2): > selftests: cgroup: add values_close_report helper > selftests: cgroup: Use values_close_report in test_cpu Applied to cgroup/for-6.18-fixes. Thanks. -- tejun ^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2025-10-15 15:00 UTC | newest] Thread overview: 11+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2025-10-14 14:31 [PATCH 0/2] selftests: cgroup: improve diagnostics for CPU test failures Sebastian Chlad 2025-10-14 14:31 ` [PATCH 1/2] selftests: cgroup: add values_close_assert helper Sebastian Chlad 2025-10-14 19:32 ` Tejun Heo 2025-10-14 14:31 ` [PATCH 2/2] selftests: cgroup: Use values_close_assert in test_cpu Sebastian Chlad 2025-10-15 8:00 ` [PATCH v2 0/2] selftests: cgroup: improve diagnostics for CPU test failures Sebastian Chlad 2025-10-15 8:00 ` [PATCH v2 1/2] selftests: cgroup: add values_close_assert helper Sebastian Chlad 2025-10-15 8:00 ` [PATCH v2 2/2] selftests: cgroup: Use values_close_assert in test_cpu Sebastian Chlad 2025-10-15 10:33 ` [PATCH v3 0/2] selftests: cgroup: improve diagnostics for CPU test failures Sebastian Chlad 2025-10-15 10:33 ` [PATCH v3 1/2] selftests: cgroup: add values_close_report helper Sebastian Chlad 2025-10-15 10:33 ` [PATCH v3 2/2] selftests: cgroup: Use values_close_report in test_cpu Sebastian Chlad 2025-10-15 15:00 ` [PATCH v3 0/2] selftests: cgroup: improve diagnostics for CPU test failures Tejun Heo
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox