From 8651c571878221090abc2a332c0e707d3507aba2 Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Sat, 31 Oct 2026 14:51:46 -0700 Subject: Leave the snapshot and feed tool checks to test-lib A lazy prerequisite is checked only when a test asks for it, and test-lib names the missing one on every skipped test, so the skip notes go too. test-lib already defines UNZIP and the unzip it checks. The test that unpacks a tag's tar.gz with gzip now asks for GZIP like every other one that does. --- tests/t0110-snapshot.sh | 20 ++++---------------- tests/t0111-atom.sh | 7 +------ 2 files changed, 5 insertions(+), 22 deletions(-) diff --git a/tests/t0110-snapshot.sh b/tests/t0110-snapshot.sh index 969368d..6221efc 100755 --- a/tests/t0110-snapshot.sh +++ b/tests/t0110-snapshot.sh @@ -17,12 +17,7 @@ test_tar_snapshot() { tool=$3 prereq=$4 - if command -v "$tool" >/dev/null 2>&1 - then - test_set_prereq $prereq - else - say "Skipping $ext validation tests: $tool not found" - fi + test_lazy_prereq $prereq "command -v $tool" test_expect_success $prereq "get foo/snapshot/master.$ext" " cgit_url 'foo/snapshot/master.$ext' >tmp @@ -77,13 +72,6 @@ test_tar_snapshot tar.lz application/x-lzip lzip LZIP test_tar_snapshot tar.xz application/x-xz xz XZ test_tar_snapshot tar.zst application/zstd zstd ZSTD -if command -v unzip >/dev/null 2>&1 -then - test_set_prereq UNZIP -else - say 'Skipping zip validation tests: unzip not found' -fi - test_expect_success 'get foo/snapshot/master.zip' ' cgit_url "foo/snapshot/master.zip" >tmp ' @@ -99,12 +87,12 @@ test_expect_success 'strip off the header lines' ' ' test_expect_success UNZIP 'verify zip format' ' - unzip -t master.zip + "$GIT_UNZIP" -t master.zip ' test_expect_success UNZIP 'unzip and verify the content' ' rm -rf master && - unzip master.zip && + "$GIT_UNZIP" master.zip && ls master/ >output && test_line_count = 5 output && grep "^5$" master/file-5 && @@ -212,7 +200,7 @@ test_expect_success GZIP 'a compressed snapshot is made without a PATH' ' # A link offers the snapshot of a tag, and the name on it has to lead back to # that tag even when a branch is spelled like the tag's stem. -test_expect_success 'a snapshot name leads to the tag ahead of a branch' ' +test_expect_success GZIP 'a snapshot name leads to the tag ahead of a branch' ' git -C repos/vtags update-ref refs/heads/1.0 $(git -C repos/vtags commit-tree -m shadow HEAD^{tree}) && CGIT_CONFIG="$PWD/vtagsrc" QUERY_STRING="url=vtags/snapshot/vtags-1.0.tar.gz" cgit >tmp && strip_headers tag.tar.gz && diff --git a/tests/t0111-atom.sh b/tests/t0111-atom.sh index 48448ef..ccc8a2f 100755 --- a/tests/t0111-atom.sh +++ b/tests/t0111-atom.sh @@ -46,12 +46,7 @@ test_expect_success 'max-atom-items overrides the ceiling' ' test $(grep -c "" feed) -eq 3 ' -if command -v xmllint >/dev/null 2>&1 -then - test_set_prereq XMLLINT -else - say 'Skipping well-formedness check: xmllint not found' -fi +test_lazy_prereq XMLLINT 'command -v xmllint' test_expect_success XMLLINT 'the feed is well-formed xml' ' cgit_url "foo/atom" >tmp && -- cgit