提交 0a0a0f0e 编写于 作者: S sla

8027705: com/sun/jdi/JdbMethodExitTest.sh fails when a background thread is generating events.

Reviewed-by: dcubed
上级 1242e16a
......@@ -156,7 +156,7 @@ class $classname {
// a resume.
$classname xx = new $classname();
System.out.println("threadid="+Thread.currentThread().getId());
bkpt();
// test all possible return types
......@@ -197,6 +197,8 @@ dojdbCmds()
# test all possible return types
runToBkpt @1
debuggeeMatchRegexp "s/threadid=\(.*\)/\1/g"
threadid=$?
cmd untrace
cmd trace methods
......@@ -226,7 +228,7 @@ dojdbCmds()
# trace exit of methods with all the return values
# (but just check a couple of them)
cmd trace go exits
cmd trace go method exits $threadid
cmd cont
jdbFailIfNotPresent "instance of JdbMethodExitTest"
jdbFailIfNotPresent "return value = 8"
......@@ -235,7 +237,7 @@ dojdbCmds()
cmd step up
cmd trace methods
cmd trace methods $threadid
cmd cont
jdbFailIfNotPresent "Method entered:"
cmd cont
......@@ -243,7 +245,9 @@ dojdbCmds()
cmd step up
cmd trace go methods
cmd trace go methods $threadid
cmd cont
cmd cont
cmd cont
jdbFailIfNotPresent "Method entered: \"thread=main\", JdbMethodExitTest.traceMethods1"
jdbFailIfNotPresent 'Method exited: .* JdbMethodExitTest.traceMethods1'
......@@ -251,14 +255,14 @@ dojdbCmds()
cmd step up
cmd trace method exits
cmd trace method exits $threadid
cmd cont
jdbFailIfNotPresent "Method exited: return value = \"traceExits\""
cmd untrace
cmd step up
cmd trace go method exits
cmd trace go method exits $threadid
cmd cont
jdbFailIfNotPresent 'Method exited: .* JdbMethodExitTest.traceExits1'
cmd untrace
......@@ -266,7 +270,7 @@ dojdbCmds()
cmd step # step into traceExit()
cmd trace method exit
cmd trace method exit $threadid
cmd cont
jdbFailIfNotPresent "Method exited: return value = \"traceExit\""
cmd untrace
......@@ -275,7 +279,7 @@ dojdbCmds()
cmd step
cmd step # skip over setting return value in caller :-(
cmd trace go method exit
cmd trace go method exit $threadid
cmd cont
jdbFailIfNotPresent 'Method exited: .*JdbMethodExitTest.traceExit1'
cmd quit
......
......@@ -1004,6 +1004,50 @@ grepForString()
return $stat
}
# $1 is the filename, $2 is the regexp to match and return,
# $3 is the number of lines to search (from the end)
matchRegexp()
{
if [ -z "$3" ] ; then
theCmd=cat
else
theCmd="tail -$3"
fi
case "$2" in
*\>*)
# Target string contains a '>' so we better not ignore it
res=`$theCmd $1 | sed -e "$2"`
;;
*)
# Target string does not contain a '>'.
# NOTE: if $1 does not end with a new line, piping it to sed
# doesn't include the chars on the last line. Detect this
# case, and add a new line.
theFile="$1"
if [ `tail -1 "$theFile" | wc -l | sed -e 's@ @@g'` = 0 ] ; then
# The target file doesn't end with a new line so we have
# add one to a copy of the target file so the sed command
# below can filter that last line.
cp "$theFile" "$theFile.tmp"
theFile="$theFile.tmp"
echo >> "$theFile"
fi
# See bug 6220903. Sometimes the jdb prompt chars ('> ') can
# get interleaved in the target file which can keep us from
# matching the target string.
res=`$theCmd "$theFile" | sed -e 's@> @@g' -e 's@>@@g' \
| sed -e "$2"`
if [ "$theFile" != "$1" ]; then
# remove the copy of the target file
rm -f "$theFile"
fi
unset theFile
esac
return $res
}
# $1 is the filename, $2 is the string to look for,
# $3 is the number of lines to search (from the end)
failIfPresent()
......@@ -1058,6 +1102,14 @@ debuggeeFailIfPresent()
failIfPresent $debuggeeOutFile "$1" $2
}
# match and return the output from the regexp $1 in the debuggee output
# $2 is the number of lines to search (from the end)
debuggeeMatchRegexp()
{
matchRegexp $debuggeeOutFile "$1" $2
}
# This should really be named 'done' instead of pass.
pass()
{
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册