]> git.ipfire.org Git - thirdparty/libtool.git/commitdiff
Initial revision
authorGordon Matzigkeit <gord@profitpress.com>
Thu, 5 Mar 1998 16:22:50 +0000 (16:22 +0000)
committerGordon Matzigkeit <gord@gnu.org>
Thu, 5 Mar 1998 16:22:50 +0000 (16:22 +0000)
tests/sh.test [new file with mode: 0755]

diff --git a/tests/sh.test b/tests/sh.test
new file mode 100755 (executable)
index 0000000..6540617
--- /dev/null
@@ -0,0 +1,53 @@
+#! /bin/sh
+# if.test - check that we haven't forgotten a `test' command
+
+# Test script header.
+need_prefix=no
+if test -z "$srcdir"; then
+  srcdir=`echo "$0" | sed 's%/[^/]*$%%'`
+  test "$srcdir" = "$0" && srcdir=.
+  test "${VERBOSE+set}" != "set" && VERBOSE=yes
+fi
+. $srcdir/defs || exit 1
+
+# Check all the "portable" shell scripts.
+status=0
+scripts="$srcdir/../ltconfig $srcdir/../ltmain.sh"
+
+# Check for bad binary operators.
+if egrep -n -e "if[    ]+[\"']?\\$.*(=|-[lg][te]|-eq|-ne)" $scripts; then
+  echo "use \`if test \$something =' instead of \`if \$something ='"
+  status=1
+fi
+
+# Check for bad unary operators.
+if egrep -n -e 'if[    ]+-' $scripts; then
+  echo "use \`if test -X' instead of \`if -X'"
+  status=1
+fi
+
+# Check for using `[' instead of `test'.
+if egrep -n -e 'if[    ]+\[' $scripts; then
+  echo "use \`if test' instead of \`if ['"
+  status=1
+fi
+
+# Check for using test X... instead of test "X...
+if egrep -n -e 'test[  ]+X' $scripts; then
+  echo "use \`test "X..."' instead of \`test X'"
+  status=1
+fi
+
+# Never use test -e.
+if egrep -n -e 'test[  ]+-e' $scripts; then
+  echo "use \`test -f' instead of \`test -e'"
+  status=1
+fi
+
+# Check for problems with variable assignments.
+if egrep -n -e '[^      ]=[^    ].*(break|continue)' $scripts; then
+  echo "assignments on the same line as a \`break' or \`continue' may have no effect"
+  status=1
+fi
+
+exit $status