Skip to content

Commit 850d0cc

Browse files
keesshuahkh
authored andcommitted
selftests/harness: Limit step counter reporting
When the selftest "step" counter grew beyond 255, non-fatal warnings were being emitted, which is noisy and pointless. There are selftests with more than 255 steps (especially those in loops, etc). Instead, just cap "steps" to 254 and do not report the saturation. Reported-by: Ralph Campbell <[email protected]> Tested-by: Ralph Campbell <[email protected]> Fixes: 9847d24 ("selftests/harness: Refactor XFAIL into SKIP") Signed-off-by: Kees Cook <[email protected]> Signed-off-by: Shuah Khan <[email protected]>
1 parent 4c6614d commit 850d0cc

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

tools/testing/selftests/kselftest_harness.h

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -680,7 +680,8 @@
680680
__bail(_assert, _metadata->no_print, _metadata->step))
681681

682682
#define __INC_STEP(_metadata) \
683-
if (_metadata->passed && _metadata->step < 255) \
683+
/* Keep "step" below 255 (which is used for "SKIP" reporting). */ \
684+
if (_metadata->passed && _metadata->step < 253) \
684685
_metadata->step++;
685686

686687
#define is_signed_type(var) (!!(((__typeof__(var))(-1)) < (__typeof__(var))1))
@@ -976,12 +977,6 @@ void __run_test(struct __fixture_metadata *f,
976977
t->passed = 0;
977978
} else if (t->pid == 0) {
978979
t->fn(t, variant);
979-
/* Make sure step doesn't get lost in reporting */
980-
if (t->step >= 255) {
981-
ksft_print_msg("Too many test steps (%u)!?\n", t->step);
982-
t->step = 254;
983-
}
984-
/* Use 255 for SKIP */
985980
if (t->skip)
986981
_exit(255);
987982
/* Pass is exit 0 */

0 commit comments

Comments
 (0)