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 |
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 |
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 |
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; } |
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) |