< prev index next >

test/hotspot/jtreg/runtime/8176717/TestInheritFD.java

8205054: Could not find "lsof" on test machine
Reviewed-by: goetz
-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;
-import static java.util.Arrays.stream;
-import static java.util.Collections.emptyList;
-import static java.util.stream.Collectors.joining;
-import static java.util.stream.Collectors.toList;
-import static jdk.test.lib.process.ProcessTools.createJavaProcessBuilder;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.util.Collection;
-import java.util.Optional;
-import java.util.stream.Stream;
-
 /*
  * Copyright (c) 2018, 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

@@ -39,10 +19,30 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * 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; +import static java.util.Arrays.stream; +import static java.util.Collections.emptyList; +import static java.util.stream.Collectors.joining; +import static java.util.stream.Collectors.toList; +import static jdk.test.lib.process.ProcessTools.createJavaProcessBuilder; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStreamReader; +import java.util.Collection; +import java.util.Optional; +import java.util.stream.Stream; + /* * @test TestInheritFD * @bug 8176717 8176809 * @summary a new process should not inherit open file descriptors * @library /test/lib
@@ -174,11 +174,12 {"/usr/bin/pfiles", "-F"}}) // Solaris .filter(args -> new File(args[0]).exists()) .findFirst(); System.out.println("using command: " + command.map((c) -> c[0] + " " + c[1]).orElse("<not found>")); - return command.map(c -> run(c[0], c[1], "" + pid).collect(toList())).orElse(emptyList()); // if command can not be found return list without log file (some machines does not have "lsof" in the expected place) + // if command can not be found return list without log file (some machines does not have "lsof" in the expected place) + return command.map(c -> run(c[0], c[1], "" + pid).collect(toList())).orElse(emptyList()); } static boolean findOpenLogFile(Collection<String> fileNames) { return fileNames.stream() .filter(fileName -> fileName.contains(LOG_SUFFIX))
< prev index next >