diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2014-01-20 21:11:10 (JST) |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2014-01-20 21:11:10 (JST) |
commit | f759cc0f08c195940de05d5394f7b1ad4d44365e (patch) | |
tree | e67ad33c58aced179929d5f5c5665745d56e90f9 /tests | |
parent | 6a1563343c48f9e38b85f39f4a95c89ea0f46a60 (diff) | |
download | cgit-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>
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/setup.sh | 12 | ||||
-rwxr-xr-x | tests/t0111-filter.sh | 7 |
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 | ||
61 | FILTER_DIRECTORY=$(cd ../filters && pwd) | 61 | FILTER_DIRECTORY=$(cd ../filters && pwd) |
62 | 62 | ||
63 | if cgit --version | grep -F -q "[+] Lua scripting"; then | ||
64 | export CGIT_HAS_LUA=1 | ||
65 | else | ||
66 | export CGIT_HAS_LUA=0 | ||
67 | fi | ||
68 | |||
63 | mkrepo() { | 69 | mkrepo() { |
64 | name=$1 | 70 | name=$1 |
65 | count=$2 | 71 | count=$2 |
@@ -133,7 +139,10 @@ repo.commit-filter=exec:$FILTER_DIRECTORY/dump.sh | |||
133 | repo.email-filter=exec:$FILTER_DIRECTORY/dump.sh | 139 | repo.email-filter=exec:$FILTER_DIRECTORY/dump.sh |
134 | repo.source-filter=exec:$FILTER_DIRECTORY/dump.sh | 140 | repo.source-filter=exec:$FILTER_DIRECTORY/dump.sh |
135 | repo.readme=master:a+b | 141 | repo.readme=master:a+b |
142 | EOF | ||
136 | 143 | ||
144 | if [ $CGIT_HAS_LUA -eq 1 ]; then | ||
145 | cat >>cgitrc <<EOF | ||
137 | repo.url=filter-lua | 146 | repo.url=filter-lua |
138 | repo.path=$PWD/repos/filter/.git | 147 | repo.path=$PWD/repos/filter/.git |
139 | repo.desc=filtered repo | 148 | repo.desc=filtered repo |
@@ -143,6 +152,7 @@ repo.email-filter=lua:$FILTER_DIRECTORY/dump.lua | |||
143 | repo.source-filter=lua:$FILTER_DIRECTORY/dump.lua | 152 | repo.source-filter=lua:$FILTER_DIRECTORY/dump.lua |
144 | repo.readme=master:a+b | 153 | repo.readme=master:a+b |
145 | EOF | 154 | EOF |
155 | fi | ||
146 | } | 156 | } |
147 | 157 | ||
148 | cgit_query() | 158 | cgit_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 | ||
158 | strip_headers () { | 168 | strip_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 @@ | |||
3 | test_description='Check filtered content' | 3 | test_description='Check filtered content' |
4 | . ./setup.sh | 4 | . ./setup.sh |
5 | 5 | ||
6 | for prefix in exec lua | 6 | prefixes="exec" |
7 | if [ $CGIT_HAS_LUA -eq 1 ]; then | ||
8 | prefixes="$prefixes lua" | ||
9 | fi | ||
10 | |||
11 | for prefix in $prefixes | ||
7 | do | 12 | do |
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 |