aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Jason A. Donenfeld <Jason@zx2c4.com>2014-01-20 21:11:10 (JST)
committerGravatar Jason A. Donenfeld <Jason@zx2c4.com>2014-01-20 21:11:10 (JST)
commitf759cc0f08c195940de05d5394f7b1ad4d44365e (patch)
treee67ad33c58aced179929d5f5c5665745d56e90f9
parent6a1563343c48f9e38b85f39f4a95c89ea0f46a60 (diff)
downloadcgit-f759cc0f08c195940de05d5394f7b1ad4d44365e.zip
cgit-f759cc0f08c195940de05d5394f7b1ad4d44365e.tar.gz
tests: only do lua tests if lua is compiled-in
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
-rwxr-xr-xtests/setup.sh12
-rwxr-xr-xtests/t0111-filter.sh7
2 files changed, 17 insertions, 2 deletions
diff --git a/tests/setup.sh b/tests/setup.sh
index 785edd7..7590f04 100755
--- a/tests/setup.sh
+++ b/tests/setup.sh
@@ -60,6 +60,12 @@ fi
60 60
61FILTER_DIRECTORY=$(cd ../filters && pwd) 61FILTER_DIRECTORY=$(cd ../filters && pwd)
62 62
63if cgit --version | grep -F -q "[+] Lua scripting"; then
64 export CGIT_HAS_LUA=1
65else
66 export CGIT_HAS_LUA=0
67fi
68
63mkrepo() { 69mkrepo() {
64 name=$1 70 name=$1
65 count=$2 71 count=$2
@@ -133,7 +139,10 @@ repo.commit-filter=exec:$FILTER_DIRECTORY/dump.sh
133repo.email-filter=exec:$FILTER_DIRECTORY/dump.sh 139repo.email-filter=exec:$FILTER_DIRECTORY/dump.sh
134repo.source-filter=exec:$FILTER_DIRECTORY/dump.sh 140repo.source-filter=exec:$FILTER_DIRECTORY/dump.sh
135repo.readme=master:a+b 141repo.readme=master:a+b
142EOF
136 143
144 if [ $CGIT_HAS_LUA -eq 1 ]; then
145 cat >>cgitrc <<EOF
137repo.url=filter-lua 146repo.url=filter-lua
138repo.path=$PWD/repos/filter/.git 147repo.path=$PWD/repos/filter/.git
139repo.desc=filtered repo 148repo.desc=filtered repo
@@ -143,6 +152,7 @@ repo.email-filter=lua:$FILTER_DIRECTORY/dump.lua
143repo.source-filter=lua:$FILTER_DIRECTORY/dump.lua 152repo.source-filter=lua:$FILTER_DIRECTORY/dump.lua
144repo.readme=master:a+b 153repo.readme=master:a+b
145EOF 154EOF
155 fi
146} 156}
147 157
148cgit_query() 158cgit_query()
@@ -155,7 +165,7 @@ cgit_url()
155 CGIT_CONFIG="$PWD/cgitrc" QUERY_STRING="url=$1" cgit 165 CGIT_CONFIG="$PWD/cgitrc" QUERY_STRING="url=$1" cgit
156} 166}
157 167
158strip_headers () { 168strip_headers() {
159 while read -r line 169 while read -r line
160 do 170 do
161 test -z "$line" && break 171 test -z "$line" && break
diff --git a/tests/t0111-filter.sh b/tests/t0111-filter.sh
index 730f1c0..2fdc366 100755
--- a/tests/t0111-filter.sh
+++ b/tests/t0111-filter.sh
@@ -3,7 +3,12 @@
3test_description='Check filtered content' 3test_description='Check filtered content'
4. ./setup.sh 4. ./setup.sh
5 5
6for prefix in exec lua 6prefixes="exec"
7if [ $CGIT_HAS_LUA -eq 1 ]; then
8 prefixes="$prefixes lua"
9fi
10
11for prefix in $prefixes
7do 12do
8 test_expect_success "generate filter-$prefix/tree/a%2bb" " 13 test_expect_success "generate filter-$prefix/tree/a%2bb" "
9 cgit_url 'filter-$prefix/tree/a%2bb' >tmp 14 cgit_url 'filter-$prefix/tree/a%2bb' >tmp