Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_hotspot
提交
60c4d83b
D
dragonwell8_hotspot
项目概览
openanolis
/
dragonwell8_hotspot
通知
2
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dragonwell8_hotspot
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
60c4d83b
编写于
8月 02, 2013
作者:
D
dcubed
浏览文件
操作
浏览文件
下载
差异文件
Merge
上级
e9dd9c19
873c3e6a
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
270 addition
and
126 deletion
+270
-126
src/share/vm/services/gcNotifier.cpp
src/share/vm/services/gcNotifier.cpp
+4
-4
src/share/vm/services/management.cpp
src/share/vm/services/management.cpp
+5
-5
test/runtime/8000968/Test8000968.sh
test/runtime/8000968/Test8000968.sh
+0
-99
test/runtime/CompressedOops/CompressedKlassPointerAndOops.java
...runtime/CompressedOops/CompressedKlassPointerAndOops.java
+63
-0
test/testlibrary/OutputAnalyzerReportingTest.java
test/testlibrary/OutputAnalyzerReportingTest.java
+124
-0
test/testlibrary/com/oracle/java/testlibrary/OutputAnalyzer.java
...stlibrary/com/oracle/java/testlibrary/OutputAnalyzer.java
+51
-17
test/testlibrary/com/oracle/java/testlibrary/ProcessTools.java
...testlibrary/com/oracle/java/testlibrary/ProcessTools.java
+23
-1
未找到文件。
src/share/vm/services/gcNotifier.cpp
浏览文件 @
60c4d83b
/*
* Copyright (c) 2011, 201
2
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 201
3
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -211,9 +211,9 @@ void GCNotifier::sendNotificationInternal(TRAPS) {
NotificationMark
nm
(
request
);
Handle
objGcInfo
=
createGcInfo
(
request
->
gcManager
,
request
->
gcStatInfo
,
THREAD
);
Handle
objName
=
java_lang_String
::
create_from_
platform_dependent_
str
(
request
->
gcManager
->
name
(),
CHECK
);
Handle
objAction
=
java_lang_String
::
create_from_
platform_dependent_
str
(
request
->
gcAction
,
CHECK
);
Handle
objCause
=
java_lang_String
::
create_from_
platform_dependent_
str
(
request
->
gcCause
,
CHECK
);
Handle
objName
=
java_lang_String
::
create_from_str
(
request
->
gcManager
->
name
(),
CHECK
);
Handle
objAction
=
java_lang_String
::
create_from_str
(
request
->
gcAction
,
CHECK
);
Handle
objCause
=
java_lang_String
::
create_from_str
(
request
->
gcCause
,
CHECK
);
Klass
*
k
=
Management
::
sun_management_GarbageCollectorImpl_klass
(
CHECK
);
instanceKlassHandle
gc_mbean_klass
(
THREAD
,
k
);
...
...
src/share/vm/services/management.cpp
浏览文件 @
60c4d83b
...
...
@@ -1831,13 +1831,13 @@ class ThreadTimesClosure: public ThreadClosure {
private:
objArrayHandle
_names_strings
;
char
**
_names_chars
;
typeArray
Oop
_times
;
typeArray
Handle
_times
;
int
_names_len
;
int
_times_len
;
int
_count
;
public:
ThreadTimesClosure
(
objArrayHandle
names
,
typeArray
Oop
times
);
ThreadTimesClosure
(
objArrayHandle
names
,
typeArray
Handle
times
);
~
ThreadTimesClosure
();
virtual
void
do_thread
(
Thread
*
thread
);
void
do_unlocked
();
...
...
@@ -1845,9 +1845,9 @@ class ThreadTimesClosure: public ThreadClosure {
};
ThreadTimesClosure
::
ThreadTimesClosure
(
objArrayHandle
names
,
typeArray
Oop
times
)
{
typeArray
Handle
times
)
{
assert
(
names
()
!=
NULL
,
"names was NULL"
);
assert
(
times
!=
NULL
,
"times was NULL"
);
assert
(
times
()
!=
NULL
,
"times was NULL"
);
_names_strings
=
names
;
_names_len
=
names
->
length
();
_names_chars
=
NEW_C_HEAP_ARRAY
(
char
*
,
_names_len
,
mtInternal
);
...
...
@@ -1925,7 +1925,7 @@ JVM_ENTRY(jint, jmm_GetInternalThreadTimes(JNIEnv *env,
typeArrayOop
ta
=
typeArrayOop
(
JNIHandles
::
resolve_non_null
(
times
));
typeArrayHandle
times_ah
(
THREAD
,
ta
);
ThreadTimesClosure
ttc
(
names_ah
,
times_ah
()
);
ThreadTimesClosure
ttc
(
names_ah
,
times_ah
);
{
MutexLockerEx
ml
(
Threads_lock
);
Threads
::
threads_do
(
&
ttc
);
...
...
test/runtime/8000968/Test8000968.sh
已删除
100644 → 0
浏览文件 @
e9dd9c19
#
# Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
# @test Test8000968.sh
# @bug 8000968
# @summary NPG: UseCompressedKlassPointers asserts with ObjectAlignmentInBytes=32
# @run shell Test8000968.sh
#
if
[
"
${
TESTJAVA
}
"
=
""
]
then
PARENT
=
`
dirname
\`
which java
\`
`
TESTJAVA
=
`
dirname
${
PARENT
}
`
printf
"TESTJAVA not set, selecting "
${
TESTJAVA
}
printf
" If this is incorrect, try setting the variable manually.
\n
"
fi
# set platform-dependent variables
OS
=
`
uname
-s
`
case
"
$OS
"
in
Windows_
*
)
FS
=
"
\\
"
NULL
=
NUL
;;
*
)
FS
=
"/"
NULL
=
/dev/null
;;
esac
JAVA
=
${
TESTJAVA
}${
FS
}
bin
${
FS
}
java
#
# See if platform has 64 bit java.
#
${
JAVA
}
${
TESTVMOPTS
}
-d64
-version
2>&1 |
grep
-i
"does not support"
>
${
NULL
}
if
[
"
$?
"
!=
"1"
]
then
printf
"Platform is 32 bit, does not support -XX:ObjectAlignmentInBytes= option.
\n
"
printf
"Passed.
\n
"
exit
0
fi
#
# Test -XX:ObjectAlignmentInBytes with -XX:+UseCompressedKlassPointers -XX:+UseCompressedOops.
#
${
JAVA
}
${
TESTVMOPTS
}
-d64
-XX
:+UseCompressedKlassPointers
-XX
:+UseCompressedOops
-XX
:ObjectAlignmentInBytes
=
16
-version
2>&1
>
${
NULL
}
if
[
"
$?
"
!=
"0"
]
then
printf
"FAILED: -XX:ObjectAlignmentInBytes=16 option did not work.
\n
"
exit
1
fi
${
JAVA
}
${
TESTVMOPTS
}
-d64
-XX
:+UseCompressedKlassPointers
-XX
:+UseCompressedOops
-XX
:ObjectAlignmentInBytes
=
32
-version
2>&1
>
${
NULL
}
if
[
"
$?
"
!=
"0"
]
then
printf
"FAILED: -XX:ObjectAlignmentInBytes=32 option did not work.
\n
"
exit
1
fi
${
JAVA
}
${
TESTVMOPTS
}
-d64
-XX
:+UseCompressedKlassPointers
-XX
:+UseCompressedOops
-XX
:ObjectAlignmentInBytes
=
64
-version
2>&1
>
${
NULL
}
if
[
"
$?
"
!=
"0"
]
then
printf
"FAILED: -XX:ObjectAlignmentInBytes=64 option did not work.
\n
"
exit
1
fi
${
JAVA
}
${
TESTVMOPTS
}
-d64
-XX
:+UseCompressedKlassPointers
-XX
:+UseCompressedOops
-XX
:ObjectAlignmentInBytes
=
128
-version
2>&1
>
${
NULL
}
if
[
"
$?
"
!=
"0"
]
then
printf
"FAILED: -XX:ObjectAlignmentInBytes=128 option did not work.
\n
"
exit
1
fi
printf
"Passed.
\n
"
exit
0
test/runtime/CompressedOops/CompressedKlassPointerAndOops.java
0 → 100644
浏览文件 @
60c4d83b
/*
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 8000968
* @key regression
* @summary NPG: UseCompressedKlassPointers asserts with ObjectAlignmentInBytes=32
* @library /testlibrary
*/
import
com.oracle.java.testlibrary.*
;
public
class
CompressedKlassPointerAndOops
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
if
(!
Platform
.
is64bit
())
{
// Can't test this on 32 bit, just pass
System
.
out
.
println
(
"Skipping test on 32bit"
);
return
;
}
runWithAlignment
(
16
);
runWithAlignment
(
32
);
runWithAlignment
(
64
);
runWithAlignment
(
128
);
}
private
static
void
runWithAlignment
(
int
alignment
)
throws
Exception
{
ProcessBuilder
pb
;
OutputAnalyzer
output
;
pb
=
ProcessTools
.
createJavaProcessBuilder
(
"-XX:+UseCompressedKlassPointers"
,
"-XX:+UseCompressedOops"
,
"-XX:ObjectAlignmentInBytes="
+
alignment
,
"-version"
);
output
=
new
OutputAnalyzer
(
pb
.
start
());
output
.
shouldHaveExitValue
(
0
);
}
}
test/testlibrary/OutputAnalyzerReportingTest.java
0 → 100644
浏览文件 @
60c4d83b
/*
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @summary Test the OutputAnalyzer reporting functionality,
* such as printing additional diagnostic info
* (exit code, stdout, stderr, command line, etc.)
* @library /testlibrary
*/
import
java.io.ByteArrayOutputStream
;
import
java.io.PrintStream
;
import
com.oracle.java.testlibrary.OutputAnalyzer
;
import
com.oracle.java.testlibrary.ProcessTools
;
public
class
OutputAnalyzerReportingTest
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
// Create the output analyzer under test
String
stdout
=
"aaaaaa"
;
String
stderr
=
"bbbbbb"
;
OutputAnalyzer
output
=
new
OutputAnalyzer
(
stdout
,
stderr
);
// Expected summary values should be the same for all cases,
// since the outputAnalyzer object is the same
String
expectedExitValue
=
"-1"
;
String
expectedSummary
=
" stdout: ["
+
stdout
+
"];\n"
+
" stderr: ["
+
stderr
+
"]\n"
+
" exitValue = "
+
expectedExitValue
+
"\n"
;
DiagnosticSummaryTestRunner
testRunner
=
new
DiagnosticSummaryTestRunner
();
// should have exit value
testRunner
.
init
(
expectedSummary
);
int
unexpectedExitValue
=
2
;
try
{
output
.
shouldHaveExitValue
(
unexpectedExitValue
);
}
catch
(
RuntimeException
e
)
{
}
testRunner
.
closeAndCheckResults
();
// should not contain
testRunner
.
init
(
expectedSummary
);
try
{
output
.
shouldNotContain
(
stdout
);
}
catch
(
RuntimeException
e
)
{
}
testRunner
.
closeAndCheckResults
();
// should contain
testRunner
.
init
(
expectedSummary
);
try
{
output
.
shouldContain
(
"unexpected-stuff"
);
}
catch
(
RuntimeException
e
)
{
}
testRunner
.
closeAndCheckResults
();
// should not match
testRunner
.
init
(
expectedSummary
);
try
{
output
.
shouldNotMatch
(
"[a]"
);
}
catch
(
RuntimeException
e
)
{
}
testRunner
.
closeAndCheckResults
();
// should match
testRunner
.
init
(
expectedSummary
);
try
{
output
.
shouldMatch
(
"[qwerty]"
);
}
catch
(
RuntimeException
e
)
{
}
testRunner
.
closeAndCheckResults
();
}
private
static
class
DiagnosticSummaryTestRunner
{
private
ByteArrayOutputStream
byteStream
=
new
ByteArrayOutputStream
(
10000
);
private
String
expectedSummary
=
""
;
private
PrintStream
errStream
;
public
void
init
(
String
expectedSummary
)
{
this
.
expectedSummary
=
expectedSummary
;
byteStream
.
reset
();
errStream
=
new
PrintStream
(
byteStream
);
System
.
setErr
(
errStream
);
}
public
void
closeAndCheckResults
()
{
// check results
errStream
.
close
();
String
stdErrStr
=
byteStream
.
toString
();
if
(!
stdErrStr
.
contains
(
expectedSummary
))
{
throw
new
RuntimeException
(
"The output does not contain "
+
"the diagnostic message, or the message is incorrect"
);
}
}
}
}
test/testlibrary/com/oracle/java/testlibrary/OutputAnalyzer.java
浏览文件 @
60c4d83b
...
...
@@ -76,7 +76,8 @@ public final class OutputAnalyzer {
*/
public
void
shouldContain
(
String
expectedString
)
{
if
(!
stdout
.
contains
(
expectedString
)
&&
!
stderr
.
contains
(
expectedString
))
{
throw
new
RuntimeException
(
"'"
+
expectedString
+
"' missing from stdout/stderr: ["
+
stdout
+
stderr
+
"]\n"
);
reportDiagnosticSummary
();
throw
new
RuntimeException
(
"'"
+
expectedString
+
"' missing from stdout/stderr \n"
);
}
}
...
...
@@ -88,7 +89,8 @@ public final class OutputAnalyzer {
*/
public
void
stdoutShouldContain
(
String
expectedString
)
{
if
(!
stdout
.
contains
(
expectedString
))
{
throw
new
RuntimeException
(
"'"
+
expectedString
+
"' missing from stdout: ["
+
stdout
+
"]\n"
);
reportDiagnosticSummary
();
throw
new
RuntimeException
(
"'"
+
expectedString
+
"' missing from stdout \n"
);
}
}
...
...
@@ -100,7 +102,8 @@ public final class OutputAnalyzer {
*/
public
void
stderrShouldContain
(
String
expectedString
)
{
if
(!
stderr
.
contains
(
expectedString
))
{
throw
new
RuntimeException
(
"'"
+
expectedString
+
"' missing from stderr: ["
+
stderr
+
"]\n"
);
reportDiagnosticSummary
();
throw
new
RuntimeException
(
"'"
+
expectedString
+
"' missing from stderr \n"
);
}
}
...
...
@@ -112,10 +115,12 @@ public final class OutputAnalyzer {
*/
public
void
shouldNotContain
(
String
notExpectedString
)
{
if
(
stdout
.
contains
(
notExpectedString
))
{
throw
new
RuntimeException
(
"'"
+
notExpectedString
+
"' found in stdout: ["
+
stdout
+
"]\n"
);
reportDiagnosticSummary
();
throw
new
RuntimeException
(
"'"
+
notExpectedString
+
"' found in stdout \n"
);
}
if
(
stderr
.
contains
(
notExpectedString
))
{
throw
new
RuntimeException
(
"'"
+
notExpectedString
+
"' found in stderr: ["
+
stderr
+
"]\n"
);
reportDiagnosticSummary
();
throw
new
RuntimeException
(
"'"
+
notExpectedString
+
"' found in stderr \n"
);
}
}
...
...
@@ -127,7 +132,8 @@ public final class OutputAnalyzer {
*/
public
void
stdoutShouldNotContain
(
String
notExpectedString
)
{
if
(
stdout
.
contains
(
notExpectedString
))
{
throw
new
RuntimeException
(
"'"
+
notExpectedString
+
"' found in stdout: ["
+
stdout
+
"]\n"
);
reportDiagnosticSummary
();
throw
new
RuntimeException
(
"'"
+
notExpectedString
+
"' found in stdout \n"
);
}
}
...
...
@@ -139,7 +145,8 @@ public final class OutputAnalyzer {
*/
public
void
stderrShouldNotContain
(
String
notExpectedString
)
{
if
(
stderr
.
contains
(
notExpectedString
))
{
throw
new
RuntimeException
(
"'"
+
notExpectedString
+
"' found in stderr: ["
+
stderr
+
"]\n"
);
reportDiagnosticSummary
();
throw
new
RuntimeException
(
"'"
+
notExpectedString
+
"' found in stderr \n"
);
}
}
...
...
@@ -154,9 +161,9 @@ public final class OutputAnalyzer {
Matcher
stdoutMatcher
=
Pattern
.
compile
(
pattern
,
Pattern
.
MULTILINE
).
matcher
(
stdout
);
Matcher
stderrMatcher
=
Pattern
.
compile
(
pattern
,
Pattern
.
MULTILINE
).
matcher
(
stderr
);
if
(!
stdoutMatcher
.
find
()
&&
!
stderrMatcher
.
find
())
{
reportDiagnosticSummary
();
throw
new
RuntimeException
(
"'"
+
pattern
+
"' missing from stdout/stderr: ["
+
stdout
+
stderr
+
"]\n"
);
+
"' missing from stdout/stderr \n"
);
}
}
...
...
@@ -170,8 +177,9 @@ public final class OutputAnalyzer {
public
void
stdoutShouldMatch
(
String
pattern
)
{
Matcher
matcher
=
Pattern
.
compile
(
pattern
,
Pattern
.
MULTILINE
).
matcher
(
stdout
);
if
(!
matcher
.
find
())
{
reportDiagnosticSummary
();
throw
new
RuntimeException
(
"'"
+
pattern
+
"' missing from stdout: ["
+
stdout
+
"]
\n"
);
+
"' missing from stdout
\n"
);
}
}
...
...
@@ -185,8 +193,9 @@ public final class OutputAnalyzer {
public
void
stderrShouldMatch
(
String
pattern
)
{
Matcher
matcher
=
Pattern
.
compile
(
pattern
,
Pattern
.
MULTILINE
).
matcher
(
stderr
);
if
(!
matcher
.
find
())
{
reportDiagnosticSummary
();
throw
new
RuntimeException
(
"'"
+
pattern
+
"' missing from stderr: ["
+
stderr
+
"]
\n"
);
+
"' missing from stderr
\n"
);
}
}
...
...
@@ -200,13 +209,15 @@ public final class OutputAnalyzer {
public
void
shouldNotMatch
(
String
pattern
)
{
Matcher
matcher
=
Pattern
.
compile
(
pattern
,
Pattern
.
MULTILINE
).
matcher
(
stdout
);
if
(
matcher
.
find
())
{
reportDiagnosticSummary
();
throw
new
RuntimeException
(
"'"
+
pattern
+
"' found in stdout
: ["
+
stdout
+
"]
\n"
);
+
"' found in stdout
\n"
);
}
matcher
=
Pattern
.
compile
(
pattern
,
Pattern
.
MULTILINE
).
matcher
(
stderr
);
if
(
matcher
.
find
())
{
reportDiagnosticSummary
();
throw
new
RuntimeException
(
"'"
+
pattern
+
"' found in stderr
: ["
+
stderr
+
"]
\n"
);
+
"' found in stderr
\n"
);
}
}
...
...
@@ -220,8 +231,9 @@ public final class OutputAnalyzer {
public
void
stdoutShouldNotMatch
(
String
pattern
)
{
Matcher
matcher
=
Pattern
.
compile
(
pattern
,
Pattern
.
MULTILINE
).
matcher
(
stdout
);
if
(
matcher
.
find
())
{
reportDiagnosticSummary
();
throw
new
RuntimeException
(
"'"
+
pattern
+
"' found in stdout
: ["
+
stdout
+
"]
\n"
);
+
"' found in stdout
\n"
);
}
}
...
...
@@ -235,23 +247,45 @@ public final class OutputAnalyzer {
public
void
stderrShouldNotMatch
(
String
pattern
)
{
Matcher
matcher
=
Pattern
.
compile
(
pattern
,
Pattern
.
MULTILINE
).
matcher
(
stderr
);
if
(
matcher
.
find
())
{
reportDiagnosticSummary
();
throw
new
RuntimeException
(
"'"
+
pattern
+
"' found in stderr
: ["
+
stderr
+
"]
\n"
);
+
"' found in stderr
\n"
);
}
}
/**
* Verif
i
y the exit value of the process
* Verify the exit value of the process
*
* @param expectedExitValue Expected exit value from process
* @throws RuntimeException If the exit value from the process did not match the expected value
*/
public
void
shouldHaveExitValue
(
int
expectedExitValue
)
{
if
(
getExitValue
()
!=
expectedExitValue
)
{
throw
new
RuntimeException
(
"Exit value "
+
getExitValue
()
+
" , expected to get "
+
expectedExitValue
);
reportDiagnosticSummary
();
throw
new
RuntimeException
(
"Expected to get exit value of ["
+
expectedExitValue
+
"]\n"
);
}
}
/**
* Report summary that will help to diagnose the problem
* Currently includes:
* - standard input produced by the process under test
* - standard output
* - exit code
* Note: the command line is printed by the ProcessTools
*/
private
void
reportDiagnosticSummary
()
{
String
msg
=
" stdout: ["
+
stdout
+
"];\n"
+
" stderr: ["
+
stderr
+
"]\n"
+
" exitValue = "
+
getExitValue
()
+
"\n"
;
System
.
err
.
println
(
msg
);
}
/**
* Get the contents of the output buffer (stdout and stderr)
*
...
...
test/testlibrary/com/oracle/java/testlibrary/ProcessTools.java
浏览文件 @
60c4d83b
...
...
@@ -31,6 +31,7 @@ import java.lang.reflect.Field;
import
java.lang.reflect.Method
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.List
;
import
sun.management.VMManagement
;
...
...
@@ -106,6 +107,22 @@ public final class ProcessTools {
return
pid
;
}
/**
* Get the string containing input arguments passed to the VM
*
* @return arguments
*/
public
static
String
getVmInputArguments
()
{
RuntimeMXBean
runtime
=
ManagementFactory
.
getRuntimeMXBean
();
List
<
String
>
args
=
runtime
.
getInputArguments
();
StringBuilder
result
=
new
StringBuilder
();
for
(
String
arg
:
args
)
result
.
append
(
arg
).
append
(
' '
);
return
result
.
toString
();
}
/**
* Get platform specific VM arguments (e.g. -d64 on 64bit Solaris)
*
...
...
@@ -132,8 +149,13 @@ public final class ProcessTools {
Collections
.
addAll
(
args
,
getPlatformSpecificVMArgs
());
Collections
.
addAll
(
args
,
command
);
return
new
ProcessBuilder
(
args
.
toArray
(
new
String
[
args
.
size
()]));
// Reporting
StringBuilder
cmdLine
=
new
StringBuilder
();
for
(
String
cmd
:
args
)
cmdLine
.
append
(
cmd
).
append
(
' '
);
System
.
out
.
println
(
"Command line: ["
+
cmdLine
.
toString
()
+
"]"
);
return
new
ProcessBuilder
(
args
.
toArray
(
new
String
[
args
.
size
()]));
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录