changeset 53203:5c65191e56b9

8215369: Jcstress pollute /var/tmp with temporary files. Reviewed-by: iignatyev, mseledtsov
author lmesnik
date Thu, 13 Dec 2018 14:16:21 -0800
parents cc4098b3bc10
children 7d4397b43fa3
files test/hotspot/jtreg/applications/jcstress/JcstressRunner.java
diffstat 1 files changed, 9 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/test/hotspot/jtreg/applications/jcstress/JcstressRunner.java	Thu Dec 13 16:45:26 2018 +0100
+++ b/test/hotspot/jtreg/applications/jcstress/JcstressRunner.java	Thu Dec 13 14:16:21 2018 -0800
@@ -89,6 +89,11 @@
     private static String[] getCmd(String[] args) {
         List<String> extraFlags = new ArrayList<>();
 
+        // java.io.tmpdir is set for both harness and forked VM so temporary files
+        // created like this File.createTempFile("jcstress", "stdout");
+        // don't pollute temporary directories
+        extraFlags.add("-Djava.io.tmpdir=" + System.getProperty("user.dir"));
+
         // add jar with jcstress tests and harness to CP
         extraFlags.add("-cp");
         extraFlags.add(System.getProperty("java.class.path")
@@ -97,16 +102,11 @@
 
         extraFlags.add(MAIN_CLASS);
 
-        String[] javaOpts = Utils.getTestJavaOpts();
-        // disable flags auto-detection
-        if (0 == javaOpts.length) {
+        extraFlags.add("--jvmArgs");
+        extraFlags.add("-Djava.io.tmpdir=" + System.getProperty("user.dir"));
+        for (String jvmArg : Utils.getTestJavaOpts()) {
             extraFlags.add("--jvmArgs");
-            extraFlags.add("");
-        } else {
-            for (String jvmArg : Utils.getTestJavaOpts()) {
-                extraFlags.add("--jvmArgs");
-                extraFlags.add(jvmArg);
-            }
+            extraFlags.add(jvmArg);
         }
 
         String[] result = new String[extraFlags.size() + args.length];