aboutsummaryrefslogtreecommitdiff
path: root/runtests.sh
blob: 1e0a5cd4963bb920127802e95eab4d81da4f620c (plain)
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
#!/bin/sh

MAKE=make
#MAKE=gmake

EGREP="grep -E"
#EGREP="egrep"

set -e

do_tests() {
    echo
    cd tests
    ./test.lua | $EGREP 'version|PASS|FAIL'
    cd ..
}

cat <<EOT
Please ensure you do not have the Lua CJSON module installed before
running these tests.

EOT

echo "===== Setting LuaRocks PATH ====="
eval "`luarocks path`"

echo "===== Building UTF-8 test data ====="
( cd tests && ./genutf8.pl; )

echo "===== Cleaning old build data ====="
$MAKE clean
rm -f tests/cjson.so

echo "===== Testing LuaRocks build ====="
luarocks make --local
do_tests
luarocks remove --local lua-cjson
$MAKE clean

echo "===== Testing Makefile build ====="
$MAKE
cp cjson.so tests
do_tests
$MAKE clean
rm -f tests/cjson.so