[gtk-doc] tests: make tests compatible with the traditional Bourne shell



commit 4f02955a6f36ce23bc84773bd61ce3b5c8dba78f
Author: Tim Mooney <mooney dogbert cc ndsu nodak edu>
Date:   Thu Jan 19 10:34:02 2012 +0100

    tests: make tests compatible with the traditional Bourne shell

 gtkdoc-mkhtml.in  |    5 +++--
 tests/fail.sh     |   19 ++++++++++---------
 tests/sanity.sh   |   35 ++++++++++++++++++-----------------
 tests/tools.sh.in |   15 ++++++++-------
 4 files changed, 39 insertions(+), 35 deletions(-)
---
diff --git a/gtkdoc-mkhtml.in b/gtkdoc-mkhtml.in
index dd8651c..8c4af98 100644
--- a/gtkdoc-mkhtml.in
+++ b/gtkdoc-mkhtml.in
@@ -51,9 +51,10 @@ fi
 if test $uninstalled = yes; then
     # this does not work from buiddir!=srcdir
     gtkdocdir=`dirname $0`
-    if test ! -e $gtkdocdir/gtk-doc.xsl; then
+	# traditional Bourne shells may not support -e here, use -f
+    if test ! -f $gtkdocdir/gtk-doc.xsl; then
         # try to src dir (set from makefiles) too
-        if test -e $ABS_TOP_SRCDIR/gtk-doc.xsl; then
+        if test -f $ABS_TOP_SRCDIR/gtk-doc.xsl; then
             gtkdocdir=$ABS_TOP_SRCDIR
         fi
     fi
diff --git a/tests/fail.sh b/tests/fail.sh
index a116729..f91ec37 100755
--- a/tests/fail.sh
+++ b/tests/fail.sh
@@ -14,26 +14,27 @@ echo "Running suite(s): gtk-doc-$suite";
 # check missing section description
 # we can't just check for a missing "tester_nodocs" entry
 grep >/dev/null "tester_nodocs:Long_Description" $DOC_MODULE-undocumented.txt
-if test $? = 1 ; then failed=$(($failed + 1)); fi
-tested=$(($tested + 1))
+if test $? = 1 ; then failed=`expr $failed + 1`; fi
+tested=`expr $tested + 1`
 
 # check missing section long description
 grep >/dev/null "tester_nolongdesc:Long_Description" $DOC_MODULE-undocumented.txt
-if test $? = 1 ; then failed=$(($failed + 1)); fi
-tested=$(($tested + 1))
+if test $? = 1 ; then failed=`expr $failed + 1`; fi
+tested=`expr $tested + 1`
 
 # check missing section short description
 grep >/dev/null "tester_noshortdesc:Short_Description" $DOC_MODULE-undocumented.txt
-if test $? = 1 ; then failed=$(($failed + 1)); fi
-tested=$(($tested + 1))
+if test $? = 1 ; then failed=`expr $failed + 1`; fi
+tested=`expr $tested + 1`
 
 # check enums
 grep >/dev/null "EnumNoItemDocs (<items>)" $DOC_MODULE-undocumented.txt
-if test $? = 1 ; then failed=$(($failed + 1)); fi
-tested=$(($tested + 1))
+if test $? = 1 ; then failed=`expr $failed + 1`; fi
+tested=`expr $tested + 1`
 
 # summary
-rate=$((100*($tested - $failed)/$tested));
+successes=`expr $tested - $failed`
+rate=`expr 100 \* $successes / $tested`;
 echo "$rate %: Checks $tested, Failures: $failed"
 
 test $failed = 0
diff --git a/tests/sanity.sh b/tests/sanity.sh
index 7ce47f5..4f064fb 100755
--- a/tests/sanity.sh
+++ b/tests/sanity.sh
@@ -13,24 +13,24 @@ nok=0
 for path in $dir/*/docs*/html; do
   if test ! -s $path/index.html ; then
     echo 1>&2 "no or empty $path/index.html"
-    nok=$(($nok + 1)); break;
+    nok=`expr $nok + 1`; break;
   fi
   if test ! -s $path/index.sgml ; then
     echo 1>&2 "no or empty $path/index.sgml"
-    nok=$(($nok + 1)); break;
+    nok=`expr $nok + 1`; break;
   fi
   if test ! -s $path/home.png ; then
     echo 1>&2 "no or empty $path/home.png"
-    nok=$(($nok + 1)); break;
+    nok=`expr $nok + 1`; break;
   fi
   file=`echo $path/*.devhelp2`
   if test ! -s $file ; then
     echo 1>&2 "no or empty $file"
