Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
e18b3df1
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看板
提交
e18b3df1
编写于
12月 06, 2018
作者:
E
egahlin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8214925: JFR tool fails to execute
Reviewed-by: mgronlun, mseledtsov
上级
594d7245
变更
11
隐藏空白更改
内联
并排
Showing
11 changed file
with
45 addition
and
43 deletion
+45
-43
src/share/classes/jdk/jfr/internal/tool/Main.java
src/share/classes/jdk/jfr/internal/tool/Main.java
+1
-1
test/jdk/jfr/tool/ExecuteHelper.java
test/jdk/jfr/tool/ExecuteHelper.java
+12
-1
test/jdk/jfr/tool/TestAssemble.java
test/jdk/jfr/tool/TestAssemble.java
+7
-8
test/jdk/jfr/tool/TestDisassemble.java
test/jdk/jfr/tool/TestDisassemble.java
+10
-11
test/jdk/jfr/tool/TestHelp.java
test/jdk/jfr/tool/TestHelp.java
+3
-4
test/jdk/jfr/tool/TestMetadata.java
test/jdk/jfr/tool/TestMetadata.java
+3
-4
test/jdk/jfr/tool/TestPrint.java
test/jdk/jfr/tool/TestPrint.java
+3
-4
test/jdk/jfr/tool/TestPrintDefault.java
test/jdk/jfr/tool/TestPrintDefault.java
+1
-2
test/jdk/jfr/tool/TestPrintJSON.java
test/jdk/jfr/tool/TestPrintJSON.java
+1
-2
test/jdk/jfr/tool/TestPrintXML.java
test/jdk/jfr/tool/TestPrintXML.java
+1
-2
test/jdk/jfr/tool/TestSummary.java
test/jdk/jfr/tool/TestSummary.java
+3
-4
未找到文件。
src/share/classes/jdk/jfr/internal/tool/Main.java
浏览文件 @
e18b3df1
...
...
@@ -72,7 +72,7 @@ public final class Main {
System
.
out
.
println
();
System
.
out
.
println
(
" jfr summary recording.jfr"
);
System
.
out
.
println
();
System
.
out
.
println
(
" jfr metadata recoding.jfr"
);
System
.
out
.
println
(
" jfr metadata reco
r
ding.jfr"
);
System
.
out
.
println
();
System
.
out
.
println
(
"For more information about available commands, use 'jfr help'"
);
System
.
exit
(
EXIT_OK
);
...
...
test/jdk/jfr/tool/ExecuteHelper.java
浏览文件 @
e18b3df1
...
...
@@ -32,7 +32,10 @@ import java.util.regex.Pattern;
import
jdk.jfr.Configuration
;
import
jdk.jfr.Event
;
import
jdk.jfr.Recording
;
import
jdk.test.lib.Utils
;;
import
jdk.test.lib.JDKToolLauncher
;
import
jdk.test.lib.Utils
;
import
jdk.test.lib.process.OutputAnalyzer
;
import
jdk.test.lib.process.ProcessTools
;;
final
class
ExecuteHelper
{
...
...
@@ -122,4 +125,12 @@ final class ExecuteHelper {
Matcher
m
=
p
.
matcher
(
"aaaaab"
);
m
.
matches
();
}
public
static
OutputAnalyzer
jfr
(
String
...
args
)
throws
Throwable
{
JDKToolLauncher
l
=
JDKToolLauncher
.
createUsingTestJDK
(
"jfr"
);
for
(
String
arg
:
args
)
{
l
.
addToolArg
(
arg
);
}
return
ProcessTools
.
executeCommand
(
l
.
getCommand
());
}
}
test/jdk/jfr/tool/TestAssemble.java
浏览文件 @
e18b3df1
...
...
@@ -40,7 +40,6 @@ import jdk.jfr.internal.Repository;
import
jdk.jfr.internal.SecuritySupport.SafePath
;
import
jdk.test.lib.Asserts
;
import
jdk.test.lib.process.OutputAnalyzer
;
import
jdk.test.lib.process.ProcessTools
;
/**
* @test
...
...
@@ -89,30 +88,30 @@ public class TestAssemble {
String
destination
=
destinationPath
.
toAbsolutePath
().
toString
();
// Test failure
OutputAnalyzer
output
=
ProcessTools
.
executeProcess
(
"jfr"
,
"assemble"
);
OutputAnalyzer
output
=
ExecuteHelper
.
jfr
(
"assemble"
);
output
.
shouldContain
(
"too few arguments"
);
output
=
ProcessTools
.
executeProcess
(
"jfr"
,
"assemble"
,
directory
);
output
=
ExecuteHelper
.
jfr
(
"assemble"
,
directory
);
output
.
shouldContain
(
"too few arguments"
);
output
=
ProcessTools
.
executeProcess
(
"jfr"
,
"assemble"
,
"not-a-directory"
,
destination
);
output
=
ExecuteHelper
.
jfr
(
"assemble"
,
"not-a-directory"
,
destination
);
output
.
shouldContain
(
"directory does not exist, not-a-directory"
);
output
=
ProcessTools
.
executeProcess
(
"jfr"
,
"assemble"
,
directory
,
"not-a-destination"
);
output
=
ExecuteHelper
.
jfr
(
"assemble"
,
directory
,
"not-a-destination"
);
output
.
shouldContain
(
"filename must end with '.jfr'"
);
output
=
ProcessTools
.
executeProcess
(
"jfr"
,
"assemble"
,
"--wrongOption"
,
directory
,
destination
);
output
=
ExecuteHelper
.
jfr
(
"assemble"
,
"--wrongOption"
,
directory
,
destination
);
output
.
shouldContain
(
"too many arguments"
);
FileWriter
fw
=
new
FileWriter
(
destination
);
fw
.
write
(
'd'
);
fw
.
close
();
output
=
ProcessTools
.
executeProcess
(
"jfr"
,
"assemble"
,
directory
,
destination
);
output
=
ExecuteHelper
.
jfr
(
"assemble"
,
directory
,
destination
);
output
.
shouldContain
(
"already exists"
);
Files
.
delete
(
destinationPath
);
// test success
output
=
ProcessTools
.
executeProcess
(
"jfr"
,
"assemble"
,
directory
,
destination
);
output
=
ExecuteHelper
.
jfr
(
"assemble"
,
directory
,
destination
);
System
.
out
.
println
(
output
.
getOutput
());
output
.
shouldContain
(
"Finished."
);
...
...
test/jdk/jfr/tool/TestDisassemble.java
浏览文件 @
e18b3df1
...
...
@@ -37,7 +37,6 @@ import jdk.jfr.Configuration;
import
jdk.jfr.Recording
;
import
jdk.jfr.consumer.RecordingFile
;
import
jdk.test.lib.process.OutputAnalyzer
;
import
jdk.test.lib.process.ProcessTools
;
/**
* @test
...
...
@@ -63,40 +62,40 @@ public class TestDisassemble {
String
fileBText
=
recordingFileB
.
toAbsolutePath
().
toString
();
String
fileCText
=
recordingFileC
.
toAbsolutePath
().
toString
();
OutputAnalyzer
output
=
ProcessTools
.
executeProcess
(
"jfr"
,
"disassemble"
);
OutputAnalyzer
output
=
ExecuteHelper
.
jfr
(
"disassemble"
);
output
.
shouldContain
(
"missing file"
);
output
=
ProcessTools
.
executeProcess
(
"jfr"
,
"disassemble"
,
"--wrongOption"
,
fileAText
);
output
=
ExecuteHelper
.
jfr
(
"disassemble"
,
"--wrongOption"
,
fileAText
);
output
.
shouldContain
(
"unknown option"
);
output
=
ProcessTools
.
executeProcess
(
"jfr"
,
"disassemble"
,
"--wrongOption"
,
"1"
,
fileAText
);
output
=
ExecuteHelper
.
jfr
(
"disassemble"
,
"--wrongOption"
,
"1"
,
fileAText
);
output
.
shouldContain
(
"unknown option"
);
output
=
ProcessTools
.
executeProcess
(
"jfr"
,
"disassemble"
,
"--max-chunks"
,
"-3"
,
fileAText
);
output
=
ExecuteHelper
.
jfr
(
"disassemble"
,
"--max-chunks"
,
"-3"
,
fileAText
);
output
.
shouldContain
(
"max chunks must be at least 1"
);
output
=
ProcessTools
.
executeProcess
(
"jfr"
,
"disassemble"
,
"--max-chunks"
,
"1000"
,
fileAText
);
output
=
ExecuteHelper
.
jfr
(
"disassemble"
,
"--max-chunks"
,
"1000"
,
fileAText
);
output
.
shouldContain
(
"number of chunks in recording"
);
output
.
shouldContain
(
"doesn't exceed max chunks"
);
output
=
ProcessTools
.
executeProcess
(
"jfr"
,
"disassemble"
,
fileAText
);
// maxchunks is 5 by
output
=
ExecuteHelper
.
jfr
(
"disassemble"
,
fileAText
);
// maxchunks is 5 by
// default
System
.
out
.
println
(
output
.
getOutput
());
System
.
out
.
println
(
fileAText
);
verifyRecording
(
fileAText
.
substring
(
0
,
fileAText
.
length
()
-
4
)
+
"_1.jfr"
);
verifyRecording
(
fileAText
.
substring
(
0
,
fileAText
.
length
()
-
4
)
+
"_2.jfr"
);
output
=
ProcessTools
.
executeProcess
(
"jfr"
,
"disassemble"
,
"--max-chunks"
,
"2"
,
fileBText
);
output
=
ExecuteHelper
.
jfr
(
"disassemble"
,
"--max-chunks"
,
"2"
,
fileBText
);
verifyRecording
(
fileBText
.
substring
(
0
,
fileBText
.
length
()
-
4
)
+
"_1.jfr"
);
verifyRecording
(
fileBText
.
substring
(
0
,
fileBText
.
length
()
-
4
)
+
"_2.jfr"
);
verifyRecording
(
fileBText
.
substring
(
0
,
fileBText
.
length
()
-
4
)
+
"_3.jfr"
);
output
=
ProcessTools
.
executeProcess
(
"jfr"
,
"disassemble"
,
"--max-chunks"
,
"2"
,
fileBText
);
output
=
ExecuteHelper
.
jfr
(
"disassemble"
,
"--max-chunks"
,
"2"
,
fileBText
);
output
.
shouldContain
(
"file with that name already exist"
);
// sanity check
output
=
ProcessTools
.
executeProcess
(
"jfr"
,
"disassemble"
,
"--max-size"
,
"50
0000"
,
fileCText
);
verifyRecording
(
fileCText
.
substring
(
0
,
fileCText
.
length
()
-
4
)
+
"_1.jfr"
);
output
=
ExecuteHelper
.
jfr
(
"disassemble"
,
"--max-size"
,
"1
0000"
,
fileCText
);
verifyRecording
(
fileCText
.
substring
(
0
,
fileCText
.
length
()
-
4
)
+
"_
0
1.jfr"
);
}
private
static
void
verifyRecording
(
String
name
)
throws
IOException
{
...
...
test/jdk/jfr/tool/TestHelp.java
浏览文件 @
e18b3df1
...
...
@@ -26,7 +26,6 @@
package
jdk.jfr.tool
;
import
jdk.test.lib.process.OutputAnalyzer
;
import
jdk.test.lib.process.ProcessTools
;
/**
* @test
...
...
@@ -38,7 +37,7 @@ import jdk.test.lib.process.ProcessTools;
public
class
TestHelp
{
public
static
void
main
(
String
[]
args
)
throws
Throwable
{
OutputAnalyzer
output
=
ProcessTools
.
executeProcess
(
"jfr"
,
"help"
);
OutputAnalyzer
output
=
ExecuteHelper
.
jfr
(
"help"
);
output
.
shouldContain
(
"print"
);
output
.
shouldContain
(
"assemble"
);
output
.
shouldContain
(
"disassemble"
);
...
...
@@ -46,11 +45,11 @@ public class TestHelp {
output
.
shouldContain
(
"summary"
);
output
.
shouldContain
(
"help"
);
output
=
ProcessTools
.
executeProcess
(
"jfr"
,
"help"
,
"version"
);
output
=
ExecuteHelper
.
jfr
(
"help"
,
"version"
);
output
.
shouldContain
(
"Display version of the jfr tool"
);
output
.
shouldContain
(
"jfr version"
);
output
=
ProcessTools
.
executeProcess
(
"jfr"
,
"help"
,
"wrongcommand"
);
output
=
ExecuteHelper
.
jfr
(
"help"
,
"wrongcommand"
);
output
.
shouldContain
(
"unknown command 'wrongcommand'"
);
}
}
test/jdk/jfr/tool/TestMetadata.java
浏览文件 @
e18b3df1
...
...
@@ -30,7 +30,6 @@ import java.nio.file.Path;
import
jdk.jfr.EventType
;
import
jdk.jfr.consumer.RecordingFile
;
import
jdk.test.lib.process.OutputAnalyzer
;
import
jdk.test.lib.process.ProcessTools
;
/**
* @test
...
...
@@ -45,13 +44,13 @@ public class TestMetadata {
Path
f
=
ExecuteHelper
.
createProfilingRecording
().
toAbsolutePath
();
String
file
=
f
.
toAbsolutePath
().
toString
();
OutputAnalyzer
output
=
ProcessTools
.
executeProcess
(
"jfr"
,
"metadata"
);
OutputAnalyzer
output
=
ExecuteHelper
.
jfr
(
"metadata"
);
output
.
shouldContain
(
"missing file"
);
output
=
ProcessTools
.
executeProcess
(
"jfr"
,
"metadata"
,
"--wrongOption"
,
file
);
output
=
ExecuteHelper
.
jfr
(
"metadata"
,
"--wrongOption"
,
file
);
output
.
shouldContain
(
"unknown option --wrongOption"
);
output
=
ProcessTools
.
executeProcess
(
"jfr"
,
"metadata"
,
file
);
output
=
ExecuteHelper
.
jfr
(
"metadata"
,
file
);
try
(
RecordingFile
rf
=
new
RecordingFile
(
f
))
{
for
(
EventType
t
:
rf
.
readEventTypes
())
{
String
name
=
t
.
getName
();
...
...
test/jdk/jfr/tool/TestPrint.java
浏览文件 @
e18b3df1
...
...
@@ -31,7 +31,6 @@ import java.nio.file.Path;
import
jdk.test.lib.Utils
;
import
jdk.test.lib.process.OutputAnalyzer
;
import
jdk.test.lib.process.ProcessTools
;
/**
* @test
...
...
@@ -44,17 +43,17 @@ public class TestPrint {
public
static
void
main
(
String
[]
args
)
throws
Throwable
{
OutputAnalyzer
output
=
ProcessTools
.
executeProcess
(
"jfr"
,
"print"
);
OutputAnalyzer
output
=
ExecuteHelper
.
jfr
(
"print"
);
output
.
shouldContain
(
"missing file"
);
output
=
ProcessTools
.
executeProcess
(
"jfr"
,
"print"
,
"missing.jfr"
);
output
=
ExecuteHelper
.
jfr
(
"print"
,
"missing.jfr"
);
output
.
shouldContain
(
"could not find file "
);
Path
file
=
Utils
.
createTempFile
(
"faked-print-file"
,
".jfr"
);
FileWriter
fw
=
new
FileWriter
(
file
.
toFile
());
fw
.
write
(
'd'
);
fw
.
close
();
output
=
ProcessTools
.
executeProcess
(
"jfr"
,
"print"
,
"--wrongOption"
,
file
.
toAbsolutePath
().
toString
());
output
=
ExecuteHelper
.
jfr
(
"print"
,
"--wrongOption"
,
file
.
toAbsolutePath
().
toString
());
output
.
shouldContain
(
"unknown option"
);
Files
.
delete
(
file
);
}
...
...
test/jdk/jfr/tool/TestPrintDefault.java
浏览文件 @
e18b3df1
...
...
@@ -28,7 +28,6 @@ package jdk.jfr.tool;
import
java.nio.file.Path
;
import
jdk.test.lib.process.OutputAnalyzer
;
import
jdk.test.lib.process.ProcessTools
;
/**
* @test
...
...
@@ -47,7 +46,7 @@ public class TestPrintDefault {
Path
recordingFile
=
ExecuteHelper
.
createProfilingRecording
().
toAbsolutePath
();
OutputAnalyzer
output
=
ProcessTools
.
executeProcess
(
"jfr"
,
"print"
,
recordingFile
.
toString
());
OutputAnalyzer
output
=
ExecuteHelper
.
jfr
(
"print"
,
recordingFile
.
toString
());
output
.
shouldContain
(
"JVMInformation"
);
}
}
test/jdk/jfr/tool/TestPrintJSON.java
浏览文件 @
e18b3df1
...
...
@@ -43,7 +43,6 @@ import jdk.jfr.consumer.RecordingFile;
import
jdk.nashorn.api.scripting.JSObject
;
import
jdk.test.lib.Asserts
;
import
jdk.test.lib.process.OutputAnalyzer
;
import
jdk.test.lib.process.ProcessTools
;
/**
* @test
...
...
@@ -62,7 +61,7 @@ public class TestPrintJSON {
Path
recordingFile
=
ExecuteHelper
.
createProfilingRecording
().
toAbsolutePath
();
OutputAnalyzer
output
=
ProcessTools
.
executeProcess
(
"jfr"
,
"print"
,
"--json"
,
"--stack-depth"
,
"999"
,
recordingFile
.
toString
());
OutputAnalyzer
output
=
ExecuteHelper
.
jfr
(
"print"
,
"--json"
,
"--stack-depth"
,
"999"
,
recordingFile
.
toString
());
String
json
=
output
.
getStdout
();
// Parse JSON using Nashorn
...
...
test/jdk/jfr/tool/TestPrintXML.java
浏览文件 @
e18b3df1
...
...
@@ -58,7 +58,6 @@ import jdk.jfr.consumer.RecordedEvent;
import
jdk.jfr.consumer.RecordedObject
;
import
jdk.jfr.consumer.RecordingFile
;
import
jdk.test.lib.process.OutputAnalyzer
;
import
jdk.test.lib.process.ProcessTools
;
/**
* @test
...
...
@@ -76,7 +75,7 @@ public class TestPrintXML {
Path
recordingFile
=
ExecuteHelper
.
createProfilingRecording
().
toAbsolutePath
();
OutputAnalyzer
output
=
ProcessTools
.
executeProcess
(
"jfr"
,
"print"
,
"--xml"
,
"--stack-depth"
,
"9999"
,
recordingFile
.
toString
());
OutputAnalyzer
output
=
ExecuteHelper
.
jfr
(
"print"
,
"--xml"
,
"--stack-depth"
,
"9999"
,
recordingFile
.
toString
());
System
.
out
.
println
(
recordingFile
);
String
xml
=
output
.
getStdout
();
...
...
test/jdk/jfr/tool/TestSummary.java
浏览文件 @
e18b3df1
...
...
@@ -30,7 +30,6 @@ import java.nio.file.Path;
import
jdk.jfr.EventType
;
import
jdk.jfr.consumer.RecordingFile
;
import
jdk.test.lib.process.OutputAnalyzer
;
import
jdk.test.lib.process.ProcessTools
;
/**
* @test
...
...
@@ -45,13 +44,13 @@ public class TestSummary {
Path
f
=
ExecuteHelper
.
createProfilingRecording
().
toAbsolutePath
();
String
file
=
f
.
toAbsolutePath
().
toString
();
OutputAnalyzer
output
=
ProcessTools
.
executeProcess
(
"jfr"
,
"summary"
);
OutputAnalyzer
output
=
ExecuteHelper
.
jfr
(
"summary"
);
output
.
shouldContain
(
"missing file"
);
output
=
ProcessTools
.
executeProcess
(
"jfr"
,
"summary"
,
"--wrongOption"
,
file
);
output
=
ExecuteHelper
.
jfr
(
"summary"
,
"--wrongOption"
,
file
);
output
.
shouldContain
(
"too many arguments"
);
output
=
ProcessTools
.
executeProcess
(
"jfr"
,
"summary"
,
file
);
output
=
ExecuteHelper
.
jfr
(
"summary"
,
file
);
try
(
RecordingFile
rf
=
new
RecordingFile
(
f
))
{
for
(
EventType
t
:
rf
.
readEventTypes
())
{
output
.
shouldContain
(
t
.
getName
());
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录