Commit ae8a2c35 authored by Tom Lane's avatar Tom Lane

Make the world safe for QNX's busted shell ...

parent 69b323f4
#!/bin/sh #!/bin/sh
# $Header: /cvsroot/pgsql/src/test/regress/Attic/regress.sh,v 1.50 2000/05/16 02:14:15 tgl Exp $ # $Header: /cvsroot/pgsql/src/test/regress/Attic/regress.sh,v 1.51 2000/05/24 22:32:58 tgl Exp $
# #
if [ $# -eq 0 ]; then if [ $# -eq 0 ]; then
echo "Syntax: $0 <hostname> [extra-tests]" echo "Syntax: $0 <hostname> [extra-tests]"
...@@ -41,17 +41,27 @@ FRONTEND="psql $HOSTLOC -a -q -X" ...@@ -41,17 +41,27 @@ FRONTEND="psql $HOSTLOC -a -q -X"
# testname/hostnamepattern=substitutefile # testname/hostnamepattern=substitutefile
# where the hostnamepattern is evaluated per the rules of expr(1) --- namely, # where the hostnamepattern is evaluated per the rules of expr(1) --- namely,
# it is a standard regular expression with an implicit ^ at the start. # it is a standard regular expression with an implicit ^ at the start.
#
# The tempfile hackery is needed because some shells will run the loop
# inside a subshell, whereupon shell variables set therein aren't seen
# outside the loop :-(
# ---------- # ----------
SUBSTLIST="" TMPFILE="matches.$$"
RESULTMAP=`cat resultmap` cat /dev/null > $TMPFILE
for LINE in $RESULTMAP while read LINE
do do
HOSTPAT=`expr "$LINE" : '.*/\(.*\)='` HOSTPAT=`expr "$LINE" : '.*/\(.*\)='`
if [ `expr "$hostname" : "$HOSTPAT"` -ne 0 ] if [ `expr "$hostname" : "$HOSTPAT"` -ne 0 ]
then then
SUBSTLIST="$SUBSTLIST $LINE" # remove hostnamepattern from line so that there are no shell
# wildcards in SUBSTLIST; else later 'for' could expand them!
TESTNAME=`expr "$LINE" : '\(.*\)/'`
SUBST=`echo "$LINE" | sed 's/^.*=//'`
echo "$TESTNAME=$SUBST" >> $TMPFILE
fi fi
done done <resultmap
SUBSTLIST=`cat $TMPFILE`
rm -f $TMPFILE
if [ -d ./obj ]; then if [ -d ./obj ]; then
cd ./obj cd ./obj
...@@ -97,7 +107,7 @@ fi ...@@ -97,7 +107,7 @@ fi
fi fi
echo "=============== running regression queries... =================" echo "=============== running regression queries... ================="
echo "" > regression.diffs cat /dev/null > regression.diffs
if [ "x$hostname" = "xi386-pc-qnx" ]; then if [ "x$hostname" = "xi386-pc-qnx" ]; then
DIFFOPT="-b" DIFFOPT="-b"
...@@ -123,7 +133,7 @@ do ...@@ -123,7 +133,7 @@ do
EXPECTED="expected/${tst}.out" EXPECTED="expected/${tst}.out"
for LINE in $SUBSTLIST for LINE in $SUBSTLIST
do do
if [ `expr "$LINE" : "$tst/"` -ne 0 ] if [ `expr "$LINE" : "$tst="` -ne 0 ]
then then
SUBST=`echo "$LINE" | sed 's/^.*=//'` SUBST=`echo "$LINE" | sed 's/^.*=//'`
EXPECTED="expected/${SUBST}.out" EXPECTED="expected/${SUBST}.out"
......
#!/bin/sh #!/bin/sh
# #
# $Header: /cvsroot/pgsql/src/test/regress/Attic/run_check.sh,v 1.18 2000/05/18 16:11:39 momjian Exp $ # $Header: /cvsroot/pgsql/src/test/regress/Attic/run_check.sh,v 1.19 2000/05/24 22:32:59 tgl Exp $
# ---------- # ----------
# Check call syntax # Check call syntax
...@@ -104,18 +104,27 @@ FRONTEND="$BINDIR/psql $HOSTLOC -a -q -X" ...@@ -104,18 +104,27 @@ FRONTEND="$BINDIR/psql $HOSTLOC -a -q -X"
# testname/hostnamepattern=substitutefile # testname/hostnamepattern=substitutefile
# where the hostnamepattern is evaluated per the rules of expr(1) --- namely, # where the hostnamepattern is evaluated per the rules of expr(1) --- namely,
# it is a standard regular expression with an implicit ^ at the start. # it is a standard regular expression with an implicit ^ at the start.
#
# The tempfile hackery is needed because some shells will run the loop
# inside a subshell, whereupon shell variables set therein aren't seen
# outside the loop :-(
# ---------- # ----------
SUBSTLIST="" TMPFILE="matches.$$"
exec 4<resultmap cat /dev/null > $TMPFILE
while read LINE <&4 while read LINE
do do
HOSTPAT=`expr "$LINE" : '.*/\(.*\)='` HOSTPAT=`expr "$LINE" : '.*/\(.*\)='`
if [ `expr "$hostname" : "$HOSTPAT"` -ne 0 ] if [ `expr "$hostname" : "$HOSTPAT"` -ne 0 ]
then then
SUBSTLIST="$SUBSTLIST $LINE" # remove hostnamepattern from line so that there are no shell
# wildcards in SUBSTLIST; else later 'for' could expand them!
TESTNAME=`expr "$LINE" : '\(.*\)/'`
SUBST=`echo "$LINE" | sed 's/^.*=//'`
echo "$TESTNAME=$SUBST" >> $TMPFILE
fi fi
done done <resultmap
exec 4<&- SUBSTLIST=`cat $TMPFILE`
rm -f $TMPFILE
# ---------- # ----------
# Catch SIGINT and SIGTERM to shutdown the postmaster # Catch SIGINT and SIGTERM to shutdown the postmaster
...@@ -258,8 +267,8 @@ fi ...@@ -258,8 +267,8 @@ fi
# Run the regression tests specified in the ./sql/run_check.tests file # Run the regression tests specified in the ./sql/run_check.tests file
# ---------- # ----------
echo "=============== Running regression queries... ================" echo "=============== Running regression queries... ================"
echo "" > regression.diffs cat /dev/null > regression.diffs
echo "" > regress.out cat /dev/null > regress.out
if [ "x$hostname" = "xi386-pc-qnx" ]; then if [ "x$hostname" = "xi386-pc-qnx" ]; then
DIFFOPT="-b" DIFFOPT="-b"
...@@ -439,7 +448,7 @@ lno=0 ...@@ -439,7 +448,7 @@ lno=0
EXPECTED="expected/${name}.out" EXPECTED="expected/${name}.out"
for LINE in $SUBSTLIST for LINE in $SUBSTLIST
do do
if [ `expr "$LINE" : "$name/"` -ne 0 ] if [ `expr "$LINE" : "$name="` -ne 0 ]
then then
SUBST=`echo "$LINE" | sed 's/^.*=//'` SUBST=`echo "$LINE" | sed 's/^.*=//'`
EXPECTED="expected/${SUBST}.out" EXPECTED="expected/${SUBST}.out"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment