#!/bin/sh # The build without Lua has to serve pages like the full one and run the exec # filters, and a filter written with the lua: prefix has to be refused with a # message naming the cause. make test builds it into build/nolua beside the # ordinary binary. The shared cgitrc may itself name lua filters, so every # request here carries a config of its own. test_description='Check the build without Lua' . ./setup.sh nolua="$TEST_OUTPUT_DIRECTORY/../build/nolua/cgit" test_lazy_prereq CGIT_NOLUA 'test -x "$nolua"' test_have_prereq CGIT_NOLUA || { skip_all='Skipping the Lua-less checks: build/nolua/cgit is missing, run make test' test_done } # The helpers run the first cgit on PATH, which this binary now becomes, or # under Valgrind the one the wrapper is pointed at. if test -n "$CGIT_TEST_VALGRIND" then CGIT_VALGRIND_BINARY=$nolua export CGIT_VALGRIND_BINARY else PATH="${nolua%/cgit}:$PATH" fi test_expect_success 'the binary reports no Lua' ' cgit --version >tmp && grep -F "[-] Lua scripting" tmp ' test_expect_success 'it serves a page' ' cgitrc_repo plainrc foo && cgit_ok plainrc "url=foo/log/" >tmp && grep ">commit 5" tmp ' test_expect_success 'an exec filter still runs' ' cgitrc_repo execrc foo "repo.commit-filter=exec:$FILTER_DIRECTORY/dump.sh" && cgit_ok execrc "url=foo/commit/" >tmp && grep "COMMIT 5" tmp ' test_expect_success 'a lua filter is refused with one error page' ' cgitrc_repo luarc foo "repo.commit-filter=lua:$FILTER_DIRECTORY/dump.lua" && cgit_rc luarc "url=foo/commit/" >tmp 2>err && grep "^Status: 500" tmp && test $(grep -c "^Status:" tmp) = 1 && grep "Built without Lua" err ' test_done