-    nok=$(($nok + 1)); break;
+    nok=`expr $nok + 1`; break;
   fi
 done
-if test $nok -gt 0 ; then failed=$(($failed + 1)); fi
-tested=$(($tested + 1))
+if test $nok -gt 0 ; then failed=`expr $failed + 1`; fi
+tested=`expr $tested + 1`
 
 
 # check online/anchor tags
@@ -39,16 +39,16 @@ for file in $dir/*/docs*/html/index.sgml; do
   grep >/dev/null "<ONLINE href=" $file
   if test $? = 1 ; then
     echo 1>&2 "missing ONLINE reference in $file"
-    nok=$(($nok + 1)); break;
+    nok=`expr $nok + 1`; break;
   fi
   grep >/dev/null "<ANCHOR id=" $file
   if test $? = 1 ; then
     echo 1>&2 "missing ANCHOR reference in $file"
-    nok=$(($nok + 1)); break;
+    nok=`expr $nok + 1`; break;
   fi
 done
-if test $nok -gt 0 ; then failed=$(($failed + 1)); fi
-tested=$(($tested + 1))
+if test $nok -gt 0 ; then failed=`expr $failed + 1`; fi
+tested=`expr $tested + 1`
 
 
 # check validity of generated xml files
@@ -57,11 +57,11 @@ for file in $dir/*/docs*/xml/*.xml; do
   xmllint --noout --noent $file
   if test $? != 0 ; then
     echo 1>&2 "xml validity check failed for $file"
-    nok=$(($nok + 1));
+    nok=`expr $nok + 1`;
   fi
 done
-if test $nok -gt 0 ; then failed=$(($failed + 1)); fi
-tested=$(($tested + 1))
+if test $nok -gt 0 ; then failed=`expr $failed + 1`; fi
+tested=`expr $tested + 1`
 
 
 # check validity of generated sgml files
@@ -70,15 +70,16 @@ for file in $dir/*/docs*/xml/*.sgml; do
   xmllint --noout --noent $file
   if test $? != 0 ; then
     echo 1>&2 "sgml validity check failed for $file"
-    nok=$(($nok + 1));
+    nok=`expr $nok + 1`;
   fi
 done
-if test $nok -gt 0 ; then failed=$(($failed + 1)); fi
-tested=$(($tested + 1))
+if test $nok -gt 0 ; then failed=`expr $failed + 1`; fi
+tested=`expr $tested + 1`
 
 
 # summary
-rate=$((100*($tested - $failed)/$tested));
+successes=`expr $tested - $failed`
+rate=`expr 100 \* $successes / $tested`;
 echo "$rate %: Checks $tested, Failures: $failed"
 
 test $failed = 0
diff --git a/tests/tools.sh.in b/tests/tools.sh.in
index 95c5fca..28ba163 100644
--- a/tests/tools.sh.in
+++ b/tests/tools.sh.in
@@ -12,29 +12,30 @@ echo "Running suite(s): gtk-doc-$suite";
 # test perl scripts
 for file in gtkdoc-check gtkdoc-fixxref gtkdoc-mkdb gtkdoc-mktmpl gtkdoc-rebase gtkdoc-scan gtkdoc-scangobj gtkdoc-scanobj ; do
   @PERL@ -cwT `which $file`
-  if test $? = 1 ; then failed=$(($failed + 1)); fi
-  tested=$(($tested + 1))
+  if test $? = 1 ; then failed=`expr $failed + 1`; fi
+  tested=`expr $tested + 1`
 done
 
 
 # test shell scripts
 for file in gtkdoc-mkhtml gtkdoc-mkman gtkdoc-mkpdf gtkdocize; do
   sh -n `which $file`
-  if test $? != 0 ; then failed=$(($failed + 1)); fi
-  tested=$(($tested + 1))
+  if test $? != 0 ; then failed=`expr $failed + 1`; fi
+  tested=`expr $tested + 1`
 done
 
 
 # test xsl files
 for file in $ABS_TOP_SRCDIR/*.xsl; do
   xmllint --noout --noent $file
-  if test $? != 0 ; then failed=$(($failed + 1)); fi
-  tested=$(($tested + 1))
+  if test $? != 0 ; then failed=`expr $failed + 1`; fi
+  tested=`expr $tested + 1`
 done
 
 # summary
+successes=`expr $tested - $failed`
 
-rate=$((100*($tested - $failed)/$tested));
+rate=`expr 100 \* $successes / $tested`;
 echo "$rate %: Checks $tested, Failures: $failed"
 
 test $failed = 0



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]