aboutsummaryrefslogtreecommitdiff
path: root/runtests.sh
diff options
context:
space:
mode:
Diffstat (limited to 'runtests.sh')
-rwxr-xr-xruntests.sh45
1 files changed, 45 insertions, 0 deletions
diff --git a/runtests.sh b/runtests.sh
new file mode 100755
index 0000000..1e0a5cd
--- /dev/null
+++ b/runtests.sh
@@ -0,0 +1,45 @@
1#!/bin/sh
2
3MAKE=make
4#MAKE=gmake
5
6EGREP="grep -E"
7#EGREP="egrep"
8
9set -e
10
11do_tests() {
12 echo
13 cd tests
14 ./test.lua | $EGREP 'version|PASS|FAIL'
15 cd ..
16}
17
18cat <<EOT
19Please ensure you do not have the Lua CJSON module installed before
20running these tests.
21
22EOT
23
24echo "===== Setting LuaRocks PATH ====="
25eval "`luarocks path`"
26
27echo "===== Building UTF-8 test data ====="
28( cd tests && ./genutf8.pl; )
29
30echo "===== Cleaning old build data ====="
31$MAKE clean
32rm -f tests/cjson.so
33
34echo "===== Testing LuaRocks build ====="
35luarocks make --local
36do_tests
37luarocks remove --local lua-cjson
38$MAKE clean
39
40echo "===== Testing Makefile build ====="
41$MAKE
42cp cjson.so tests
43do_tests
44$MAKE clean
45rm -f tests/cjson.so