mirror of
https://github.com/openjdk/jdk.git
synced 2026-04-13 16:38:50 +00:00
Merge
This commit is contained in:
commit
17f85d7987
@ -250,7 +250,7 @@ endef
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
|
||||
jdk_%:
|
||||
jdk_% core_% svc_%:
|
||||
$(ECHO) "Running tests: $@"
|
||||
for each in $@; do \
|
||||
$(MAKE) -j 1 TEST_SELECTION=":$$each" UNIQUE_DIR=$$each jtreg_tests; \
|
||||
|
||||
@ -176,9 +176,6 @@ com/sun/net/httpserver/bugs/6725892/Test.java generic-all
|
||||
# Filed 7036666
|
||||
com/sun/net/httpserver/Test9a.java generic-all
|
||||
|
||||
# 7102670
|
||||
java/net/InetAddress/CheckJNI.java linux-all
|
||||
|
||||
# failing on vista 32/64 on nightly
|
||||
# 7102702
|
||||
java/net/PortUnreachableException/OneExceptionOnly.java windows-all
|
||||
@ -293,6 +290,9 @@ com/sun/tools/attach/BasicTests.sh generic-all
|
||||
# 7132203
|
||||
sun/jvmstat/monitor/MonitoredVm/CR6672135.java generic-all
|
||||
|
||||
# 8028474
|
||||
sun/jvmstat/monitor/MonitoredVm/MonitorVmStartTerminate.sh generic-all
|
||||
|
||||
# Tests take too long, on sparcs see 7143279
|
||||
tools/pack200/CommandLineTests.java solaris-all, macosx-all
|
||||
tools/pack200/Pack200Test.java solaris-all, macosx-all
|
||||
|
||||
@ -2016,6 +2016,7 @@ public class Basic {
|
||||
&& new File("/bin/bash").exists()
|
||||
&& new File("/bin/sleep").exists()) {
|
||||
final String[] cmd = { "/bin/bash", "-c", "(/bin/sleep 6666)" };
|
||||
final String[] cmdkill = { "/bin/bash", "-c", "(/usr/bin/pkill -f \"sleep 6666\")" };
|
||||
final ProcessBuilder pb = new ProcessBuilder(cmd);
|
||||
final Process p = pb.start();
|
||||
final InputStream stdout = p.getInputStream();
|
||||
@ -2043,6 +2044,7 @@ public class Basic {
|
||||
stdout.close();
|
||||
stderr.close();
|
||||
stdin.close();
|
||||
new ProcessBuilder(cmdkill).start();
|
||||
//----------------------------------------------------------
|
||||
// There remain unsolved issues with asynchronous close.
|
||||
// Here's a highly non-portable experiment to demonstrate:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1998, 2013, 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
|
||||
@ -127,6 +127,33 @@ public class TestLibrary {
|
||||
bomb(null, e);
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method to determine if registry has started
|
||||
*
|
||||
* @param port The port number to check
|
||||
* @param msTimeout The amount of milliseconds to spend checking
|
||||
*/
|
||||
|
||||
public static boolean checkIfRegistryRunning(int port, int msTimeout) {
|
||||
long stopTime = System.currentTimeMillis() + msTimeout;
|
||||
do {
|
||||
try {
|
||||
Registry r = LocateRegistry.getRegistry(port);
|
||||
String[] s = r.list();
|
||||
// no exception. We're now happy that registry is running
|
||||
return true;
|
||||
} catch (RemoteException e) {
|
||||
// problem - not ready ? Try again
|
||||
try {
|
||||
Thread.sleep(500);
|
||||
} catch (InterruptedException ie) {
|
||||
// not expected
|
||||
}
|
||||
}
|
||||
} while (stopTime > System.currentTimeMillis());
|
||||
return false;
|
||||
}
|
||||
|
||||
public static String getProperty(String property, String defaultVal) {
|
||||
final String prop = property;
|
||||
final String def = defaultVal;
|
||||
|
||||
@ -68,6 +68,31 @@ public final class FileUtils {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes a file, retrying if necessary.
|
||||
* No exception thrown if file doesn't exist.
|
||||
*
|
||||
* @param path the file to delete
|
||||
*
|
||||
* @throws NoSuchFileException
|
||||
* if the file does not exist (optional specific exception)
|
||||
* @throws DirectoryNotEmptyException
|
||||
* if the file is a directory and could not otherwise be deleted
|
||||
* because the directory is not empty (optional specific exception)
|
||||
* @throws IOException
|
||||
* if an I/O error occurs
|
||||
*/
|
||||
public static void deleteFileIfExistsWithRetry(Path path)
|
||||
throws IOException
|
||||
{
|
||||
try {
|
||||
if(Files.exists(path))
|
||||
deleteFileWithRetry0(path);
|
||||
} catch (InterruptedException x) {
|
||||
throw new IOException("Interrupted while deleting.", x);
|
||||
}
|
||||
}
|
||||
|
||||
private static void deleteFileWithRetry0(Path path)
|
||||
throws IOException, InterruptedException
|
||||
{
|
||||
|
||||
@ -29,10 +29,15 @@
|
||||
|
||||
import java.io.File;
|
||||
import java.io.PrintWriter;
|
||||
import java.util.Date;
|
||||
import java.nio.file.attribute.FileTime;
|
||||
import sun.tools.jar.Main;
|
||||
|
||||
public class JarEntryTime {
|
||||
|
||||
// ZipEntry's mod date has 2 seconds precision: give extra time to
|
||||
// allow for e.g. rounding/truncation and networked/samba drives.
|
||||
static final long PRECISION = 10000L;
|
||||
|
||||
static boolean cleanup(File dir) throws Throwable {
|
||||
boolean rc = true;
|
||||
File[] x = dir.listFiles();
|
||||
@ -88,9 +93,9 @@ public class JarEntryTime {
|
||||
check(dirOuter.mkdir());
|
||||
check(dirInner.mkdir());
|
||||
File fileInner = new File(dirInner, "foo.txt");
|
||||
PrintWriter pw = new PrintWriter(fileInner);
|
||||
pw.println("hello, world");
|
||||
pw.close();
|
||||
try (PrintWriter pw = new PrintWriter(fileInner)) {
|
||||
pw.println("hello, world");
|
||||
}
|
||||
|
||||
// Get the "now" from the "last-modified-time" of the last file we
|
||||
// just created, instead of the "System.currentTimeMillis()", to
|
||||
@ -98,13 +103,10 @@ public class JarEntryTime {
|
||||
final long now = fileInner.lastModified();
|
||||
final long earlier = now - (60L * 60L * 6L * 1000L);
|
||||
final long yesterday = now - (60L * 60L * 24L * 1000L);
|
||||
// ZipEntry's mod date has 2 seconds precision: give extra time to
|
||||
// allow for e.g. rounding/truncation and networked/samba drives.
|
||||
final long PRECISION = 10000L;
|
||||
|
||||
dirOuter.setLastModified(now);
|
||||
dirInner.setLastModified(yesterday);
|
||||
fileInner.setLastModified(earlier);
|
||||
check(dirOuter.setLastModified(now));
|
||||
check(dirInner.setLastModified(yesterday));
|
||||
check(fileInner.setLastModified(earlier));
|
||||
|
||||
// Make a jar file from that directory structure
|
||||
Main jartool = new Main(System.out, System.err, "jar");
|
||||
@ -122,9 +124,9 @@ public class JarEntryTime {
|
||||
check(dirOuter.exists());
|
||||
check(dirInner.exists());
|
||||
check(fileInner.exists());
|
||||
check(Math.abs(dirOuter.lastModified() - now) <= PRECISION);
|
||||
check(Math.abs(dirInner.lastModified() - yesterday) <= PRECISION);
|
||||
check(Math.abs(fileInner.lastModified() - earlier) <= PRECISION);
|
||||
checkFileTime(dirOuter.lastModified(), now);
|
||||
checkFileTime(dirInner.lastModified(), yesterday);
|
||||
checkFileTime(fileInner.lastModified(), earlier);
|
||||
|
||||
check(cleanup(dirInner));
|
||||
check(cleanup(dirOuter));
|
||||
@ -135,9 +137,9 @@ public class JarEntryTime {
|
||||
check(dirOuter.exists());
|
||||
check(dirInner.exists());
|
||||
check(fileInner.exists());
|
||||
check(Math.abs(dirOuter.lastModified() - now) <= PRECISION);
|
||||
check(Math.abs(dirInner.lastModified() - now) <= PRECISION);
|
||||
check(Math.abs(fileInner.lastModified() - now) <= PRECISION);
|
||||
checkFileTime(dirOuter.lastModified(), now);
|
||||
checkFileTime(dirInner.lastModified(), now);
|
||||
checkFileTime(fileInner.lastModified(), now);
|
||||
|
||||
check(cleanup(dirInner));
|
||||
check(cleanup(dirOuter));
|
||||
@ -145,6 +147,14 @@ public class JarEntryTime {
|
||||
check(jarFile.delete());
|
||||
}
|
||||
|
||||
static void checkFileTime(long now, long original) {
|
||||
if (Math.abs(now - original) > PRECISION) {
|
||||
System.out.format("Extracted to %s, expected to be close to %s%n",
|
||||
FileTime.fromMillis(now), FileTime.fromMillis(original));
|
||||
fail();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------- Infrastructure ---------------------------
|
||||
static volatile int passed = 0, failed = 0;
|
||||
static void pass() {passed++;}
|
||||
|
||||
@ -89,10 +89,6 @@ public class ExecutionEnvironment extends TestHelper {
|
||||
|
||||
static final File testJarFile = new File("EcoFriendly.jar");
|
||||
|
||||
static final String LIBJVM = TestHelper.isWindows
|
||||
? "jvm.dll"
|
||||
: "libjvm" + (TestHelper.isMacOSX ? ".dylib" : ".so");
|
||||
|
||||
public ExecutionEnvironment() {
|
||||
createTestJar();
|
||||
}
|
||||
@ -192,7 +188,7 @@ public class ExecutionEnvironment extends TestHelper {
|
||||
|
||||
tr = doExec(env, javaCmd, "-jar", testJarFile.getAbsolutePath());
|
||||
verifyJavaLibraryPathGeneric(tr);
|
||||
} else {
|
||||
} else { // Solaris
|
||||
// no override
|
||||
env.clear();
|
||||
env.put(LD_LIBRARY_PATH, LD_LIBRARY_PATH_VALUE);
|
||||
@ -236,23 +232,24 @@ public class ExecutionEnvironment extends TestHelper {
|
||||
}
|
||||
|
||||
/*
|
||||
* ensures we have indeed exec'ed the correct vm of choice, all VMs support
|
||||
* -server, however 32-bit VMs support -client and -server.
|
||||
* ensures we have indeed exec'ed the correct vm of choice if it exists
|
||||
*/
|
||||
@Test
|
||||
void testVmSelection() {
|
||||
|
||||
TestResult tr = null;
|
||||
|
||||
if (is32Bit) {
|
||||
if (haveClientVM) {
|
||||
tr = doExec(javaCmd, "-client", "-version");
|
||||
if (!tr.matches(".*Client VM.*")) {
|
||||
flagError(tr, "the expected vm -client did not launch");
|
||||
}
|
||||
}
|
||||
tr = doExec(javaCmd, "-server", "-version");
|
||||
if (!tr.matches(".*Server VM.*")) {
|
||||
flagError(tr, "the expected vm -server did not launch");
|
||||
if (haveServerVM) {
|
||||
tr = doExec(javaCmd, "-server", "-version");
|
||||
if (!tr.matches(".*Server VM.*")) {
|
||||
flagError(tr, "the expected vm -server did not launch");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -208,6 +208,10 @@ public class Test7029048 extends TestHelper {
|
||||
System.out.println("Note: applicable on neither Windows nor MacOSX");
|
||||
return;
|
||||
}
|
||||
if (!TestHelper.haveServerVM) {
|
||||
System.out.println("Note: test relies on server vm, not found, exiting");
|
||||
return;
|
||||
}
|
||||
// create our test jar first
|
||||
ExecutionEnvironment.createTestJar();
|
||||
|
||||
|
||||
@ -67,11 +67,15 @@ public class TestHelper {
|
||||
static final String JAVAHOME = System.getProperty("java.home");
|
||||
static final String JAVA_BIN;
|
||||
static final String JAVA_JRE_BIN;
|
||||
static final String JAVA_LIB;
|
||||
static final String JAVA_JRE_LIB;
|
||||
static final boolean isSDK = JAVAHOME.endsWith("jre");
|
||||
static final String javaCmd;
|
||||
static final String javawCmd;
|
||||
static final String javacCmd;
|
||||
static final String jarCmd;
|
||||
static final boolean haveServerVM;
|
||||
static final boolean haveClientVM;
|
||||
|
||||
static final JavaCompiler compiler;
|
||||
|
||||
@ -88,6 +92,9 @@ public class TestHelper {
|
||||
System.getProperty("os.name", "unknown").startsWith("SunOS");
|
||||
static final boolean isLinux =
|
||||
System.getProperty("os.name", "unknown").startsWith("Linux");
|
||||
static final String LIBJVM = isWindows
|
||||
? "jvm.dll"
|
||||
: "libjvm" + (isMacOSX ? ".dylib" : ".so");
|
||||
|
||||
static final boolean isSparc = System.getProperty("os.arch").startsWith("sparc");
|
||||
|
||||
@ -124,12 +131,19 @@ public class TestHelper {
|
||||
throw new RuntimeException("arch model is not 32 or 64 bit ?");
|
||||
}
|
||||
compiler = ToolProvider.getSystemJavaCompiler();
|
||||
|
||||
File binDir = (isSDK)
|
||||
? new File((new File(JAVAHOME)).getParentFile(), "bin")
|
||||
: new File(JAVAHOME, "bin");
|
||||
JAVA_BIN = binDir.getAbsolutePath();
|
||||
JAVA_JRE_BIN = new File((new File(JAVAHOME)).getParentFile(),
|
||||
(isSDK) ? "jre/bin" : "bin").getAbsolutePath();
|
||||
JAVA_JRE_BIN = new File(JAVAHOME, "bin").getAbsolutePath();
|
||||
|
||||
File libDir = (isSDK)
|
||||
? new File((new File(JAVAHOME)).getParentFile(), "lib")
|
||||
: new File(JAVAHOME, "lib");
|
||||
JAVA_LIB = libDir.getAbsolutePath();
|
||||
JAVA_JRE_LIB = new File(JAVAHOME, "lib").getAbsolutePath();
|
||||
|
||||
File javaCmdFile = (isWindows)
|
||||
? new File(binDir, "java.exe")
|
||||
: new File(binDir, "java");
|
||||
@ -168,6 +182,21 @@ public class TestHelper {
|
||||
throw new RuntimeException("java <" + javacCmd +
|
||||
"> must exist and should be executable");
|
||||
}
|
||||
|
||||
haveClientVM = haveVmVariant("client");
|
||||
haveServerVM = haveVmVariant("server");
|
||||
}
|
||||
private static boolean haveVmVariant(String type) {
|
||||
if (isWindows) {
|
||||
File vmDir = new File(JAVA_JRE_BIN, type);
|
||||
File jvmFile = new File(vmDir, LIBJVM);
|
||||
return jvmFile.exists();
|
||||
} else {
|
||||
File vmDir = new File(JAVA_JRE_LIB, type);
|
||||
File vmArchDir = new File(vmDir, getJreArch());
|
||||
File jvmFile = new File(vmArchDir, LIBJVM);
|
||||
return jvmFile.exists();
|
||||
}
|
||||
}
|
||||
void run(String[] args) throws Exception {
|
||||
int passed = 0, failed = 0;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user