Diff options
| author | Bryce Kwon <bryce@brycekwon.com> | |
|---|---|---|
| committer | Bryce Kwon <bryce@brycekwon.com> | |
| commit | ||
| parent | ||
| tree | ||
| download | ||
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.
Diffstat (limited to 'tests/t0002-html-validity.sh')
| -rwxr-xr-x | tests/t0002-html-validity.sh | 26 |
1 file changed, 14 insertions, 12 deletions
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.tmp >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 '<!DOCTYPE html>\n<html lang="en"><head><title>t</title></head><body><header>x</header></body></html>\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 && + <!DOCTYPE html> + <html lang="en"><head><title>t</title></head><body><header>x</header></body></html> + 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 } |
