Skip to content

Commit adcfbd2

Browse files
committed
8208227: tools/jdeps/DotFileTest.java fails on Win-X64
Backport-of: f0e9643
1 parent 5c8a0b4 commit adcfbd2

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

test/langtools/tools/jdeps/DotFileTest.java

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -27,7 +27,8 @@
2727
* @summary Basic tests for jdeps -dotoutput option
2828
* @modules java.management
2929
* jdk.jdeps/com.sun.tools.jdeps
30-
* @build Test p.Foo p.Bar
30+
* @library /tools/lib
31+
* @build toolbox.ToolBox Test p.Foo p.Bar
3132
* @run main DotFileTest
3233
*/
3334

@@ -43,6 +44,8 @@
4344
import java.util.regex.*;
4445
import java.util.stream.Collectors;
4546

47+
import toolbox.ToolBox;
48+
4649
public class DotFileTest {
4750
public static void main(String... args) throws Exception {
4851
int errors = 0;
@@ -51,9 +54,11 @@ public static void main(String... args) throws Exception {
5154
throw new Exception(errors + " errors found");
5255
}
5356

57+
final ToolBox toolBox;
5458
final Path dir;
5559
final Path dotoutput;
5660
DotFileTest() {
61+
this.toolBox = new ToolBox();
5762
this.dir = Paths.get(System.getProperty("test.classes", "."));
5863
this.dotoutput = dir.resolve("dots");
5964
}
@@ -169,12 +174,10 @@ void testSummary(File file, String[] expect, String[] profiles, String[] options
169174

170175
Map<String,String> jdeps(List<String> args, Path dotfile) throws IOException {
171176
if (Files.exists(dotoutput)) {
172-
try (DirectoryStream<Path> stream = Files.newDirectoryStream(dotoutput)) {
173-
for (Path p : stream) {
174-
Files.delete(p);
175-
}
176-
}
177-
Files.delete(dotoutput);
177+
// delete contents of directory, then directory,
178+
// waiting for confirmation on Windows
179+
toolBox.cleanDirectory(dotoutput);
180+
toolBox.deleteFiles(dotoutput);
178181
}
179182
// invoke jdeps
180183
StringWriter sw = new StringWriter();

0 commit comments

Comments
 (0)