/[m4]/m4/tests/stackovf.test
ViewVC logotype

Diff of /m4/tests/stackovf.test

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.2 by gary, Sun May 1 11:10:06 2005 UTC revision 1.3 by gary, Wed May 4 17:19:46 2005 UTC
# Line 1  Line 1 
1  #!/bin/sh  #!/bin/sh
2  # This file is part of the GNU m4 testsuite  # This file is part of the GNU m4 testsuite
3  # Copyright 2000 Free Software Foundation, Inc.  # Copyright (C) 2000, 2003 Free Software Foundation, Inc.
4  #    #
5  # This program is free software; you can redistribute it and/or modify  # This program is free software; you can redistribute it and/or modify
6  # it under the terms of the GNU General Public License as published by  # it under the terms of the GNU General Public License as published by
7  # the Free Software Foundation; either version 2 of the License, or  # the Free Software Foundation; either version 2 of the License, or
8  # (at your option) any later version.  # (at your option) any later version.
9  #  #
10  # This program is distributed in the hope that it will be useful,  # This program is distributed in the hope that it will be useful,
11  # but WITHOUT ANY WARRANTY; without even the implied warranty of  # but WITHOUT ANY WARRANTY; without even the implied warranty of
12  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  # GNU General Public License for more details.  # GNU General Public License for more details.
14  #  #
15  # You should have received a copy of the GNU General Public License  # You should have received a copy of the GNU General Public License
16  # along with this program; if not, write to the Free Software  # along with this program; if not, write to the Free Software
17  # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# Line 26  exit 77 Line 26  exit 77
26  # On some systems the ulimit command is available in ksh or bash but not sh  # On some systems the ulimit command is available in ksh or bash but not sh
27  (exec 2>/dev/null; ulimit -HSs 300) || {  (exec 2>/dev/null; ulimit -HSs 300) || {
28      for altshell in bash bsh ksh ; do      for altshell in bash bsh ksh ; do
29          if (exec >/dev/null 2>&1; $altshell -c 'ulimit -HSs 300') &&          if (exec >/dev/null 2>&1; $altshell -c 'ulimit -HSs 300') &&
30                                                                  test -z "$1"                                                                  test -z "$1"
31          then          then
32                  echo "Using $altshell because it supports ulimit"                  echo "Using $altshell because it supports ulimit"
33                  exec $altshell $0 running-with-$altshell                  exec $altshell $0 running-with-$altshell
# Line 40  PATH=.:..:$PATH; export PATH; Line 40  PATH=.:..:$PATH; export PATH;
40  : ${M4=../../src/m4}  : ${M4=../../src/m4}
41  type $M4  type $M4
42    
43  tmpfile=/tmp/t.$$  tmpfile=`tempfile 2> /dev/null` || tmpfile=/tmp/t.$$
44  trap 'rm -f $tmpfile; exit 1' 1 2 3 15  trap 'rm -f $tmpfile; exit 1' 1 2 3 15
45    
46  rm -f core  rm -f core
# Line 64  then Line 64  then
64          #test -n "$ulimitdashv" && ulimit -HSv 8000          #test -n "$ulimitdashv" && ulimit -HSv 8000
65          echo "Stack limit is `ulimit -s`K";          echo "Stack limit is `ulimit -s`K";
66          echo "Heap limit  is `ulimit -d`K";          echo "Heap limit  is `ulimit -d`K";
67          test -n "$ulimitdashv" &&          test -n "$ulimitdashv" &&
68                  echo "VMem limit  is `ulimit -v`K";                  echo "VMem limit  is `ulimit -v`K";
69  else  else
70          echo "Can't reset stack limit - this may take a while..."          echo "Can't reset stack limit - this may take a while..."
71  fi  fi
72  strace -o /tmp/aaa $M4 -L999999999 > $tmpfile 2>&1  #strace -o /tmp/aaa $M4 -L999999999 > $tmpfile 2>&1
73    $M4 -L999999999 > $tmpfile 2>&1
74  )  )
75  result=$?  result=$?
76  { echo "Output from $M4:"; cat $tmpfile; }  { echo "Output from $M4:"; cat $tmpfile; }
# Line 81  else Line 82  else
82      # See if stack overflow was diagnosed      # See if stack overflow was diagnosed
83      case "`cat $tmpfile`" in      case "`cat $tmpfile`" in
84      *overflow*)      *overflow*)
85          echo "Test succeeded.";          echo "Test succeeded.";
86          exitcode=0          exitcode=0
87          ;;          ;;
88      *ut*of*emory*|*emory*xhausted)      *ut*of*emory*|*emory*xhausted)

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26