Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_hotspot
提交
555db73d
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看板
提交
555db73d
编写于
9月 19, 2014
作者:
M
mseledtsov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8052313: Backport CDS tests from JDK-9 to jdk8_u40
Summary: Copied CDS tests from jdk-9 to jdk8u40 Reviewed-by: ccheung, dholmes
上级
657bf757
变更
6
显示空白变更内容
内联
并排
Showing
6 changed file
with
412 addition
and
2 deletion
+412
-2
test/runtime/SharedArchiveFile/ArchiveDoesNotExist.java
test/runtime/SharedArchiveFile/ArchiveDoesNotExist.java
+68
-0
test/runtime/SharedArchiveFile/CdsDifferentObjectAlignment.java
...untime/SharedArchiveFile/CdsDifferentObjectAlignment.java
+7
-2
test/runtime/SharedArchiveFile/DefaultUseWithClient.java
test/runtime/SharedArchiveFile/DefaultUseWithClient.java
+72
-0
test/runtime/SharedArchiveFile/LimitSharedSizes.java
test/runtime/SharedArchiveFile/LimitSharedSizes.java
+92
-0
test/runtime/SharedArchiveFile/SharedBaseAddress.java
test/runtime/SharedArchiveFile/SharedBaseAddress.java
+77
-0
test/runtime/SharedArchiveFile/SpaceUtilizationCheck.java
test/runtime/SharedArchiveFile/SpaceUtilizationCheck.java
+96
-0
未找到文件。
test/runtime/SharedArchiveFile/ArchiveDoesNotExist.java
0 → 100644
浏览文件 @
555db73d
/*
* Copyright (c) 2014, 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 ArchiveDoesNotExist
* @summary Test how VM handles "file does not exist" situation while
* attempting to use CDS archive. JVM should exit gracefully
* when sharing mode is ON, and continue w/o sharing if sharing
* mode is AUTO.
* @library /testlibrary
* @run main ArchiveDoesNotExist
*/
import
com.oracle.java.testlibrary.*
;
import
java.io.File
;
public
class
ArchiveDoesNotExist
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
String
fileName
=
"test.jsa"
;
File
cdsFile
=
new
File
(
fileName
);
if
(
cdsFile
.
exists
())
throw
new
RuntimeException
(
"Test error: cds file already exists"
);
// Sharing: on
ProcessBuilder
pb
=
ProcessTools
.
createJavaProcessBuilder
(
"-XX:+UnlockDiagnosticVMOptions"
,
"-XX:SharedArchiveFile=./"
+
fileName
,
"-Xshare:on"
,
"-version"
);
OutputAnalyzer
output
=
new
OutputAnalyzer
(
pb
.
start
());
output
.
shouldContain
(
"Specified shared archive not found"
);
output
.
shouldHaveExitValue
(
1
);
// Sharing: auto
pb
=
ProcessTools
.
createJavaProcessBuilder
(
"-XX:+UnlockDiagnosticVMOptions"
,
"-XX:SharedArchiveFile=./"
+
fileName
,
"-Xshare:auto"
,
"-version"
);
output
=
new
OutputAnalyzer
(
pb
.
start
());
output
.
shouldMatch
(
"(java|openjdk) version"
);
output
.
shouldNotContain
(
"sharing"
);
output
.
shouldHaveExitValue
(
0
);
}
}
test/runtime/SharedArchiveFile/CdsDifferentObjectAlignment.java
浏览文件 @
555db73d
/*
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013,
2014,
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
...
...
@@ -29,6 +29,7 @@
* is different from object alignment for creating a CDS file
* should fail when loading.
* @library /testlibrary
* @bug 8025642
*/
import
com.oracle.java.testlibrary.*
;
...
...
@@ -82,7 +83,11 @@ public class CdsDifferentObjectAlignment {
createAlignment
,
loadAlignment
);
try
{
output
.
shouldContain
(
expectedErrorMsg
);
}
catch
(
RuntimeException
e
)
{
output
.
shouldContain
(
"Unable to use shared archive"
);
}
output
.
shouldHaveExitValue
(
1
);
}
}
test/runtime/SharedArchiveFile/DefaultUseWithClient.java
0 → 100644
浏览文件 @
555db73d
/*
* Copyright (c) 2014, 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 DefaultUseWithClient
* @summary Test default behavior of sharing with -client
* @library /testlibrary
* @run main DefaultUseWithClient
* @bug 8032224
*/
import
com.oracle.java.testlibrary.*
;
import
java.io.File
;
public
class
DefaultUseWithClient
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
String
fileName
=
"test.jsa"
;
// On 32-bit windows CDS should be on by default in "-client" config
// Skip this test on any other platform
boolean
is32BitWindows
=
(
Platform
.
isWindows
()
&&
Platform
.
is32bit
());
if
(!
is32BitWindows
)
{
System
.
out
.
println
(
"Test only applicable on 32-bit Windows. Skipping"
);
return
;
}
// create the archive
ProcessBuilder
pb
=
ProcessTools
.
createJavaProcessBuilder
(
"-XX:+UnlockDiagnosticVMOptions"
,
"-XX:SharedArchiveFile=./"
+
fileName
,
"-Xshare:dump"
);
OutputAnalyzer
output
=
new
OutputAnalyzer
(
pb
.
start
());
output
.
shouldHaveExitValue
(
0
);
pb
=
ProcessTools
.
createJavaProcessBuilder
(
"-XX:+UnlockDiagnosticVMOptions"
,
"-XX:SharedArchiveFile=./"
+
fileName
,
"-client"
,
"-XX:+PrintSharedSpaces"
,
"-version"
);
output
=
new
OutputAnalyzer
(
pb
.
start
());
try
{
output
.
shouldContain
(
"sharing"
);
}
catch
(
RuntimeException
e
)
{
// if sharing failed due to ASLR or similar reasons,
// check whether sharing was attempted at all (UseSharedSpaces)
output
.
shouldContain
(
"UseSharedSpaces:"
);
}
output
.
shouldHaveExitValue
(
0
);
}
}
test/runtime/SharedArchiveFile/LimitSharedSizes.java
0 → 100644
浏览文件 @
555db73d
/*
* Copyright (c) 2014, 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 LimitSharedSizes
* @summary Test handling of limits on shared space size
* @library /testlibrary
* @run main LimitSharedSizes
*/
import
com.oracle.java.testlibrary.*
;
public
class
LimitSharedSizes
{
private
static
class
SharedSizeTestData
{
public
String
optionName
;
public
String
optionValue
;
public
String
expectedErrorMsg
;
public
SharedSizeTestData
(
String
name
,
String
value
,
String
msg
)
{
optionName
=
name
;
optionValue
=
value
;
expectedErrorMsg
=
msg
;
}
}
private
static
final
SharedSizeTestData
[]
testTable
=
{
// values in this part of the test table should cause failure
// (shared space sizes are deliberately too small)
new
SharedSizeTestData
(
"-XX:SharedReadOnlySize"
,
"4M"
,
"read only"
),
new
SharedSizeTestData
(
"-XX:SharedReadWriteSize"
,
"4M"
,
"read write"
),
// Known issue, JDK-8038422 (assert() on Windows)
// new SharedSizeTestData("-XX:SharedMiscDataSize", "500k", "miscellaneous data"),
// This will cause a VM crash; commenting out for now; see bug JDK-8038268
// @ignore JDK-8038268
// new SharedSizeTestData("-XX:SharedMiscCodeSize", "20k", "miscellaneous code"),
// these values are larger than default ones, but should
// be acceptable and not cause failure
new
SharedSizeTestData
(
"-XX:SharedReadOnlySize"
,
"20M"
,
null
),
new
SharedSizeTestData
(
"-XX:SharedReadWriteSize"
,
"20M"
,
null
),
new
SharedSizeTestData
(
"-XX:SharedMiscDataSize"
,
"20M"
,
null
),
new
SharedSizeTestData
(
"-XX:SharedMiscCodeSize"
,
"20M"
,
null
)
};
public
static
void
main
(
String
[]
args
)
throws
Exception
{
String
fileName
=
"test.jsa"
;
for
(
SharedSizeTestData
td
:
testTable
)
{
String
option
=
td
.
optionName
+
"="
+
td
.
optionValue
;
System
.
out
.
println
(
"testing option <"
+
option
+
">"
);
ProcessBuilder
pb
=
ProcessTools
.
createJavaProcessBuilder
(
"-XX:+UnlockDiagnosticVMOptions"
,
"-XX:SharedArchiveFile=./"
+
fileName
,
option
,
"-Xshare:dump"
);
OutputAnalyzer
output
=
new
OutputAnalyzer
(
pb
.
start
());
if
(
td
.
expectedErrorMsg
!=
null
)
{
output
.
shouldContain
(
"The shared "
+
td
.
expectedErrorMsg
+
" space is not large enough"
);
output
.
shouldHaveExitValue
(
2
);
}
else
{
output
.
shouldNotContain
(
"space is not large enough"
);
output
.
shouldHaveExitValue
(
0
);
}
}
}
}
test/runtime/SharedArchiveFile/SharedBaseAddress.java
0 → 100644
浏览文件 @
555db73d
/*
* Copyright (c) 2014, 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 SharedBaseAddress
* @summary Test variety of values for SharedBaseAddress, making sure
* VM handles normal values as well as edge values w/o a crash.
* @library /testlibrary
* @run main SharedBaseAddress
*/
import
com.oracle.java.testlibrary.*
;
public
class
SharedBaseAddress
{
// shared base address test table
private
static
final
String
[]
testTable
=
{
"1g"
,
"8g"
,
"64g"
,
"512g"
,
"4t"
,
"32t"
,
"128t"
,
"0"
,
"1"
,
"64k"
,
"64M"
};
public
static
void
main
(
String
[]
args
)
throws
Exception
{
// Known issue on Solaris-Sparc
// @ignore JDK-8044600
if
(
Platform
.
isSolaris
()
&&
Platform
.
isSparc
())
return
;
for
(
String
testEntry
:
testTable
)
{
System
.
out
.
println
(
"sharedBaseAddress = "
+
testEntry
);
ProcessBuilder
pb
=
ProcessTools
.
createJavaProcessBuilder
(
"-XX:+UnlockDiagnosticVMOptions"
,
"-XX:SharedArchiveFile=test.jsa"
,
"-XX:SharedBaseAddress="
+
testEntry
,
"-Xshare:dump"
);
OutputAnalyzer
output
=
new
OutputAnalyzer
(
pb
.
start
());
output
.
shouldContain
(
"Loading classes to share"
);
try
{
pb
=
ProcessTools
.
createJavaProcessBuilder
(
"-XX:+UnlockDiagnosticVMOptions"
,
"-XX:SharedArchiveFile=test.jsa"
,
"-Xshare:on"
,
"-version"
);
output
=
new
OutputAnalyzer
(
pb
.
start
());
output
.
shouldContain
(
"sharing"
);
output
.
shouldHaveExitValue
(
0
);
}
catch
(
RuntimeException
e
)
{
output
.
shouldContain
(
"Unable to use shared archive"
);
output
.
shouldHaveExitValue
(
1
);
}
}
}
}
test/runtime/SharedArchiveFile/SpaceUtilizationCheck.java
0 → 100644
浏览文件 @
555db73d
/*
* Copyright (c) 2014, 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 SpaceUtilizationCheck
* @summary Check if the space utilization for shared spaces is adequate
* @library /testlibrary
* @run main SpaceUtilizationCheck
*/
import
com.oracle.java.testlibrary.*
;
import
java.util.regex.Pattern
;
import
java.util.regex.Matcher
;
import
java.util.ArrayList
;
import
java.lang.Integer
;
public
class
SpaceUtilizationCheck
{
// Minimum allowed utilization value (percent)
// The goal is to have this number to be 50% for RO and RW regions
// Once that feature is implemented, increase the MIN_UTILIZATION to 50
private
static
final
int
MIN_UTILIZATION
=
30
;
// Only RO and RW regions are considered for this check, since they
// currently account for the bulk of the shared space
private
static
final
int
NUMBER_OF_CHECKED_SHARED_REGIONS
=
2
;
public
static
void
main
(
String
[]
args
)
throws
Exception
{
ProcessBuilder
pb
=
ProcessTools
.
createJavaProcessBuilder
(
"-XX:+UnlockDiagnosticVMOptions"
,
"-XX:SharedArchiveFile=./test.jsa"
,
"-Xshare:dump"
);
OutputAnalyzer
output
=
new
OutputAnalyzer
(
pb
.
start
());
String
stdout
=
output
.
getStdout
();
ArrayList
<
String
>
utilization
=
findUtilization
(
stdout
);
if
(
utilization
.
size
()
!=
NUMBER_OF_CHECKED_SHARED_REGIONS
)
throw
new
RuntimeException
(
"The output format of sharing summary has changed"
);
for
(
String
str
:
utilization
)
{
int
value
=
Integer
.
parseInt
(
str
);
if
(
value
<
MIN_UTILIZATION
)
{
System
.
out
.
println
(
stdout
);
throw
new
RuntimeException
(
"Utilization for one of the regions"
+
"is below a threshold of "
+
MIN_UTILIZATION
+
"%"
);
}
}
}
public
static
ArrayList
<
String
>
findUtilization
(
String
input
)
{
ArrayList
<
String
>
regions
=
filterRegionsOfInterest
(
input
.
split
(
"\n"
));
return
filterByPattern
(
filterByPattern
(
regions
,
"bytes \\[.*% used\\]"
),
"\\d+"
);
}
private
static
ArrayList
<
String
>
filterByPattern
(
Iterable
<
String
>
input
,
String
pattern
)
{
ArrayList
<
String
>
result
=
new
ArrayList
<
String
>();
for
(
String
str
:
input
)
{
Matcher
matcher
=
Pattern
.
compile
(
pattern
).
matcher
(
str
);
if
(
matcher
.
find
())
{
result
.
add
(
matcher
.
group
());
}
}
return
result
;
}
private
static
ArrayList
<
String
>
filterRegionsOfInterest
(
String
[]
inputLines
)
{
ArrayList
<
String
>
result
=
new
ArrayList
<
String
>();
for
(
String
str
:
inputLines
)
{
if
(
str
.
contains
(
"ro space:"
)
||
str
.
contains
(
"rw space:"
))
{
result
.
add
(
str
);
}
}
return
result
;
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录