changeset 54706:81d57ba42425

8222500: runtime/8176717/TestInheritFD.java failed with java.nio.file.NoSuchFileException: /tmp/communication7071713601211876892.txt Summary: Create the test's temporary files inside of jtreg scratch directories instead of /tmp Reviewed-by: coleenp, lfoltan, dholmes
author hseigel
date Fri, 03 May 2019 07:54:09 -0400
parents fc7627bf4b01
children 8390399b09f9
files test/hotspot/jtreg/runtime/8176717/TestInheritFD.java
diffstat 1 files changed, 5 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/test/hotspot/jtreg/runtime/8176717/TestInheritFD.java	Wed Apr 17 14:57:53 2019 +0200
+++ b/test/hotspot/jtreg/runtime/8176717/TestInheritFD.java	Fri May 03 07:54:09 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. 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
@@ -21,7 +21,6 @@
  * questions.
  */
 
-import static java.io.File.createTempFile;
 import static java.lang.Long.parseLong;
 import static java.lang.System.getProperty;
 import static java.nio.file.Files.readAllBytes;
@@ -30,6 +29,7 @@
 import static java.util.stream.Collectors.toList;
 import static jdk.test.lib.process.ProcessTools.createJavaProcessBuilder;
 import static jdk.test.lib.Platform.isWindows;
+import jdk.test.lib.Utils;
 
 import java.io.BufferedReader;
 import java.io.File;
@@ -43,7 +43,7 @@
 
 /*
  * @test TestInheritFD
- * @bug 8176717 8176809
+ * @bug 8176717 8176809 8222500
  * @summary a new process should not inherit open file descriptors
  * @comment On Aix lsof requires root privileges.
  * @requires os.family != "aix"
@@ -79,8 +79,8 @@
 
     // first VM
     public static void main(String[] args) throws Exception {
-        String logPath = createTempFile("logging", LOG_SUFFIX).getName();
-        File commFile = createTempFile("communication", ".txt");
+        String logPath = Utils.createTempFile("logging", LOG_SUFFIX).toFile().getName();
+        File commFile = Utils.createTempFile("communication", ".txt").toFile();
 
         if (!isWindows() && !lsofCommand().isPresent()) {
             System.out.println("Could not find lsof like command");