diff options
Diffstat (limited to 'runtests.sh')
-rwxr-xr-x | runtests.sh | 45 |
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 | |||
3 | MAKE=make | ||
4 | #MAKE=gmake | ||
5 | |||
6 | EGREP="grep -E" | ||
7 | #EGREP="egrep" | ||
8 | |||
9 | set -e | ||
10 | |||
11 | do_tests() { | ||
12 | echo | ||
13 | cd tests | ||
14 | ./test.lua | $EGREP 'version|PASS|FAIL' | ||
15 | cd .. | ||
16 | } | ||
17 | |||
18 | cat <<EOT | ||
19 | Please ensure you do not have the Lua CJSON module installed before | ||
20 | running these tests. | ||
21 | |||
22 | EOT | ||
23 | |||
24 | echo "===== Setting LuaRocks PATH =====" | ||
25 | eval "`luarocks path`" | ||
26 | |||
27 | echo "===== Building UTF-8 test data =====" | ||
28 | ( cd tests && ./genutf8.pl; ) | ||
29 | |||
30 | echo "===== Cleaning old build data =====" | ||
31 | $MAKE clean | ||
32 | rm -f tests/cjson.so | ||
33 | |||
34 | echo "===== Testing LuaRocks build =====" | ||
35 | luarocks make --local | ||
36 | do_tests | ||
37 | luarocks remove --local lua-cjson | ||
38 | $MAKE clean | ||
39 | |||
40 | echo "===== Testing Makefile build =====" | ||
41 | $MAKE | ||
42 | cp cjson.so tests | ||
43 | do_tests | ||
44 | $MAKE clean | ||
45 | rm -f tests/cjson.so | ||