Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_langtools
提交
3f3a5fe2
D
dragonwell8_langtools
项目概览
openanolis
/
dragonwell8_langtools
通知
0
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dragonwell8_langtools
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
3f3a5fe2
编写于
9月 18, 2008
作者:
J
jjg
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
6728697: tools/javac/versionOpt.sh fails on OpenJDK builds
Reviewed-by: darcy
上级
de6f1495
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
104 addition
and
95 deletion
+104
-95
test/Makefile
test/Makefile
+0
-1
test/bootclasspath-exclude.jtx
test/bootclasspath-exclude.jtx
+0
-7
test/tools/javac/VersionOpt.java
test/tools/javac/VersionOpt.java
+104
-0
test/tools/javac/versionOpt.sh
test/tools/javac/versionOpt.sh
+0
-87
未找到文件。
test/Makefile
浏览文件 @
3f3a5fe2
...
...
@@ -105,7 +105,6 @@ jtreg-tests: FRC
-w
:
$(TEST_OUTPUT_DIR)
/JTwork
\
-jdk
:
$(TESTJAVA)
\
-Xbootclasspath
/p:
$(TESTBOOTCLASSPATH)
\
-exclude
:bootclasspath-exclude.jtx
\
$
(
JAVA_TOOL_OPTIONS:%
=
-vmoption
:%
)
\
$
(
JAVA_ARGS:%
=
-vmoption
:%
)
\
$(TESTDIRS)
...
...
test/bootclasspath-exclude.jtx
已删除
100644 → 0
浏览文件 @
de6f1495
# When you run the tests using a recent build of JDK and -Xbootclasspath/p:JAR
# some tests may fail. Specifically, javac has a test which verifies the content
# of the version string by comparing it against a value that is derived from
# the JRE version string. This file can be given to jtreg to exclude such tests.
# It should *NOT* be used in full SQE runs.
tools/javac/versionOpt.sh
test/tools/javac/VersionOpt.java
0 → 100644
浏览文件 @
3f3a5fe2
/*
* Copyright 2005-2008 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/*
* @test
* @bug 6728697
* @summary tools/javac/versionOpt.sh fails on OpenJDK builds
* Test checks the version strings displayed by javac, using
* strings that come out of the Java runtime.
*/
import
java.io.File
;
import
java.io.PrintWriter
;
import
java.io.StringWriter
;
import
java.net.URL
;
public
class
VersionOpt
{
public
static
void
main
(
String
...
args
)
throws
Exception
{
new
VersionOpt
().
run
();
}
void
run
()
throws
Exception
{
// Test functions by comparing the version string from javac against
// a "golden" version generated automatically from the underlying JVM.
// As such, it is only effective in testing the "standard" compiler,
// and not any development version being tested via -Xbootclasspath.
// Check the version of the compiler being used, and let the test pass
// automatically if is is a development version.
Class
<?>
javacClass
=
com
.
sun
.
tools
.
javac
.
Main
.
class
;
URL
javacURL
=
getClass
().
getClassLoader
().
getResource
(
javacClass
.
getName
().
replace
(
"."
,
"/"
)
+
".class"
);
if
(!
javacURL
.
getProtocol
().
equals
(
"jar"
)
||
!
javacURL
.
getFile
().
contains
(
"!"
))
{
System
.
err
.
println
(
"javac not found in tools.jar: "
+
javacURL
);
System
.
err
.
println
(
"rest of test skipped"
);
return
;
}
String
javacHome
=
javacURL
.
getFile
().
substring
(
0
,
javacURL
.
getFile
().
indexOf
(
"!"
));
File
javaHome
=
new
File
(
System
.
getProperty
(
"java.home"
));
if
(
javaHome
.
getName
().
equals
(
"jre"
))
javaHome
=
javaHome
.
getParentFile
();
File
toolsJar
=
new
File
(
new
File
(
javaHome
,
"lib"
),
"tools.jar"
);
if
(!
javacHome
.
equals
(
toolsJar
.
toURI
().
toString
())){
System
.
err
.
println
(
"javac not found in tools.jar: "
+
javacHome
);
System
.
err
.
println
(
"rest of test skipped"
);
return
;
}
System
.
out
.
println
(
"javac found in "
+
toolsJar
);
String
javaVersion
=
System
.
getProperty
(
"java.version"
);
String
javaRuntimeVersion
=
System
.
getProperty
(
"java.runtime.version"
);
System
.
out
.
println
(
"java.version: "
+
javaVersion
);
System
.
out
.
println
(
"java.runtime.version: "
+
javaRuntimeVersion
);
StringWriter
sw
=
new
StringWriter
();
com
.
sun
.
tools
.
javac
.
Main
.
compile
(
new
String
[]
{
"-version"
},
new
PrintWriter
(
sw
));
String
javacVersion
=
sw
.
toString
().
trim
();
sw
=
new
StringWriter
();
com
.
sun
.
tools
.
javac
.
Main
.
compile
(
new
String
[]
{
"-fullversion"
},
new
PrintWriter
(
sw
));
String
javacFullVersion
=
sw
.
toString
().
trim
();
System
.
out
.
println
(
"javac -version: "
+
javacVersion
);
System
.
out
.
println
(
"javac -fullversion: "
+
javacFullVersion
);
checkEqual
(
"javac -version"
,
javacVersion
,
"javac "
+
javaVersion
);
checkEqual
(
"javac -fullversion"
,
javacFullVersion
,
"javac full version \""
+
javaRuntimeVersion
+
"\""
);
if
(
errors
>
0
)
throw
new
Exception
(
errors
+
" errors found"
);
}
void
checkEqual
(
String
kind
,
String
found
,
String
expect
)
{
if
(!
found
.
equals
(
expect
))
{
System
.
err
.
println
(
"error: unexpected value for "
+
kind
);
System
.
err
.
println
(
"expect: >>"
+
expect
+
"<<"
);
System
.
err
.
println
(
" found: >>"
+
found
+
"<<"
);
errors
++;
}
}
int
errors
;
}
test/tools/javac/versionOpt.sh
已删除
100644 → 0
浏览文件 @
de6f1495
#!/bin/sh
#
# Copyright 2005 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
# CA 95054 USA or visit www.sun.com if you need additional information or
# have any questions.
#
# @test
# @bug 4461214 6227587
# @summary support-version and -fullversion
# @run shell versionOpt.sh
if
[
"
${
TESTJAVA
}
"
=
""
]
then
echo
"TESTJAVA not set. Test cannot execute. Failed."
exit
1
fi
echo
"TESTJAVA=
${
TESTJAVA
}
"
# set platform-dependent variables
OS
=
`
uname
-s
`
case
"
$OS
"
in
SunOS
|
Linux
)
NULL
=
/dev/null
PS
=
":"
FS
=
"/"
;;
Windows
*
)
NULL
=
NUL
PS
=
";"
FS
=
"
\\
"
;;
*
)
echo
"Unrecognized system!"
exit
1
;
;;
esac
# create reference files based on java values
"
${
TESTJAVA
}${
FS
}
bin
${
FS
}
java"
${
TESTVMOPTS
}
-version
2>&1 |
\
sed
-e
's/java version "\([^"]*\)"/javac \1/'
-e
'2,$d'
>
version.ref.out
"
${
TESTJAVA
}${
FS
}
bin
${
FS
}
java"
${
TESTVMOPTS
}
-fullversion
2>&1 |
\
sed
-e
's/java full version/javac full version/'
-e
'2,$d'
>
fullversion.ref.out
# run javac
"
${
TESTJAVA
}${
FS
}
bin
${
FS
}
javac"
${
TESTTOOLVMOPTS
}
-version
2> version.out
cat
version.out
diff
-c
version.ref.out version.out
version_result
=
$?
"
${
TESTJAVA
}${
FS
}
bin
${
FS
}
javac"
${
TESTTOOLVMOPTS
}
-fullversion
2> fullversion.out
cat
fullversion.out
diff
-c
fullversion.ref.out fullversion.out
fullversion_result
=
$?
if
[
$version_result
-eq
0
-a
$fullversion_result
-eq
0
]
then
echo
"Passed"
exit
0
else
echo
"Failed"
exit
1
fi
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录