-rwxr-xr-x | tests/setup.sh | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/tests/setup.sh b/tests/setup.sh index 1457dd5..95acb54 100755 --- a/tests/setup.sh +++ b/tests/setup.sh @@ -12,37 +12,39 @@ # # . setup.sh # prepare_tests "html validation" # run_test 'repo index' 'cgit_url "/" | tidy -e' # run_test 'repo summary' 'cgit_url "/foo" | tidy -e' mkrepo() { name=$1 count=$2 dir=$PWD test -d $name && return printf "Creating testrepo %s\n" $name mkdir -p $name cd $name git init - for ((n=1; n<=count; n++)) + n=1 + while test $n -le $count do echo $n >file-$n git add file-$n git commit -m "commit $n" + n=$(expr $n + 1) done if test "$3" = "testplus" then echo "hello" >a+b git add a+b git commit -m "add a+b" git branch "1+2" fi cd $dir } setup_repos() { rm -rf trash/cache mkdir -p trash/cache mkrepo trash/repos/foo 5 >/dev/null @@ -88,33 +90,33 @@ prepare_tests() tests_done() { printf "\n" if test $test_failed -gt 0 then printf "test: *** %s failure(s), logfile=%s\n" \ $test_failed "$(pwd)/test-output.log" false fi } run_test() { desc=$1 script=$2 - ((test_count++)) + test_count=$(expr $test_count + 1) printf "\ntest %d: name='%s'\n" $test_count "$desc" >>test-output.log printf "test %d: eval='%s'\n" $test_count "$2" >>test-output.log eval "$2" >>test-output.log 2>>test-output.log res=$? printf "test %d: exitcode=%d\n" $test_count $res >>test-output.log if test $res = 0 then printf " %2d) %-60s [ok]\n" $test_count "$desc" else ((test_failed++)) printf " %2d) %-60s [failed]\n" $test_count "$desc" fi } cgit_query() { |