]> git.sesse.net Git - xml-template/blob - tests/test.sh
Update the PHP SWIG version to PHP 7, with various crash fixes, too.
[xml-template] / tests / test.sh
1 #! /bin/sh
2
3 if [ -z "$TESTS" ]; then
4         TESTS="passthru simple clone include attribute attribute2 attribute3 attribute-empty namespace namespace2 structure"
5 fi
6 if [ -z "$LANGUAGES" ]; then
7         LANGUAGES="perl perl-sax php4 php5 python python3 ruby c++11"
8 fi
9
10 for L in $LANGUAGES; do
11         for T in $TESTS; do
12                 printf "%-35s" "Testing $L/$T..."
13                 TEMPFILE=$( tempfile )
14
15                 if [ "$L" = "perl" ]; then
16                         perl -I../perl ../perl/$T.pl > $TEMPFILE
17                 fi
18                 if [ "$L" = "perl-sax" ]; then
19                         perl -I../perl-sax ../perl-sax/$T.pl > $TEMPFILE
20                 fi
21                 if [ "$L" = "php4" ]; then
22                         php4-cgi -q ../php4/$T.php > $TEMPFILE
23                 fi
24                 if [ "$L" = "php5" ]; then
25                         php5-cgi -q ../php5/$T.php > $TEMPFILE
26                 fi
27                 if [ "$L" = "php7-swig" ]; then
28                         ( cd ../c++11 && make -s && cd ../php7-swig && make -s && sudo cp XML_Template_SWIG.so /usr/lib/php/20151012 ) && php7-cgi -q ../php7-swig/$T.php > $TEMPFILE
29                 fi
30                 if [ "$L" = "python" ]; then
31                         python2 ../python/$T.py > $TEMPFILE
32                 fi
33                 if [ "$L" = "python3" ]; then
34                         python3 ../python/$T.py > $TEMPFILE
35                 fi
36                 if [ "$L" = "ruby" ]; then
37                         ruby -I../ruby ../ruby/$T.rb > $TEMPFILE
38                 fi
39                 if [ "$L" = "c++11" ]; then
40                         ( cd ../c++11 && make -s $T ) && ../c++11/$T > $TEMPFILE
41                 fi
42
43                 perl ./xml-diff.pl $TEMPFILE reference/$T.xml
44                 if [ $? = 0 ]; then     
45                         echo "passed."
46                 fi
47
48                 rm -f $TEMPFILE
49         done
50 done
51