Failures have been seen where jtreg has not been able to cleanup the scratch directory.
The root cause is two fold:
Cause 1: ToolBox does not close and release the resources when a test is run via the
runAPI method, we need to do something like this:
diff --git a/test/tools/lib/ToolBox.java b/test/tools/lib/ToolBox.java
--- a/test/tools/lib/ToolBox.java
+++ b/test/tools/lib/ToolBox.java
@@ -1029,7 +1029,9 @@
allOpts,
classes,
allFiles);
- return ((JavacTaskImpl) task).doCall().exitCode;
+ int rc = ((JavacTaskImpl) task).doCall().exitCode;
+ fileManager.close();
+ return rc;
}
Cause 2: the above will still not work for certain cases, here is why:
a Jar inserted on to the class path via a class-path manifest entry in a Jar,
and also the JAR which contains the entry will not be added to the
StandardJavaFileManager list of known resources thus calling fileManager.close()
will not close the said resource. This behavior is exhibited by the test
test/tools/javac/Paths/AbsolutePathTest.java
A sanity check would be is to check if both test.jar and test2.jar are released.
The root cause is two fold:
Cause 1: ToolBox does not close and release the resources when a test is run via the
runAPI method, we need to do something like this:
diff --git a/test/tools/lib/ToolBox.java b/test/tools/lib/ToolBox.java
--- a/test/tools/lib/ToolBox.java
+++ b/test/tools/lib/ToolBox.java
@@ -1029,7 +1029,9 @@
allOpts,
classes,
allFiles);
- return ((JavacTaskImpl) task).doCall().exitCode;
+ int rc = ((JavacTaskImpl) task).doCall().exitCode;
+ fileManager.close();
+ return rc;
}
Cause 2: the above will still not work for certain cases, here is why:
a Jar inserted on to the class path via a class-path manifest entry in a Jar,
and also the JAR which contains the entry will not be added to the
StandardJavaFileManager list of known resources thus calling fileManager.close()
will not close the said resource. This behavior is exhibited by the test
test/tools/javac/Paths/AbsolutePathTest.java
A sanity check would be is to check if both test.jar and test2.jar are released.
- relates to
-
JDK-8152476 FSInfo assumes default file system in use of getJarClassPath
- Open
-
JDK-8055500 [javac] fix for 8030046 is incorrect
- Closed