Thread (88 messages) 88 messages, 2 authors, 4d ago

Re: [PATCH v2 04/58] objtool/klp: Classify klp test outcomes

From: Song Liu <song@kernel.org>
Date: 2026-09-14 18:50:40
Also in: sashiko-reviews

On Sun, Sep 13, 2026 at 11:39 PM [off-list ref] wrote:
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] Literal `$'\n'` string is appended instead of a newline character during TAP output manipulation.
--

commit df7f112de2ce31cfbac30c00e5d997457d3c2710
Author: Song Liu [off-list ref]

objtool/klp: Classify klp test outcomes

This commit introduces better classification of test outcomes for objtool klp
tests, distinguishing between different types of skips (declared, probe,
undeclared) and TAP directives (xfail, xpass). It modifies the test runner to
explicitly handle these cases and improve result reporting.
quoted
diff --git a/tools/objtool/tests/run-tests.sh b/tools/objtool/tests/run-tests.sh
index 48728a98d9950..6b937fc7f5bda 100755
--- a/tools/objtool/tests/run-tests.sh
+++ b/tools/objtool/tests/run-tests.sh
[ ... ]
quoted
@@ -23,31 +61,99 @@ cd "$(dirname "$0")" || exit 1
[ ... ]
quoted
+     case "$result" in
+     *"# SKIP (declared)"*)  static_skip=$((static_skip + 1)) ;;
+     *"# SKIP (probe)"*)     probe_skip=$((probe_skip + 1)) ;;
+     *"# SKIP"*)
+             # An undeclared skip: the test gave up for a reason it never
+             # said it might.  That is a hole, not an expected outcome.
+             #
+             # Replace the line rather than adding one.  Every test owes the
+             # plan exactly one result, and a consumer counting them is
+             # entitled to say so when the totals disagree.
+             rest="$rest${rest:+$'\n'}was: $result"
[Severity: Low]
Does this append a literal dollar sign and single quotes instead of a newline?

When a test fails via an undeclared skip and has already produced other output,
the test runner attempts to append a newline to the rest string. Due to Bash's
double-quoting rules, the $'\n' syntax is not expanded inside double quotes and
is instead appended as literal characters. This can garble the terminal output.
quoted
+             result="not ok - $(basename "$t" .sh): undeclared skip"
+             result="$result (use gcc_only/clang_only or require_input_*)"
+             fail=$((fail + 1)) ;;
+     "not ok"*"# TODO"*)     xfail=$((xfail + 1)) ;;
+     "ok"*"# TODO"*)         xpass=$((xpass + 1)) ;;
+     "not ok"*)              fail=$((fail + 1)) ;;
+     "ok"*)                  pass=$((pass + 1)) ;;
+     *)
+             # No result line at all: the test died before reporting.
+             rest="$rest${rest:+$'\n'}exited $rc without a result line"
[Severity: Low]
Is it possible this will also append literal characters rather than a newline
when a test dies without outputting a valid TAP result line?
This doesn't seem to be an issue.

Thanks,
Song
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help