aboutsummaryrefslogtreecommitdiff
path: root/runtests.sh
diff options
context:
space:
mode:
Diffstat (limited to 'runtests.sh')
-rwxr-xr-xruntests.sh37
1 files changed, 25 insertions, 12 deletions
diff --git a/runtests.sh b/runtests.sh
index c520be0..d313db3 100755
--- a/runtests.sh
+++ b/runtests.sh
@@ -1,13 +1,14 @@
1#!/bin/sh 1#!/bin/sh
2 2
3PLATFORM="`uname -s`" 3PLATFORM="`uname -s`"
4[ "$1" ] && VERSION="$1" || VERSION="1.0devel"
4 5
5set -e 6set -e
6 7
7# Portable "ggrep -A" replacement 8# Portable "ggrep -A" replacement
8# contextgrep PATTERN POST_MATCH_LINES 9# contextgrep PATTERN POST_MATCH_LINES
9contextgrep() { 10contextgrep() {
10 awk "/$1/ { count = ($2 + 1) } count { count--; print }" 11 awk "/$1/ { count = ($2 + 1) } count { count--; print }"
11} 12}
12 13
13do_tests() { 14do_tests() {
@@ -33,11 +34,11 @@ echo "===== Verifying cjson.so is not installed ====="
33cd tests 34cd tests
34if lua -e 'require "cjson"' 2>/dev/null 35if lua -e 'require "cjson"' 2>/dev/null
35then 36then
36 cat <<EOT 37 cat <<EOT
37Please ensure you do not have the Lua CJSON module installed before 38Please ensure you do not have the Lua CJSON module installed before
38running these tests. 39running these tests.
39EOT 40EOT
40 exit 41 exit
41fi 42fi
42cd .. 43cd ..
43 44
@@ -66,13 +67,25 @@ rm -rf build tests/cjson.so
66 67
67if [ "$PLATFORM" = "Linux" ] 68if [ "$PLATFORM" = "Linux" ]
68then 69then
69 echo "===== Testing RPM build =====" 70 echo "===== Testing RPM build ====="
70 make package 71 SRCTGZ=""
71 LOG=/tmp/build.$$ 72 TGZ=lua-cjson-$VERSION.tar.gz
72 rpmbuild -tb lua-cjson-1.0.4.tar.gz | tee "$LOG" 73 for D in .. packages .
73 RPM="`awk '/^Wrote: / && ! /debuginfo/ { print $2}' < "$LOG"`" 74 do
74 sudo -- rpm -Uvh \"$RPM\" 75 [ -r "$D/$TGZ" ] && SRCTGZ="$D/$TGZ"
75 do_tests 76 done
76 sudo -- rpm -e lua-cjson 77 if [ "$SRCTGZ" ]
77 rm -f "$LOG" 78 then
79 LOG=/tmp/build.$$
80 rpmbuild -tb "$SRCTGZ" > "$LOG"
81 RPM="`awk '/^Wrote: / && ! /debuginfo/ { print $2}' < "$LOG"`"
82 sudo -- rpm -Uvh \"$RPM\"
83 do_tests
84 sudo -- rpm -e lua-cjson
85 rm -f "$LOG"
86 else
87 echo "==> skipping, $TGZ not found"
88 fi
78fi 89fi
90
91# vi:ai et sw=4 ts=4: