Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
3ee7b379
D
dragonwell8_jdk
项目概览
openanolis
/
dragonwell8_jdk
通知
4
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dragonwell8_jdk
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
3ee7b379
编写于
2月 15, 2016
作者:
K
kshefov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8038963: com/sun/jdi tests fail because cygwin's ps sometimes misses processes
Reviewed-by: coffeys
上级
dc3ef3c5
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
58 addition
and
75 deletion
+58
-75
test/com/sun/jdi/ShellScaffold.sh
test/com/sun/jdi/ShellScaffold.sh
+58
-75
未找到文件。
test/com/sun/jdi/ShellScaffold.sh
浏览文件 @
3ee7b379
...
@@ -43,11 +43,11 @@
...
@@ -43,11 +43,11 @@
# in your java file
# in your java file
# classname=<classnam> Omit this to use the default class name, 'shtest'.
# classname=<classnam> Omit this to use the default class name, 'shtest'.
# compileOptions=<string> compile options for at least the first compile,
# compileOptions=<string> compile options for at least the first compile,
# eg, compileOptions=-g
# eg, compileOptions=-g
# compileOptions2=<string> Options for the 2nd, ..., compile. compileOptions1
# compileOptions2=<string> Options for the 2nd, ..., compile. compileOptions1
# is used if this is not set. To use no compile
# is used if this is not set. To use no compile
# options for the 2nd ... compiles, do
# options for the 2nd ... compiles, do
# compileOptions2=none
# compileOptions2=none
#
#
# mode=-Xcomp or mode=-Xint to run in these modes. These should not
# mode=-Xcomp or mode=-Xint to run in these modes. These should not
...
@@ -88,12 +88,12 @@
...
@@ -88,12 +88,12 @@
#
#
# The only other tag supported is @1 breakpoint. The setbkpts function
# The only other tag supported is @1 breakpoint. The setbkpts function
# sets bkpts at all lines that contain this string.
# sets bkpts at all lines that contain this string.
#
#
# Currently, all these tags are start with @1. It is envisioned that this script
# Currently, all these tags are start with @1. It is envisioned that this script
# could be ehanced to allow multiple cycles of redefines by allowing
# could be ehanced to allow multiple cycles of redefines by allowing
# @2, @3, ... tags. IE, processing the @i tags in the ith version of
# @2, @3, ... tags. IE, processing the @i tags in the ith version of
# the file will produce the i+1th version of the file.
# the file will produce the i+1th version of the file.
#
#
# There are problem with jtreg leaving behind orphan java and jdb processes
# There are problem with jtreg leaving behind orphan java and jdb processes
# when this script is run. Sometimes, on some platforms, it just doesn't
# when this script is run. Sometimes, on some platforms, it just doesn't
# get them all killed properly.
# get them all killed properly.
...
@@ -110,7 +110,7 @@
...
@@ -110,7 +110,7 @@
#
#
# mks 6.2a on win 98 presents two problems:
# mks 6.2a on win 98 presents two problems:
# $! returns the PID as a negative number whereas ps returns
# $! returns the PID as a negative number whereas ps returns
# it in the form 0xFFF.... This means our trick of
# it in the form 0xFFF.... This means our trick of
# of using $! to get the PIDs of the jdb and debuggee processes
# of using $! to get the PIDs of the jdb and debuggee processes
# doesn't work. This will cause some error cases to fail
# doesn't work. This will cause some error cases to fail
# with a jtreg timeout instead of failing more gracefully.
# with a jtreg timeout instead of failing more gracefully.
...
@@ -167,7 +167,7 @@ killOrphans()
...
@@ -167,7 +167,7 @@ killOrphans()
# then use ps to find the cygwin pid to be killed.
# then use ps to find the cygwin pid to be killed.
# The form of a ps output line is
# The form of a ps output line is
# ^ ddddd dddd dddd dddd.*
# ^ ddddd dddd dddd dddd.*
# where the 4th digits are the win pid and the first
# where the 4th digits are the win pid and the first
# are the cygwin pid.
# are the cygwin pid.
if
[
-r
"
$jdk
/bin/
$jstack
"
]
;
then
if
[
-r
"
$jdk
/bin/
$jstack
"
]
;
then
winPid
=
`
$jdk
/bin/jps
-v
|
$grep
-i
$str
|
sed
-e
's@ .*@@'
`
winPid
=
`
$jdk
/bin/jps
-v
|
$grep
-i
$str
|
sed
-e
's@ .*@@'
`
...
@@ -181,7 +181,7 @@ killOrphans()
...
@@ -181,7 +181,7 @@ killOrphans()
awk
'{print $1}'
|
tr
'\n\r'
' '
`
awk
'{print $1}'
|
tr
'\n\r'
' '
`
fi
fi
else
else
# Well, too bad - we can't find what to kill.
# Well, too bad - we can't find what to kill.
toBeKilled
=
toBeKilled
=
fi
fi
fi
fi
...
@@ -190,35 +190,31 @@ killOrphans()
...
@@ -190,35 +190,31 @@ killOrphans()
echo
"
$1
: kill -9
$toBeKilled
"
>
& 2
echo
"
$1
: kill -9
$toBeKilled
"
>
& 2
kill
-9
$toBeKilled
kill
-9
$toBeKilled
fi
fi
}
}
findPid
()
findPid
()
{
{
# Return 0 if $1 is the pid of a running process.
# Return 0 if $1 is the pid of a running process.
if
[
-z
"
$isWin98
"
]
;
then
case
"
$osname
"
in
if
[
"
$osname
"
=
SunOS
]
;
then
SunOS
|
AIX
)
# Solaris and OpenSolaris use pgrep and not ps in psCmd
$psCmd
|
$grep
'^ *'
"
$1
"
>
$devnull
2>&1
findPidCmd
=
"
$psCmd
"
res
=
$?
elif
[
"
$osname
"
=
AIX
]
;
then
;;
findPidCmd
=
"
$psCmd
"
Windows
*
|
CYGWIN
*
)
else
# Don't use ps on cygwin since it sometimes misses
# some processes (!).
tasklist /NH |
$grep
"
$1
"
>
$devnull
2>&1
res
=
$?
;;
*
)
# Never use plain 'ps', which requires a "controlling terminal"
# Never use plain 'ps', which requires a "controlling terminal"
# and will fail with a "ps: no controlling terminal" error.
# and will fail with a "ps: no controlling terminal" error.
# Running under 'rsh' will cause this ps error.
# Running under 'rsh' will cause this ps error.
# cygwin ps puts an I in column 1 for some reason.
$psCmd
-e
|
$grep
'^ *'
"
$1
"
>
$devnull
2>&1
findPidCmd
=
"
$psCmd
-e"
res
=
$?
fi
;;
$findPidCmd
|
$grep
'^I* *'
"
$1
"
>
$devnull
2>&1
esac
return
$?
return
$res
fi
# mks 6.2a on win98 has $! getting a negative
# number and in ps, it shows up as 0x...
# Thus, we can't search in ps output for
# PIDs gotten via $!
# We don't know if it is running or not - assume it is.
# We don't really care about win98 anymore.
return
0
}
}
setup
()
setup
()
...
@@ -245,20 +241,13 @@ setup()
...
@@ -245,20 +241,13 @@ setup()
echo
"--Error: TESTJAVA must be defined as the pathname of a jdk to test."
echo
"--Error: TESTJAVA must be defined as the pathname of a jdk to test."
exit
1
exit
1
fi
fi
ulimitCmd
=
ulimitCmd
=
osname
=
`
uname
-s
`
osname
=
`
uname
-s
`
isWin98
=
isCygwin
=
isCygwin
=
case
"
$osname
"
in
case
"
$osname
"
in
Windows
*
|
CYGWIN
*
)
Windows
*
|
CYGWIN
*
)
devnull
=
NUL
devnull
=
NUL
if
[
"
$osname
"
=
Windows_98
-o
"
$osname
"
=
Windows_ME
]
;
then
isWin98
=
1
debuggeeKeyword
=
'we_cant_kill_debuggees_on_win98'
jdbKeyword
=
'jdb\.exe'
fi
case
"
$osname
"
in
case
"
$osname
"
in
CYGWIN
*
)
CYGWIN
*
)
isCygwin
=
1
isCygwin
=
1
...
@@ -373,12 +362,12 @@ EOF
...
@@ -373,12 +362,12 @@ EOF
####################################################3
####################################################3
####################################################3
####################################################3
####################################################3
####################################################3
# sol: this gets all processes killed but
# sol: this gets all processes killed but
# no jstack
# no jstack
# linux same as above
# linux same as above
# win mks: No dice; processes still running
# win mks: No dice; processes still running
trap
"cleanup"
0 1 2 3 4 6 9 10 15
trap
"cleanup"
0 1 2 3 4 6 9 10 15
jdbOptions
=
"
$jdbOptions
-J-D
${
jdbKeyword
}
"
jdbOptions
=
"
$jdbOptions
-J-D
${
jdbKeyword
}
"
}
}
...
@@ -397,7 +386,7 @@ docompile()
...
@@ -397,7 +386,7 @@ docompile()
cp
$classname
.java.1
$classname
.java
cp
$classname
.java.1
$classname
.java
echo
"--Compiling first version of
`
pwd
`
/
$classname
.java with options:
$compileOptions
"
echo
"--Compiling first version of
`
pwd
`
/
$classname
.java with options:
$compileOptions
"
# Result is in $pkgSlash$classname.class
# Result is in $pkgSlash$classname.class
if
[
-z
"
$javacCmd
"
]
;
then
if
[
-z
"
$javacCmd
"
]
;
then
javacCmd
=
$jdk
/bin/javac
javacCmd
=
$jdk
/bin/javac
fi
fi
...
@@ -435,7 +424,7 @@ docompile()
...
@@ -435,7 +424,7 @@ docompile()
if
[
$?
=
0
]
;
then
if
[
$?
=
0
]
;
then
break
break
fi
fi
echo
echo
echo
"--Compiling second version of
`
pwd
`
/
$classname
.java with
$compileOptions
"
echo
"--Compiling second version of
`
pwd
`
/
$classname
.java with
$compileOptions
"
$javacCmd
$compileOptions
-d
.
$classname
.java
$javacCmd
$compileOptions
-d
.
$classname
.java
if
[
$?
!=
0
]
;
then
if
[
$?
!=
0
]
;
then
...
@@ -464,7 +453,7 @@ docompile()
...
@@ -464,7 +453,7 @@ docompile()
if
[
$?
=
0
]
;
then
if
[
$?
=
0
]
;
then
break
break
fi
fi
echo
echo
echo
"--Compiling third version of
`
pwd
`
/
$classname
.java with
$compileOptions
"
echo
"--Compiling third version of
`
pwd
`
/
$classname
.java with
$compileOptions
"
$javacCmd
$compileOptions
-d
.
$classname
.java
$javacCmd
$compileOptions
-d
.
$classname
.java
if
[
$?
!=
0
]
;
then
if
[
$?
!=
0
]
;
then
...
@@ -490,7 +479,7 @@ docompile()
...
@@ -490,7 +479,7 @@ docompile()
if
[
$?
=
0
]
;
then
if
[
$?
=
0
]
;
then
break
break
fi
fi
echo
echo
echo
"--Compiling fourth version of
`
pwd
`
/
$classname
.java with
$compileOptions
"
echo
"--Compiling fourth version of
`
pwd
`
/
$classname
.java with
$compileOptions
"
$javacCmd
$compileOptions
-d
.
$classname
.java
$javacCmd
$compileOptions
-d
.
$classname
.java
if
[
$?
!=
0
]
;
then
if
[
$?
!=
0
]
;
then
...
@@ -523,7 +512,7 @@ docompile()
...
@@ -523,7 +512,7 @@ docompile()
# If it ever becomes necessary to send a jdb command before
# If it ever becomes necessary to send a jdb command before
# a main[10] form of prompt appears, then this
# a main[10] form of prompt appears, then this
# code will have to be modified.
# code will have to be modified.
cmd
()
cmd
()
{
{
if
[
$1
=
quit
-o
-r
"
$failFile
"
]
;
then
if
[
$1
=
quit
-o
-r
"
$failFile
"
]
;
then
# if jdb got a cont cmd that caused the debuggee
# if jdb got a cont cmd that caused the debuggee
...
@@ -540,21 +529,21 @@ cmd()
...
@@ -540,21 +529,21 @@ cmd()
# in the pipeline.
# in the pipeline.
exit
1
exit
1
fi
fi
# $jdbOutFile always exists here and is non empty
# $jdbOutFile always exists here and is non empty
# because after starting jdb, we waited
# because after starting jdb, we waited
# for the prompt.
# for the prompt.
fileSize
=
`
wc
-c
$jdbOutFile
|
awk
'{ print $1 }'
`
fileSize
=
`
wc
-c
$jdbOutFile
|
awk
'{ print $1 }'
`
echo
"--Sending cmd: "
$*
>
&2
echo
"--Sending cmd: "
$*
>
&2
# jjh: We have a few intermittent failures here.
# jjh: We have a few intermittent failures here.
# It is as if every so often, jdb doesn't
# It is as if every so often, jdb doesn't
# get the first cmd that is sent to it here.
# get the first cmd that is sent to it here.
# (actually, I have seen it get the first cmd ok,
# (actually, I have seen it get the first cmd ok,
# but then not get some subsequent cmd).
# but then not get some subsequent cmd).
# It seems like jdb really doesn't get the cmd; jdb's response
# It seems like jdb really doesn't get the cmd; jdb's response
# does not appear in the jxdboutput file. It contains:
# does not appear in the jxdboutput file. It contains:
# main[1]
# main[1]
# The application has been disconnected
# The application has been disconnected
# Is it possible
# Is it possible
...
@@ -569,7 +558,7 @@ cmd()
...
@@ -569,7 +558,7 @@ cmd()
# msg output below after the timeout.
# msg output below after the timeout.
# And, we know jdb is started because the main[1] output is in the .jtr
# And, we know jdb is started because the main[1] output is in the .jtr
# file. And, we wouldn't have gotten here if mydojdbcmds hadn't
# file. And, we wouldn't have gotten here if mydojdbcmds hadn't
# seen the ].
# seen the ].
echo
$*
echo
$*
# Now we have to wait for the next jdb prompt. We wait for a pattern
# Now we have to wait for the next jdb prompt. We wait for a pattern
...
@@ -605,7 +594,7 @@ cmd()
...
@@ -605,7 +594,7 @@ cmd()
# i.e., the > prompt comes out AFTER the prompt we we need to wait for.
# i.e., the > prompt comes out AFTER the prompt we we need to wait for.
#
#
# So, how do we know when the next prompt has appeared??
# So, how do we know when the next prompt has appeared??
# 1. Search for
# 1. Search for
# main[89] $
# main[89] $
# This will handle cases 1, 2, 3
# This will handle cases 1, 2, 3
# 2. This leaves cases 4 and 5.
# 2. This leaves cases 4 and 5.
...
@@ -715,7 +704,7 @@ waitForJdbMsg()
...
@@ -715,7 +704,7 @@ waitForJdbMsg()
allowExit
=
"
$3
"
allowExit
=
"
$3
"
myCount
=
0
myCount
=
0
timeLimit
=
40
# wait a max of this many secs for a response from a jdb command
timeLimit
=
40
# wait a max of this many secs for a response from a jdb command
while
[
1
=
1
]
;
do
while
[
1
=
1
]
;
do
if
[
-r
$jdbOutFile
]
;
then
if
[
-r
$jdbOutFile
]
;
then
# Something here causes jdb to complain about Unrecognized cmd on x86.
# Something here causes jdb to complain about Unrecognized cmd on x86.
tail
-
$nlines
$jdbOutFile
|
$grep
-s
"
$1
"
>
$devnull
2>&1
tail
-
$nlines
$jdbOutFile
|
$grep
-s
"
$1
"
>
$devnull
2>&1
...
@@ -723,27 +712,27 @@ waitForJdbMsg()
...
@@ -723,27 +712,27 @@ waitForJdbMsg()
# Found desired string
# Found desired string
break
break
fi
fi
fi
fi
tail
-2
$jdbOutFile
|
$grep
-s
"The application exited"
>
$devnull
2>&1
tail
-2
$jdbOutFile
|
$grep
-s
"The application exited"
>
$devnull
2>&1
if
[
$?
=
0
]
;
then
if
[
$?
=
0
]
;
then
# Found 'The application exited'
# Found 'The application exited'
if
[
!
-z
"
$allowExit
"
]
;
then
if
[
!
-z
"
$allowExit
"
]
;
then
break
break
fi
fi
# Otherwise, it is an error if we don't find $1
# Otherwise, it is an error if we don't find $1
if
[
-r
$jdbOutFile
]
;
then
if
[
-r
$jdbOutFile
]
;
then
tail
-
$nlines
$jdbOutFile
|
$grep
-s
"
$1
"
>
$devnull
2>&1
tail
-
$nlines
$jdbOutFile
|
$grep
-s
"
$1
"
>
$devnull
2>&1
if
[
$?
=
0
]
;
then
if
[
$?
=
0
]
;
then
break
break
fi
fi
fi
fi
dofail
"Waited for jdb msg
$1
, but it never appeared"
dofail
"Waited for jdb msg
$1
, but it never appeared"
fi
fi
sleep
${
sleep_seconds
}
sleep
${
sleep_seconds
}
findPid
$topPid
findPid
$topPid
if
[
$?
!=
0
]
;
then
if
[
$?
!=
0
]
;
then
# Top process is dead. We better die too
echo
"--Top process (
$topPid
) is dead. We better die too"
>
&2
dojstack
dojstack
exit
1
exit
1
fi
fi
...
@@ -788,7 +777,7 @@ dofail()
...
@@ -788,7 +777,7 @@ dofail()
}
}
redefineClass
()
redefineClass
()
{
{
if
[
-z
"
$1
"
]
;
then
if
[
-z
"
$1
"
]
;
then
vers
=
2
vers
=
2
...
@@ -796,7 +785,7 @@ redefineClass()
...
@@ -796,7 +785,7 @@ redefineClass()
vers
=
`
echo
$1
|
sed
-e
's/@//'
`
vers
=
`
echo
$1
|
sed
-e
's/@//'
`
vers
=
`
expr
$vers
+ 1
`
vers
=
`
expr
$vers
+ 1
`
fi
fi
cmd redefine
$pkgDot$classname
$tmpFileDir
/vers
$vers
/
$classname
.class
cmd redefine
$pkgDot$classname
$tmpFileDir
/vers
$vers
/
$classname
.class
cp
$tmpFileDir
/
$classname
.java.
$vers
\
cp
$tmpFileDir
/
$classname
.java.
$vers
\
...
@@ -853,7 +842,7 @@ startDebuggee()
...
@@ -853,7 +842,7 @@ startDebuggee()
if
[
-r
$TESTCLASSES
/../@debuggeeVMOptions
]
;
then
if
[
-r
$TESTCLASSES
/../@debuggeeVMOptions
]
;
then
args
=
`
cat
$TESTCLASSES
/../@debuggeeVMOptions
`
args
=
`
cat
$TESTCLASSES
/../@debuggeeVMOptions
`
fi
fi
if
[
!
-z
"
$args
"
]
;
then
if
[
!
-z
"
$args
"
]
;
then
echo
"--Starting debuggee with args from @debuggeeVMOptions:
$args
"
echo
"--Starting debuggee with args from @debuggeeVMOptions:
$args
"
else
else
...
@@ -931,12 +920,6 @@ waitForFinish()
...
@@ -931,12 +920,6 @@ waitForFinish()
if
[
$?
!=
0
]
;
then
if
[
$?
!=
0
]
;
then
break
break
fi
fi
if
[
!
-z
"
$isWin98
"
]
;
then
$psCmd
|
$grep
-i
'JDB\.EXE'
>
$devnull
2>&1
if
[
$?
!=
0
]
;
then
break
;
fi
fi
$grep
-s
'Input stream closed'
$jdbOutFile
>
$devnull
2>&1
$grep
-s
'Input stream closed'
$jdbOutFile
>
$devnull
2>&1
if
[
$?
=
0
]
;
then
if
[
$?
=
0
]
;
then
#something went wrong
#something went wrong
...
@@ -970,7 +953,7 @@ grepForString()
...
@@ -970,7 +953,7 @@ grepForString()
theCmd
=
"tail -
$3
"
theCmd
=
"tail -
$3
"
fi
fi
case
"
$2
"
in
case
"
$2
"
in
*
\>
*
)
*
\>
*
)
# Target string contains a '>' so we better not ignore it
# Target string contains a '>' so we better not ignore it
$theCmd
$1
|
$grep
-s
"
$2
"
>
$devnull
2>&1
$theCmd
$1
|
$grep
-s
"
$2
"
>
$devnull
2>&1
...
@@ -1016,7 +999,7 @@ matchRegexp()
...
@@ -1016,7 +999,7 @@ matchRegexp()
theCmd
=
"tail -
$3
"
theCmd
=
"tail -
$3
"
fi
fi
case
"
$2
"
in
case
"
$2
"
in
*
\>
*
)
*
\>
*
)
# Target string contains a '>' so we better not ignore it
# Target string contains a '>' so we better not ignore it
res
=
`
$theCmd
$1
|
sed
-e
"
$2
"
`
res
=
`
$theCmd
$1
|
sed
-e
"
$2
"
`
...
@@ -1136,7 +1119,7 @@ runit()
...
@@ -1136,7 +1119,7 @@ runit()
runitAfterSetup
()
runitAfterSetup
()
{
{
docompile
docompile
startJdb
startJdb
startDebuggee
startDebuggee
waitForFinish
waitForFinish
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录