Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
47726bf5
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看板
提交
47726bf5
编写于
8月 30, 2013
作者:
D
dxu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8023765: Improve MaxPathLength.java testcase and reduce its test load
7160013: java/io/File/MaxPathLength.java fails Reviewed-by: alanb
上级
1ea3783b
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
39 addition
and
35 deletion
+39
-35
test/ProblemList.txt
test/ProblemList.txt
+0
-7
test/java/io/File/MaxPathLength.java
test/java/io/File/MaxPathLength.java
+39
-28
未找到文件。
test/ProblemList.txt
浏览文件 @
47726bf5
...
...
@@ -205,13 +205,6 @@ sun/net/www/http/HttpClient/ProxyTest.java generic-all
############################################################################
# jdk_io
# 7160013
#java/io/File/MaxPathLength.java windows-all
############################################################################
# jdk_nio
# 6963118
...
...
test/java/io/File/MaxPathLength.java
浏览文件 @
47726bf5
...
...
@@ -22,7 +22,7 @@
*/
/* @test
@bug 4759207 4403166 4165006 4403166 6182812 6274272
@bug 4759207 4403166 4165006 4403166 6182812 6274272
7160013
@summary Test to see if win32 path length can be greater than 260
*/
...
...
@@ -37,6 +37,10 @@ public class MaxPathLength {
"areallylongfilenamethatsforsur"
;
private
static
boolean
isWindows
=
false
;
private
final
static
int
MAX_LENGTH
=
256
;
private
static
int
counter
=
0
;
public
static
void
main
(
String
[]
args
)
throws
Exception
{
String
osName
=
System
.
getProperty
(
"os.name"
);
if
(
osName
.
startsWith
(
"Windows"
))
{
...
...
@@ -45,33 +49,39 @@ public class MaxPathLength {
for
(
int
i
=
4
;
i
<
7
;
i
++)
{
String
name
=
fileName
;
while
(
name
.
length
()
<
256
)
{
while
(
name
.
length
()
<
MAX_LENGTH
)
{
testLongPath
(
i
,
name
,
false
);
testLongPath
(
i
,
name
,
true
);
name
+=
"A"
;
name
=
getNextName
(
name
)
;
}
}
// test long paths on windows
// And these long pathes cannot be handled on Solaris and Mac platforms
if
(
isWindows
)
{
String
name
=
fileName
;
while
(
name
.
length
()
<
256
)
{
while
(
name
.
length
()
<
MAX_LENGTH
)
{
testLongPath
(
20
,
name
,
false
);
testLongPath
(
20
,
name
,
true
);
name
+=
"A"
;
name
=
getNextName
(
name
)
;
}
}
}
private
static
String
getNextName
(
String
fName
)
{
return
(
fName
.
length
()
<
MAX_LENGTH
/
2
)
?
fName
+
fName
:
fName
+
"A"
;
}
static
void
testLongPath
(
int
max
,
String
fn
,
boolean
tryAbsolute
)
throws
Exception
{
String
[]
created
=
new
String
[
max
];
String
pathString
=
"."
;
for
(
int
i
=
0
;
i
<
max
-
1
;
i
++)
{
pathString
=
pathString
+
pathComponent
;
pathString
=
pathString
+
pathComponent
+
(
counter
++)
;
created
[
max
-
1
-
i
]
=
pathString
;
}
File
dirFile
=
new
File
(
pathString
);
File
f
=
new
File
(
pathString
+
sep
+
fn
);
...
...
@@ -88,9 +98,10 @@ public class MaxPathLength {
System
.
err
.
println
(
"Warning: Test directory structure exists already!"
);
return
;
}
Files
.
createDirectories
(
dirFile
.
toPath
());
try
{
Files
.
createDirectories
(
dirFile
.
toPath
());
if
(
tryAbsolute
)
dirFile
=
new
File
(
dirFile
.
getCanonicalPath
());
if
(!
dirFile
.
isDirectory
())
...
...
@@ -99,6 +110,7 @@ public class MaxPathLength {
if
(!
f
.
createNewFile
())
{
throw
new
RuntimeException
(
"File.createNewFile() failed"
);
}
if
(!
f
.
exists
())
throw
new
RuntimeException
(
"File.exists() failed"
);
if
(!
f
.
isFile
())
...
...
@@ -107,11 +119,14 @@ public class MaxPathLength {
throw
new
RuntimeException
(
"File.canRead() failed"
);
if
(!
f
.
canWrite
())
throw
new
RuntimeException
(
"File.canWrite() failed"
);
if
(!
f
.
delete
())
throw
new
RuntimeException
(
"File.delete() failed"
);
FileOutputStream
fos
=
new
FileOutputStream
(
f
);
fos
.
write
(
1
);
fos
.
close
();
if
(
f
.
length
()
!=
1
)
throw
new
RuntimeException
(
"File.length() failed"
);
long
time
=
System
.
currentTimeMillis
();
...
...
@@ -148,30 +163,26 @@ public class MaxPathLength {
throw
new
RuntimeException
(
"File.renameTo() failed for lenth="
+
abPath
.
length
());
}
return
;
}
else
{
if
(!
nf
.
canRead
())
throw
new
RuntimeException
(
"Renamed file is not readable"
);
if
(!
nf
.
canWrite
())
throw
new
RuntimeException
(
"Renamed file is not writable"
);
if
(
nf
.
length
()
!=
1
)
throw
new
RuntimeException
(
"Renamed file's size is not correct"
);
if
(!
nf
.
renameTo
(
f
))
{
created
[
0
]
=
nf
.
getPath
();
}
/* add a script to test these two if we got a regression later
if (!f.setReadOnly())
throw new RuntimeException ("File.setReadOnly() failed");
f.deleteOnExit();
*/
}
if
(!
nf
.
canRead
())
throw
new
RuntimeException
(
"Renamed file is not readable"
);
if
(!
nf
.
canWrite
())
throw
new
RuntimeException
(
"Renamed file is not writable"
);
if
(
nf
.
length
()
!=
1
)
throw
new
RuntimeException
(
"Renamed file's size is not correct"
);
nf
.
renameTo
(
f
);
/* add a script to test these two if we got a regression later
if (!f.setReadOnly())
throw new RuntimeException ("File.setReadOnly() failed");
f.deleteOnExit();
*/
}
finally
{
// Clean up
for
(
int
i
=
0
;
i
<
max
;
i
++)
{
pathString
=
created
[
i
];
// Only works with completex canonical paths
File
df
=
new
File
(
pathString
);
pathString
=
df
.
getCanonicalPath
();
df
=
new
File
(
pathString
);
if
(!
df
.
delete
())
System
.
out
.
printf
(
"Delete failed->%s\n"
,
pathString
);
Files
.
deleteIfExists
((
new
File
(
created
[
i
])).
toPath
());
}
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录