OSDN Git Service

2001-05-01 Benjamin Kosnik <bkoz@redhat.com>
[pf3gnuchains/gcc-fork.git] / libstdc++-v3 / mkcheck.in
index bfccb25..0d59d8b 100755 (executable)
@@ -51,11 +51,20 @@ esac
 
 # Compute the flags necessary to run the testsuite.
 saved_ifs=$IFS
-IFS=':'
-set `./tests_flags ${query} $*` || exit 1
-BUILD_DIR=$1; SRC_DIR=$2; PREFIX_DIR=$3; LTCXX=$4; LIBS=$5; LTEXE=$6; CXX=$7; CXXFLAGS=$8;
+# bash 2.01 does the wrong thing with $* if IFS doesn't include space
+if test ${BASH_VERSINFO[1]} = 01 ; then
+    IFS=': '
+else
+    IFS=':'
+fi
+set `../tests_flags ${query} $*` || exit 1
+BUILD_DIR=$1; SRC_DIR=$2; PREFIX_DIR=$3; CXX=$4; CXXFLAGS=$5; INCLUDES=$6; LIBS=$7;
 IFS=$saved_ifs
 
+LIBTOOL="$BUILD_DIR/libtool"
+LTEXE="$LIBTOOL --mode=execute"
+LTCXX="$LIBTOOL --tag=CXX --mode=link $CXX $CXXFLAGS $INCLUDES $LIBS"
+
 # specific libtool flag(s) to force the use of shared libraries, if any
 SH_FLAG=
 
@@ -65,12 +74,10 @@ ST_FLAG="-static"
 
 # Set up the testing directory, which should be in a directory called
 # "testsuite" in the root level of the build directory.
-TEST_DIR="`pwd`/testsuite"
-if [ ! -d "$TEST_DIR" ]; then
-    echo "making directory $TEST_DIR"
-    mkdir $TEST_DIR
-    mkdir $TEST_DIR/.libs    # help libtool keep quiet
-    chmod u+w $TEST_DIR
+TEST_DIR='.'
+# help libtool keep quiet
+if [ ! -d ${TEST_DIR}/.libs ]; then
+    mkdir $TEST_DIR/.libs    
 fi
 
 # the name of the file that will collect and hold all this useful data:
@@ -82,9 +89,9 @@ LOG_FILE="$TEST_DIR/$(date +%Y%m%d)-mkchecklog.txt"
 # the names of the specific test files to be run
 TESTS_FILE="$TEST_DIR/$(date +%Y%m%d)-mkcheckfiles.txt"
 
-# the heap size limit for testsuite binaries; start with a 2MB limit as per
-# http://gcc.gnu.org/ml/libstdc++/2000-10/msg00029.html
-MAX_MEM_USAGE=3072
+# the heap size and virtual mem limit for testsuite binaries
+# See http://gcc.gnu.org/ml/libstdc++/2000-10/msg00029.html
+MAX_MEM_USAGE=16384
 
 #
 # 2: clean, make files, append general test info
@@ -92,6 +99,7 @@ MAX_MEM_USAGE=3072
 
 # Remove old executables.
 rm -rf "$TEST_DIR"/*exe
+rm -rf "$TEST_DIR"/compile.out
 
 # Remove old core files (which now get left in cwd, not $TEST_DIR).
 rm -rf ./*core*
@@ -188,7 +196,7 @@ setup_size_command()
     {
       case $1 in
         TEXT)  TEXT=$(size -A $EXENAME | grep ^.text | awk '{print $2}')  ;;
-        DATA)  DATA=$(size -A $EXENAME | grep -w ^.data | awk '{print $2}')  ;;
+        DATA)  DATA=$(size -A $EXENAME | awk '/^\.data[         ]/{print $2}')  ;;
         SIZE)  SIZE=$(size -A $EXENAME | grep otal | awk '{print $2}')  ;;
       esac
     }
@@ -310,7 +318,7 @@ test_file()
     # and harder as we try compiling at, say, top of the hour; we would
     # eventually have to calculate time_t anyhow.  Or 3) just grab two
     # time_t's (no more overhead than grabbing two date(1)'s).
-    compiler_invocation="$LTCXX $S_FLAG $SRC_NAME -o $EXENAME $LIBS"
+    compiler_invocation="$LTCXX $S_FLAG $SRC_NAME -o $EXENAME"
     COMP_TIME_START=$($TIMER_COMMAND)
     $compiler_invocation >> compile.out 2>&1
     COMP_TIME_END=$($TIMER_COMMAND)
@@ -331,7 +339,8 @@ test_file()
         # printed by the executable will be lost and cannot be redirected,
         # because we need to capture the output of 'time'.  Bummer.
         TIMEFORMAT='timemark %R'
-        E_TIME_TEXT="$(exec 2>&1; ulimit -d $MAX_MEM_USAGE; \
+        E_TIME_TEXT="$(exec 2>&1;                                        \
+                     ulimit -d $MAX_MEM_USAGE; ulimit -v $MAX_MEM_USAGE; \
                      time $LTEXE $EXENAME)"
         E_ABNORMAL_TERMINATION=$?
         E_TIME="$(echo $E_TIME_TEXT | awk '{print $2}')"