Most of these assertions end in a grep, and an empty pattern matches
anything. So a mistyped variable name in a test does not fail: it expands
to nothing, the grep succeeds, and the test reports a pass having checked
nothing. assert_section "$sectoin_nmae" becomes a search for two adjacent
spaces, which readelf's column padding satisfies on every line.
Refuse unset variables. lib.sh guards the few genuinely optional
expansions it has with ${x:-}.
Assisted-by: Claude:claude-opus-5
Signed-off-by: Song Liu <song@kernel.org>
---
tools/objtool/tests/lib.sh | 2 ++
1 file changed, 2 insertions(+)
diff --git a/tools/objtool/tests/lib.sh b/tools/objtool/tests/lib.sh
index 7598836a6442..9dd4967b244f 100644
--- a/tools/objtool/tests/lib.sh
+++ b/tools/objtool/tests/lib.sh
@@ -8,6 +8,8 @@
# codegen varies between compilers and golden files would report churn instead
# of regressions.
+set -u
+
TESTS_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# Tests live in generic/ or in an architecture directory beside it, and each--
2.53.0-Meta