texinfo-commits
[Top][All Lists]
Advanced

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

[6291] for Solaris 5.10, avoid grep -q and /bin/sh in tp/tests


From: karl
Subject: [6291] for Solaris 5.10, avoid grep -q and /bin/sh in tp/tests
Date: Sun, 31 May 2015 18:29:38 +0000

Revision: 6291
          http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=6291
Author:   karl
Date:     2015-05-31 18:29:37 +0000 (Sun, 31 May 2015)
Log Message:
-----------
for Solaris 5.10, avoid grep -q and /bin/sh in tp/tests

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/tp/maintain/regenerate_cmd_tests.sh
    trunk/tp/tests/run_parser_all.sh

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog     2015-05-30 22:39:08 UTC (rev 6290)
+++ trunk/ChangeLog     2015-05-31 18:29:37 UTC (rev 6291)
@@ -1,3 +1,14 @@
+2015-05-31  Karl Berry  <address@hidden>
+
+       * tp/tests/run_parser_all.sh,
+       * tp/maintain/regenerate_cmd_tests.sh: use grep >/dev/null
+       instead of -qs; Solaris 5.10 grep does not support -q.
+
+       * tp/tests/run_parser_all.sh: exec /usr/xpg4/bin/sh for Solaris 5.10.
+
+       * tp/tests/run_parser_all.sh: test "z$file" rather than "$zfile",
+       as intended.
+
 2015-05-30  Karl Berry  <address@hidden>
 
        * util/texi2dvi (generated_files_get): another attempt at making

Modified: trunk/tp/maintain/regenerate_cmd_tests.sh
===================================================================
--- trunk/tp/maintain/regenerate_cmd_tests.sh   2015-05-30 22:39:08 UTC (rev 
6290)
+++ trunk/tp/maintain/regenerate_cmd_tests.sh   2015-05-31 18:29:37 UTC (rev 
6291)
@@ -60,7 +60,7 @@
     test_driving_files="$test_driving_files $driving_file"
     while read line
     do
-    if echo $line | grep -qs '^ *#'; then continue; fi
+    if echo $line | grep '^ *#' >/dev/null; then continue; fi
 # there are better ways
     name=`echo $line | awk '{print $1}'`
     arg=$name

Modified: trunk/tp/tests/run_parser_all.sh
===================================================================
--- trunk/tp/tests/run_parser_all.sh    2015-05-30 22:39:08 UTC (rev 6290)
+++ trunk/tp/tests/run_parser_all.sh    2015-05-31 18:29:37 UTC (rev 6291)
@@ -9,8 +9,23 @@
 # are permitted in any medium without royalty provided the copyright
 # notice and this notice are preserved.
 
-#set -x
 
+# Explanation: on Solaris 5.10 (and other?), /bin/sh is the original
+# Bourne shell, where redirecting a while loop (or any compound command)
+# causes execution in a subshell.
+# 
http://unix.stackexchange.com/questions/137680/variable-scope-in-while-read-loop-on-solaris
+# 
+# The result for us being that the assignment to $one_test_done inside
+# the loop is ineffective, causing the test to seemingly fail.  Let's
+# try running under the POSIX sh available on Solaris instead (which
+# sets $RANDOM, whereas /bin/sh does not).
+# 
+# If more problems arise, perhaps we'll be better off just detecting the
+# original Bourne sh and skipping the test.
+#
+test -f /usr/xpg4/bin/sh && test -z "$RANDOM" \
+&& exec /usr/xpg4/bin/sh "$0" "$@"
+
 #echo "SRCDIR $srcdir srcdir_test $srcdir_test"
 
 LC_ALL=C; export LC_ALL
@@ -113,7 +128,7 @@
 fi
 
 first_line=`head -1 "$driving_file"`
-if echo $first_line |grep -qs '^# formats'; then
+if echo $first_line |grep '^# formats' >/dev/null; then
   formats=`echo $first_line |sed 's/^# formats //'`
   commands="$commands $formats"
   echo "found special first line, commands now: $commands" >>$logfile
@@ -129,12 +144,12 @@
 if [ "z$clean" = 'zyes' -o "z$copy" = 'zyes' ]; then
   while read line
   do
-    if echo $line | grep -qs '^ *#'; then continue; fi
+    if echo $line | grep '^ *#' >/dev/null 2>&1; then continue; fi
 # there are better ways
     dir=`echo $line | awk '{print $1}'`
     file=`echo $line | awk '{print $2}'`
     remaining=`echo $line | sed 's/[a-zA-Z0-9_./-]*  *[a-zA-Z0-9_./-]* *//'`
-    [ "z$dir" = 'z' -o "$zfile" = 'z' ] && continue
+    [ "z$dir" = 'z' -o "z$file" = 'z' ] && continue
     basename=`basename $file .texi`
     if [ "z$dir" = 'ztexi' ]; then
       dir="texi_${basename}"
@@ -190,13 +205,13 @@
 
 while read line; do
   # skip comments.
-  if echo $line | grep -qs '^ *#'; then continue; fi
+  if echo $line | grep '^ *#' >/dev/null; then continue; fi
 
   current=`echo $line | awk '{print $1}'`
   file=`echo $line | awk '{print $2}'`
   #
   # skip empty lines.
-  (test "z$current" = 'z' || test "$zfile" = 'z') && continue
+  (test "z$current" = 'z' || test "z$file" = 'z') && continue
   #
   # if we're only doing one test, skip it unless this is the one.
   if test $one_test = 'yes' && test "z$current" != "z$the_test" ; then
@@ -270,10 +285,10 @@
       use_tex4ht=no
       l2h_tmp_dir=
       maybe_use_latex2html=no
-      if echo "$remaining" | grep -qs -- '-l2h'; then
+      if echo "$remaining" | grep '[-]l2h' >/dev/null; then
         maybe_use_latex2html=yes
       fi
-      if echo "$remaining" | grep -qs -- 'L2H 1'; then
+      if echo "$remaining" | grep 'L2H 1' >/dev/null; then
         maybe_use_latex2html=yes
       fi
       if [ $maybe_use_latex2html = 'yes' ]; then
@@ -290,7 +305,7 @@
            fi
         fi
         l2h_tmp_dir="--set-customization-variable 'L2H_TMP $tmp_dir'"
-      elif echo "$remaining" | grep -qs -- '-init tex4ht.pm'; then
+      elif echo "$remaining" | grep '[-]init tex4ht.pm' >/dev/null; then
         if test "$no_tex4ht" = 'yes' ; then
           echo "S: (no tex4ht) $current"
           continue 2
@@ -298,7 +313,7 @@
         use_tex4ht=yes
       fi
       if test $use_tex4ht = 'yes' || test $use_latex2html = 'yes' ; then
-        if echo "$remaining" | grep -qs -- '-init mediawiki.pm'; then
+        if echo "$remaining" | grep '[-]init mediawiki.pm' >/dev/null; then
          if test "$no_html2wiki" = 'yes' ; then
            echo "S: (no html2wiki) $current"
            continue 2




reply via email to

[Prev in Thread] Current Thread [Next in Thread]