From ad3c8e40f4e45cdbdf333766e7f771e866d19997 Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Sat, 7 Nov 2026 08:07:38 -1000 Subject: Fail where a test fixture breaks mkrepo had no && chain, so a failed add or commit went unnoticed and every mkrepo call in the tests passed on a broken repository. The shared fixtures were built the same way. They are still built when setup.sh is sourced, so --run can pick out any test, but a failure now stops the run where it broke. --- tests/setup.sh | 53 +++++++++++++++++++++++++++++------------------------ 1 file changed, 29 insertions(+), 24 deletions(-) (limited to 'tests/setup.sh') diff --git a/tests/setup.sh b/tests/setup.sh index c035606..563412e 100755 --- a/tests/setup.sh +++ b/tests/setup.sh @@ -113,25 +113,24 @@ unset cgit_version cgit_flags # argument asks for a variant, either testplus for a file and a branch whose # names have to be escaped in a URL, or commit-graph for a written commit graph. mkrepo() { - repo=$1 - commits=$2 - variant=$3 - test_create_repo "$repo" + mkrepo_commits=$2 + mkrepo_variant=$3 + test_create_repo "$1" && ( - cd "$repo" - n=1 - while test $n -le $commits + cd "$1" && + n=1 && + while test $n -le $mkrepo_commits do - echo $n >file-$n - git add file-$n - git commit -m "commit $n" - n=$((n + 1)) - done - case "$variant" in + echo $n >file-$n && + git add file-$n && + git commit -m "commit $n" && + n=$((n + 1)) || exit 1 + done && + case "$mkrepo_variant" in testplus) - echo "hello" >a+b - git add a+b - git commit -m "add a+b" + echo "hello" >a+b && + git add a+b && + git commit -m "add a+b" && git branch "1+2" ;; commit-graph) @@ -142,13 +141,13 @@ mkrepo() { } setup_repos() { - mkdir cache - mkrepo repos/foo 5 >/dev/null - mkrepo repos/bar 50 commit-graph >/dev/null - mkrepo repos/foo+bar 10 testplus >/dev/null - mkrepo "repos/with space" 2 >/dev/null - mkrepo repos/filter 5 testplus >/dev/null - cat >cgitrc </dev/null && + mkrepo repos/bar 50 commit-graph >/dev/null && + mkrepo repos/foo+bar 10 testplus >/dev/null && + mkrepo "repos/with space" 2 >/dev/null && + mkrepo repos/filter 5 testplus >/dev/null && + cat >cgitrc <