From 4c428b0412c4c0334a2bae1a90e8f494c5d05ce6 Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Sat, 7 Nov 2026 08:32:12 -1000 Subject: Let a test run require the tools it must not skip Nothing could make a missing prerequisite fail. A host without pkg-config builds without Lua, and make test then passed with every Lua test skipped and the lua pass of t0201 never run. The whole-script skips become named prerequisites so the same list covers them, and the strace probe now traces the file class of calls the tests use, so an strace too old for it skips rather than fails. --- tests/t0002-html-validity.sh | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) (limited to 'tests/t0002-html-validity.sh') diff --git a/tests/t0002-html-validity.sh b/tests/t0002-html-validity.sh index bdccaf2..a4a6725 100755 --- a/tests/t0002-html-validity.sh +++ b/tests/t0002-html-validity.sh @@ -17,22 +17,24 @@ test_url() { strip_headers tidy-$test_count || return # Tidy leaves with 1 for warnings and 2 for errors, and only an error is # worth failing the test over. - "$tidy" -eq tidy-$test_count + tidy -eq tidy-$test_count test $? != 2 } -tidy=$(command -v tidy) || { - skip_all='Skipping html validation tests: tidy not found' - test_done -} - # Releases of tidy that predate HTML5 reject the semantic elements cgit emits, -# header, nav, main and footer among them, reporting each as an error. Skip the -# validation unless tidy is new enough to understand them. -printf '\nt
x
\n' \ - | "$tidy" -q -e >/dev/null 2>&1 -test $? -ge 2 && { - skip_all='Skipping html validation tests: tidy is too old for HTML5' +# header, nav, main and footer among them, reporting each as an error, so only +# a tidy new enough to understand them will do. +test_lazy_prereq TIDY ' + cat >probe.html <<-\EOF && + + t
x
+ EOF + tidy -q -e probe.html >/dev/null 2>&1 + test $? -lt 2 +' + +test_have_prereq TIDY || { + skip_all='Skipping html validation tests: no tidy that knows HTML5' test_done } -- cgit 2.12.1