11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 */ 23 24 /* 25 * @test 26 * @bug 7162400 27 * @key regression 28 * @summary Regression test for attach issue where stale pid files in /tmp lead to connection issues 29 * @modules java.base/jdk.internal.misc 30 * @modules jdk.attach/sun.tools.attach 31 * @library /testlibrary 32 * @build jdk.test.lib.* AttachWithStalePidFileTarget 33 * @run main AttachWithStalePidFile 34 */ 35 36 import jdk.test.lib.*; 37 import com.sun.tools.attach.VirtualMachine; 38 import sun.tools.attach.HotSpotVirtualMachine; 39 import java.lang.reflect.Field; 40 import java.nio.file.*; 41 import java.nio.file.attribute.*; 42 import java.io.*; 43 44 public class AttachWithStalePidFile { 45 public static void main(String... args) throws Exception { 46 47 // this test is only valid on non-Windows platforms 48 if(Platform.isWindows()) { 49 System.out.println("This test is only valid on non-Windows platforms."); 50 return; 51 } 52 53 // Since there might be stale pid-files owned by different 54 // users on the system we may need to retry the test in case we 55 // are unable to remove the existing file. 56 int retries = 5; | 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 */ 23 24 /* 25 * @test 26 * @bug 7162400 27 * @key regression 28 * @summary Regression test for attach issue where stale pid files in /tmp lead to connection issues 29 * @modules java.base/jdk.internal.misc 30 * @modules jdk.attach/sun.tools.attach 31 * @library /test/lib 32 * @run main AttachWithStalePidFile 33 */ 34 35 import jdk.test.lib.Platform; 36 import jdk.test.lib.process.ProcessTools; 37 import com.sun.tools.attach.VirtualMachine; 38 import sun.tools.attach.HotSpotVirtualMachine; 39 import java.lang.reflect.Field; 40 import java.nio.file.*; 41 import java.nio.file.attribute.*; 42 import java.io.*; 43 44 public class AttachWithStalePidFile { 45 public static void main(String... args) throws Exception { 46 47 // this test is only valid on non-Windows platforms 48 if(Platform.isWindows()) { 49 System.out.println("This test is only valid on non-Windows platforms."); 50 return; 51 } 52 53 // Since there might be stale pid-files owned by different 54 // users on the system we may need to retry the test in case we 55 // are unable to remove the existing file. 56 int retries = 5; |