OSDN Git Service

* ada/acats/run_acats (which): New function.
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / ada / acats / run_acats
index f2b7872..c389e64 100755 (executable)
@@ -5,10 +5,25 @@ if [ "$testdir" = "" ]; then
    exit 1
 fi
 
+# Provide which replacement.
+#
+# type -p is missing from Solaris 2 /bin/sh and /bin/ksh (ksh88), but both
+# ksh93 and bash have it.
+# type output format differs between ksh88 and ksh93, so avoid it if
+# type -p is present.
+# Fall back to whence which ksh88 and ksh93 provide, but bash does not.
+
+which () {
+    type -p $* 2>/dev/null && return 0
+    type $* 2>/dev/null | awk '{print $3}' && return 0
+    whence $* 2>/dev/null && return 0
+    return 1
+}
+
 # Set up environment to use the Ada compiler from the object tree
 
-host_gnatchop=`type gnatchop | awk '{print $3}'`
-host_gnatmake=`type gnatmake | awk '{print $3}'`
+host_gnatchop=`which gnatchop`
+host_gnatmake=`which gnatmake`
 ROOT=`${PWDCMD-pwd}`
 BASE=`cd $ROOT/../../..; ${PWDCMD-pwd}`
 
@@ -40,7 +55,7 @@ echo '#!/bin/sh' > host_gnatchop
 echo PATH=`dirname $host_gnatchop`:'$PATH' >> host_gnatchop
 echo unset ADA_INCLUDE_PATH ADA_OBJECTS_PATH GCC_EXEC_PREFIX >> host_gnatchop
 echo export PATH >> host_gnatchop
-echo exec $host_gnatchop '"$@"' >> host_gnatchop
+echo exec gnatchop '"$@"' >> host_gnatchop
 
 chmod +x host_gnatchop
 
@@ -48,8 +63,11 @@ echo '#!/bin/sh' > host_gnatmake
 echo PATH=`dirname $host_gnatmake`:'$PATH' >> host_gnatmake
 echo unset ADA_INCLUDE_PATH ADA_OBJECTS_PATH GCC_EXEC_PREFIX >> host_gnatmake
 echo export PATH >> host_gnatmake
-echo exec $host_gnatmake '"$@"' >> host_gnatmake
+echo exec gnatmake '"$@"' >> host_gnatmake
 
 chmod +x host_gnatmake
 
-exec $testdir/run_all.sh "$@"
+# Limit the stack to 16MB for stack checking
+ulimit -s 16384
+
+exec $SHELL $testdir/run_all.sh ${1+"$@"}