diff options
Diffstat (limited to 'runtests.sh')
-rwxr-xr-x | runtests.sh | 37 |
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 | ||
3 | PLATFORM="`uname -s`" | 3 | PLATFORM="`uname -s`" |
4 | [ "$1" ] && VERSION="$1" || VERSION="1.0devel" | ||
4 | 5 | ||
5 | set -e | 6 | set -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 |
9 | contextgrep() { | 10 | contextgrep() { |
10 | awk "/$1/ { count = ($2 + 1) } count { count--; print }" | 11 | awk "/$1/ { count = ($2 + 1) } count { count--; print }" |
11 | } | 12 | } |
12 | 13 | ||
13 | do_tests() { | 14 | do_tests() { |
@@ -33,11 +34,11 @@ echo "===== Verifying cjson.so is not installed =====" | |||
33 | cd tests | 34 | cd tests |
34 | if lua -e 'require "cjson"' 2>/dev/null | 35 | if lua -e 'require "cjson"' 2>/dev/null |
35 | then | 36 | then |
36 | cat <<EOT | 37 | cat <<EOT |
37 | Please ensure you do not have the Lua CJSON module installed before | 38 | Please ensure you do not have the Lua CJSON module installed before |
38 | running these tests. | 39 | running these tests. |
39 | EOT | 40 | EOT |
40 | exit | 41 | exit |
41 | fi | 42 | fi |
42 | cd .. | 43 | cd .. |
43 | 44 | ||
@@ -66,13 +67,25 @@ rm -rf build tests/cjson.so | |||
66 | 67 | ||
67 | if [ "$PLATFORM" = "Linux" ] | 68 | if [ "$PLATFORM" = "Linux" ] |
68 | then | 69 | then |
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 | ||
78 | fi | 89 | fi |
90 | |||
91 | # vi:ai et sw=4 ts=4: | ||