1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
test_description='Check the build without Lua'
. ./setup.sh
nolua="$TEST_OUTPUT_DIRECTORY/../build/nolua/cgit"
test -x "$nolua" || {
skip_all='Skipping the Lua-less checks: build/nolua/cgit is missing, run make test'
test_done
exit
}
nolua_query() { CGIT_CONFIG="$PWD/$1" QUERY_STRING="$2" "$nolua"; }
test_expect_success 'the binary reports no Lua' '
"$nolua" --version >tmp &&
grep -F "[-] Lua scripting" tmp
'
test_expect_success 'it serves a page' '
{
echo "virtual-root=/" &&
echo "cache-size=0" &&
echo "repo.url=foo" &&
echo "repo.path=$PWD/repos/foo/.git"
} >plainrc &&
nolua_query plainrc "url=foo/log/" >tmp &&
grep "^Status: 200" tmp &&
grep ">commit 5</a>" tmp
'
test_expect_success 'an exec filter still runs' '
{
cat plainrc &&
echo "repo.commit-filter=exec:$FILTER_DIRECTORY/dump.sh"
} >execrc &&
nolua_query execrc "url=foo/commit/" >tmp &&
grep "COMMIT 5" tmp
'
test_expect_success 'a lua filter is refused with one error page' '
{
cat plainrc &&
echo "repo.commit-filter=lua:$FILTER_DIRECTORY/dump.lua"
} >luarc &&
nolua_query luarc "url=foo/commit/" >tmp 2>err &&
grep "^Status: 500" tmp &&
test $(grep -c "^Status:" tmp) = 1 &&
grep "Built without Lua" err
'
test_done
|