aboutsummaryrefslogtreecommitdiff
path: root/test/tools
diff options
context:
space:
mode:
authorksrini <none@none>2013-09-27 16:29:44 -0700
committerksrini <none@none>2013-09-27 16:29:44 -0700
commite9d8ca60e4860c0b84fd6b23da50530ad8a1ff0a (patch)
tree6404b0365fdaae6c0f50d43b06d089f85e14be8c /test/tools
parent7331e26a2680589e6c4062eda09b51577e736bc3 (diff)
downloadjdk8u_jdk-e9d8ca60e4860c0b84fd6b23da50530ad8a1ff0a.tar.gz
8020552: [launcher] changes to support removal of Solaris 32-bit distribution
8023495: [infra] create 64-bit solaris bits with symlinks Reviewed-by: ihse, tbell, dholmes, darcy, alanb, erikj, sla, martin
Diffstat (limited to 'test/tools')
-rw-r--r--test/tools/launcher/6842838/Test6842838.sh8
-rw-r--r--test/tools/launcher/ChangeDataModel.java52
-rw-r--r--test/tools/launcher/ExecutionEnvironment.java218
-rw-r--r--test/tools/launcher/FXLauncherTest.java2
-rw-r--r--test/tools/launcher/RunpathTest.java14
-rw-r--r--test/tools/launcher/Test7029048.java112
-rw-r--r--test/tools/launcher/TestHelper.java72
7 files changed, 156 insertions, 322 deletions
diff --git a/test/tools/launcher/6842838/Test6842838.sh b/test/tools/launcher/6842838/Test6842838.sh
index b552152a9f..011e2dd178 100644
--- a/test/tools/launcher/6842838/Test6842838.sh
+++ b/test/tools/launcher/6842838/Test6842838.sh
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2009, 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
@@ -48,16 +48,16 @@ case "$OS" in
NULL=/dev/null
PS=":"
FS="/"
- JAVA_EXE=${TESTJAVA}${FS}bin${FS}sparcv9${FS}java
+ JAVA_EXE=${TESTJAVA}${FS}bin${FS}java
;;
* )
- printf "Only testing on sparcv9 (use libumem to reliably catch buffer overrun)\n"
+ printf "Only testing on solaris 64-bit (use libumem to reliably catch buffer overrun)\n"
exit 0;
;;
esac
if [ ! -x ${JAVA_EXE} ]; then
- printf "Warning: sparcv9 components not installed - skipping test.\n"
+ printf "Warning: 64-bit components not installed - skipping test.\n"
exit 0
fi
diff --git a/test/tools/launcher/ChangeDataModel.java b/test/tools/launcher/ChangeDataModel.java
index 6b4b6bb19c..86909eb2ef 100644
--- a/test/tools/launcher/ChangeDataModel.java
+++ b/test/tools/launcher/ChangeDataModel.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 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
@@ -30,8 +30,6 @@
* @author Joseph D. Darcy, ksrini
*/
import java.io.File;
-import java.util.HashMap;
-import java.util.Map;
public class ChangeDataModel extends TestHelper {
private static final File TestJar = new File("test" + JAR_FILE_EXT);
@@ -54,48 +52,14 @@ public class ChangeDataModel extends TestHelper {
throw new Error("unsupported data model");
}
- // test dual mode systems
- if (isDualMode) {
- // albeit dual mode we may not have the 64 bit components present
- if (dualModePresent()) {
- // 32-bit -> 64-bit
- checkExecCount(javaCmd, "-d64");
- // 64-bit -> 32-bit
- checkExecCount(java64Cmd, "-d32");
-
- checkAcceptance(javaCmd, "-d64");
- checkAcceptance(java64Cmd, "-d32");
- } else {
- System.out.println("Warning: no 64-bit components found;" +
- " only one data model tested.");
- }
+ // Negative tests: ensure that non-dual mode systems reject the
+ // complementary (other) data model
+ if (is32Bit) {
+ checkRejection(javaCmd, "-d64");
+ } else if (is64Bit) {
+ checkRejection(javaCmd, "-d32");
} else {
- // Negative tests: ensure that non-dual mode systems reject the
- // complementary (other) data model
- if (is32Bit) {
- checkRejection(javaCmd, "-d64");
- } else if (is64Bit) {
- checkRejection(javaCmd, "-d32");
- } else {
- throw new Error("unsupported data model");
- }
- }
- }
-
- static void checkExecCount(String cmd, String dmodel) {
- Map<String, String> envMap = new HashMap<>();
- envMap.put(JLDEBUG_KEY, "true");
- TestResult tr = doExec(envMap, javaCmd, "-d64",
- "-jar", TestJar.getAbsolutePath());
- int count = 0;
- for (String x : tr.testOutput) {
- if (x.contains(EXPECTED_MARKER)) {
- count++;
- if (count > 1) {
- System.out.println(tr);
- throw new RuntimeException("Maximum exec count of 1 execeeded");
- }
- }
+ throw new Error("unsupported data model");
}
}
diff --git a/test/tools/launcher/ExecutionEnvironment.java b/test/tools/launcher/ExecutionEnvironment.java
index 3b8b7eb848..3587a1c0ab 100644
--- a/test/tools/launcher/ExecutionEnvironment.java
+++ b/test/tools/launcher/ExecutionEnvironment.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 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
@@ -26,7 +26,7 @@
* @bug 4780570 4731671 6354700 6367077 6670965 4882974
* @summary Checks for LD_LIBRARY_PATH and execution on *nixes
* @compile -XDignore.symbol.file ExecutionEnvironment.java
- * @run main ExecutionEnvironment
+ * @run main/othervm ExecutionEnvironment
*/
/*
@@ -46,6 +46,9 @@
* b. LD_LIBRARY_PATH32 is ignored if set
* 5. no extra symlink exists on Solaris ie.
* jre/lib/$arch/libjvm.so -> client/libjvm.so
+ * 6. Since 32-bit Solaris is no longer supported we continue to ensure that
+ * the appropriate paths are ignored or used, additionally we also test to
+ * ensure the 64-bit isadir exists and contains appropriate links.
* TODO:
* a. perhaps we need to add a test to audit all environment variables are
* in pristine condition after the launch, there may be a few that the
@@ -54,10 +57,16 @@
*/
import java.io.File;
import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.nio.file.DirectoryStream;
+import java.nio.file.Files;
+import java.nio.file.Path;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import static java.nio.file.LinkOption.*;
+import java.util.regex.Pattern;
public class ExecutionEnvironment extends TestHelper {
@@ -80,13 +89,14 @@ public class ExecutionEnvironment extends TestHelper {
static final File testJarFile = new File("EcoFriendly.jar");
- static int errors = 0;
- static int passes = 0;
-
static final String LIBJVM = TestHelper.isWindows
? "jvm.dll"
: "libjvm" + (TestHelper.isMacOSX ? ".dylib" : ".so");
+ public ExecutionEnvironment() {
+ createTestJar();
+ }
+
static void createTestJar() {
try {
List<String> codeList = new ArrayList<>();
@@ -111,13 +121,17 @@ public class ExecutionEnvironment extends TestHelper {
throw new RuntimeException(fnfe);
}
}
-
+ private void flagError(TestResult tr, String message) {
+ System.err.println(tr);
+ throw new RuntimeException(message);
+ }
/*
* tests if the launcher pollutes the LD_LIBRARY_PATH variables ie. there
* should not be any new variables or pollution/mutations of any kind, the
* environment should be pristine.
*/
- private static void ensureEcoFriendly() {
+ @Test
+ void testEcoFriendly() {
TestResult tr = null;
Map<String, String> env = new HashMap<>();
@@ -129,17 +143,12 @@ public class ExecutionEnvironment extends TestHelper {
tr = doExec(env, javaCmd, "-jar", testJarFile.getAbsolutePath());
if (!tr.isNotZeroOutput()) {
- System.out.println(tr);
- throw new RuntimeException("Error: No output at all. Did the test execute ?");
+ flagError(tr, "Error: No output at all. Did the test execute ?");
}
for (String x : LD_PATH_STRINGS) {
if (!tr.contains(x)) {
- System.out.println("FAIL: did not get <" + x + ">");
- System.out.println(tr);
- errors++;
- } else {
- passes++;
+ flagError(tr, "FAIL: did not get <" + x + ">");
}
}
}
@@ -148,19 +157,15 @@ public class ExecutionEnvironment extends TestHelper {
* ensures that there are no execs as long as we are in the same
* data model
*/
- static void ensureNoExec() {
+ @Test
+ void testNoExec() {
Map<String, String> env = new HashMap<>();
env.put(JLDEBUG_KEY, "true");
TestResult tr = doExec(env, javaCmd, "-version");
if (tr.testOutput.contains(EXPECTED_MARKER)) {
- System.out.println("FAIL: EnsureNoExecs: found expected warning <" +
- EXPECTED_MARKER +
+ flagError(tr, "testNoExec: found warning <" + EXPECTED_MARKER +
"> the process execing ?");
- errors++;
- } else {
- passes++;
}
- return;
}
/*
@@ -173,8 +178,8 @@ public class ExecutionEnvironment extends TestHelper {
* For Solaris 64-bit
* * The LD_LIBRARY_PATH_64 should override LD_LIBRARY_PATH if specified
*/
-
- static void verifyJavaLibraryPath() {
+ @Test
+ void testJavaLibraryPath() {
TestResult tr = null;
Map<String, String> env = new HashMap<>();
@@ -200,88 +205,33 @@ public class ExecutionEnvironment extends TestHelper {
env.put(pairs[0], pairs[1]);
}
- // verify the override occurs, since we know the invocation always
- // uses by default is 32-bit, therefore we also set the test
- // expectation to be the same.
+ // verify the override occurs for 64-bit system
tr = doExec(env, javaCmd, "-jar", testJarFile.getAbsolutePath());
- verifyJavaLibraryPathOverride(tr, true);
-
- // try changing the model from 32 to 64 bit
- if (dualModePresent() && is32Bit) {
- // verify the override occurs
- env.clear();
- for (String x : LD_PATH_STRINGS) {
- String pairs[] = x.split("=");
- env.put(pairs[0], pairs[1]);
- }
- tr = doExec(env, javaCmd, "-d64", "-jar",
- testJarFile.getAbsolutePath());
- verifyJavaLibraryPathOverride(tr, false);
-
- // no override
- env.clear();
- env.put(LD_LIBRARY_PATH, LD_LIBRARY_PATH_VALUE);
- tr = doExec(env, javaCmd, "-jar",
- testJarFile.getAbsolutePath());
- verifyJavaLibraryPathGeneric(tr);
- }
-
- // try changing the model from 64 to 32 bit
- if (java64Cmd != null && is64Bit) {
- // verify the override occurs
- env.clear();
- for (String x : LD_PATH_STRINGS) {
- String pairs[] = x.split("=");
- env.put(pairs[0], pairs[1]);
- }
- tr = doExec(env, java64Cmd, "-d32", "-jar",
- testJarFile.getAbsolutePath());
- verifyJavaLibraryPathOverride(tr, true);
-
- // no override
- env.clear();
- env.put(LD_LIBRARY_PATH, LD_LIBRARY_PATH_VALUE);
- tr = doExec(env, java64Cmd, "-d32", "-jar",
- testJarFile.getAbsolutePath());
- verifyJavaLibraryPathGeneric(tr);
- }
+ verifyJavaLibraryPathOverride(tr, false);
}
}
- private static void verifyJavaLibraryPathGeneric(TestResult tr) {
+ private void verifyJavaLibraryPathGeneric(TestResult tr) {
if (!tr.matches("java.library.path=.*" + LD_LIBRARY_PATH_VALUE + ".*")) {
- System.out.print("FAIL: verifyJavaLibraryPath: ");
- System.out.println(" java.library.path does not contain " +
+ flagError(tr, "testJavaLibraryPath: java.library.path does not contain " +
LD_LIBRARY_PATH_VALUE);
- System.out.println(tr);
- errors++;
- } else {
- passes++;
}
}
- private static void verifyJavaLibraryPathOverride(TestResult tr,
+ private void verifyJavaLibraryPathOverride(TestResult tr,
boolean is32Bit) {
// make sure the 32/64 bit value exists
if (!tr.matches("java.library.path=.*" +
(is32Bit ? LD_LIBRARY_PATH_32_VALUE : LD_LIBRARY_PATH_64_VALUE) + ".*")) {
- System.out.print("FAIL: verifyJavaLibraryPathOverride: ");
- System.out.println(" java.library.path does not contain " +
+ flagError(tr, "verifyJavaLibraryPathOverride: " +
+ " java.library.path does not contain " +
(is32Bit ? LD_LIBRARY_PATH_32_VALUE : LD_LIBRARY_PATH_64_VALUE));
- System.out.println(tr);
- errors++;
- } else {
- passes++;
+
}
// make sure the generic value is absent
- if (tr.matches("java.library.path=.*" + LD_LIBRARY_PATH_VALUE + ".*")) {
- System.out.print("FAIL: verifyJavaLibraryPathOverride: ");
- System.out.println(" java.library.path contains " +
- LD_LIBRARY_PATH_VALUE);
- System.out.println(tr);
- errors++;
- } else {
- passes++;
+ if (!tr.notMatches("java.library.path=.*" + LD_LIBRARY_PATH_VALUE + ".*")) {
+ flagError(tr, "verifyJavaLibraryPathOverride: " +
+ " java.library.path contains " + LD_LIBRARY_PATH_VALUE);
}
}
@@ -289,34 +239,28 @@ 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.
*/
- static void verifyVmSelection() {
+ @Test
+ void testVmSelection() {
TestResult tr = null;
if (is32Bit) {
tr = doExec(javaCmd, "-client", "-version");
if (!tr.matches(".*Client VM.*")) {
- System.out.println("FAIL: the expected vm -client did not launch");
- System.out.println(tr);
- errors++;
- } else {
- passes++;
+ flagError(tr, "the expected vm -client did not launch");
}
}
tr = doExec(javaCmd, "-server", "-version");
if (!tr.matches(".*Server VM.*")) {
- System.out.println("FAIL: the expected vm -server did not launch");
- System.out.println(tr);
- errors++;
- } else {
- passes++;
+ flagError(tr, "the expected vm -server did not launch");
}
}
/*
* checks to see there is no extra libjvm.so than needed
*/
- static void verifyNoSymLink() {
+ @Test
+ void testNoSymLink() {
if (is64Bit) {
return;
}
@@ -326,31 +270,65 @@ public class ExecutionEnvironment extends TestHelper {
symLink = new File(JAVAHOME, libPathPrefix +
getJreArch() + "/" + LIBJVM);
if (symLink.exists()) {
- System.out.println("FAIL: The symlink exists " +
- symLink.getAbsolutePath());
- errors++;
- } else {
- passes++;
+ throw new RuntimeException("symlink exists " + symLink.getAbsolutePath());
}
}
+ /*
+ * verify if all the symlinks in the images are created correctly,
+ * only on solaris, this test works only on images.
+ */
+ @Test
+ void testSymLinks() throws Exception {
+ if (!isSolaris)
+ return;
+ verifySymLinks(JAVA_BIN);
+ verifySymLinks(JAVA_JRE_BIN);
+ }
+ // exclude non-consequential binaries or scripts co-packaged in other
+ // build phases
+ private final String excludeRE =
+ ".*jvisualvm.*" +
+ "|.*javaws.*" +
+ "|.*ControlPanel.*" +
+ "|.*java-rmi.cgi" +
+ "|.*jcontrol.*";
+ private final Pattern symlinkExcludes = Pattern.compile(excludeRE);
+
+ private void verifySymLinks(String bindir) throws IOException {
+ File binDir = new File(bindir);
+ System.err.println("verifying links in: " + bindir);
+ File isaDir = new File(binDir, getArch()).getAbsoluteFile();
+ if (!isaDir.exists()) {
+ throw new RuntimeException("dir: " + isaDir + " does not exist");
+ }
+ try (DirectoryStream<Path> ds = Files.newDirectoryStream(binDir.toPath())) {
+ for (Path p : ds) {
+ if (symlinkExcludes.matcher(p.toString()).matches() ||
+ Files.isDirectory(p, NOFOLLOW_LINKS)) {
+ continue;
+ }
+ Path link = new File(isaDir, p.getFileName().toString()).toPath();
+ if (Files.isSymbolicLink(link)) {
+ Path target = Files.readSymbolicLink(link);
+ if (target.startsWith("..") && p.endsWith(target.getFileName())) {
+ // System.out.println(target + " OK");
+ continue;
+ }
+ System.err.println("target:" + target);
+ System.err.println("file:" + p);
+ }
+ throw new RuntimeException("could not find link to " + p);
+ }
+ }
+
+ }
public static void main(String... args) throws Exception {
if (isWindows) {
- System.out.println("Warning: noop on windows");
+ System.err.println("Warning: test not applicable to windows");
return;
}
- // create our test jar first
- createTestJar();
- ensureNoExec();
- verifyVmSelection();
- ensureEcoFriendly();
- verifyJavaLibraryPath();
- verifyNoSymLink();
- if (errors > 0) {
- throw new Exception("ExecutionEnvironment: FAIL: with " +
- errors + " errors and passes " + passes );
- } else {
- System.out.println("ExecutionEnvironment: PASS " + passes);
- }
+ ExecutionEnvironment ee = new ExecutionEnvironment();
+ ee.run(args);
}
}
diff --git a/test/tools/launcher/FXLauncherTest.java b/test/tools/launcher/FXLauncherTest.java
index 1ed251bad1..32cd7c522a 100644
--- a/test/tools/launcher/FXLauncherTest.java
+++ b/test/tools/launcher/FXLauncherTest.java
@@ -405,7 +405,7 @@ public class FXLauncherTest extends TestHelper {
}
} else {
System.err.println("Warning: JavaFX components missing or not supported");
- System.err.println(" test passes vacuosly.");
+ System.err.println(" test passes vacuously.");
}
}
}
diff --git a/test/tools/launcher/RunpathTest.java b/test/tools/launcher/RunpathTest.java
index 631be16d97..7738c4bdd9 100644
--- a/test/tools/launcher/RunpathTest.java
+++ b/test/tools/launcher/RunpathTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 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
@@ -64,15 +64,9 @@ public class RunpathTest extends TestHelper {
}
void testRpath() {
- if (isDualMode && is64Bit) {
- String expectedRpath = ".*RPATH.*\\$ORIGIN/../../lib/" + getJreArch()
- + ":\\$ORIGIN/../../jre/lib/" + getJreArch() + ".*";
- elfCheck(java64Cmd, expectedRpath);
- } else {
- String expectedRpath = ".*RPATH.*\\$ORIGIN/../lib/" + getJreArch()
- + ":\\$ORIGIN/../jre/lib/" + getJreArch() + ".*";
- elfCheck(javaCmd, expectedRpath);
- }
+ String expectedRpath = ".*RPATH.*\\$ORIGIN/../lib/" + getJreArch()
+ + ":\\$ORIGIN/../jre/lib/" + getJreArch() + ".*";
+ elfCheck(javaCmd, expectedRpath);
}
public static void main(String... args) throws Exception {
diff --git a/test/tools/launcher/Test7029048.java b/test/tools/launcher/Test7029048.java
index aafee36843..9437c3e181 100644
--- a/test/tools/launcher/Test7029048.java
+++ b/test/tools/launcher/Test7029048.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 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
@@ -30,8 +30,8 @@
*/
/*
- * 7029048: test for LD_LIBRARY_PATH set to different paths pointing which may
- * contain a libjvm.so and may not, but we test to ensure that the launcher
+ * 7029048: test for LD_LIBRARY_PATH set to different paths which may or
+ * may not contain a libjvm.so, but we test to ensure that the launcher
* behaves correctly in all cases.
*/
import java.io.File;
@@ -50,8 +50,6 @@ public class Test7029048 extends TestHelper {
private static final String LIBJVM = ExecutionEnvironment.LIBJVM;
private static final String LD_LIBRARY_PATH =
ExecutionEnvironment.LD_LIBRARY_PATH;
- private static final String LD_LIBRARY_PATH_32 =
- ExecutionEnvironment.LD_LIBRARY_PATH_32;
private static final String LD_LIBRARY_PATH_64 =
ExecutionEnvironment.LD_LIBRARY_PATH_64;
@@ -70,24 +68,8 @@ public class Test7029048 extends TestHelper {
private static final File dstClientDir = new File(dstLibArchDir, "client");
private static final File dstClientLibjvm = new File(dstClientDir, LIBJVM);
- // used primarily to test the solaris variants in dual mode
- private static final File dstOtherArchDir;
- private static final File dstOtherServerDir;
- private static final File dstOtherServerLibjvm;
-
private static final Map<String, String> env = new HashMap<>();
- static {
- if (isDualMode) {
- dstOtherArchDir = new File(dstLibDir, getComplementaryJreArch());
- dstOtherServerDir = new File(dstOtherArchDir, "server");
- dstOtherServerLibjvm = new File(dstOtherServerDir, LIBJVM);
- } else {
- dstOtherArchDir = null;
- dstOtherServerDir = null;
- dstOtherServerLibjvm = null;
- }
- }
static String getValue(String name, List<String> in) {
for (String x : in) {
@@ -99,45 +81,20 @@ public class Test7029048 extends TestHelper {
return null;
}
- static void run(boolean want32, String dflag, Map<String, String> env,
+ static void run(Map<String, String> env,
int nLLPComponents, String caseID) {
- final boolean want64 = want32 == false;
env.put(ExecutionEnvironment.JLDEBUG_KEY, "true");
List<String> cmdsList = new ArrayList<>();
-
- // only for a dual-mode system
- if (want64 && isDualMode) {
- cmdsList.add(java64Cmd);
- } else {
- cmdsList.add(javaCmd); // a 32-bit java command for all
- }
-
- /*
- * empty or null strings can confuse the ProcessBuilder. A null flag
- * indicates that the appropriate data model is enforced on the chosen
- * launcher variant.
- */
-
- if (dflag != null) {
- cmdsList.add(dflag);
- } else {
- cmdsList.add(want32 ? "-d32" : "-d64");
- }
+ cmdsList.add(javaCmd);
cmdsList.add("-server");
cmdsList.add("-jar");
cmdsList.add(ExecutionEnvironment.testJarFile.getAbsolutePath());
String[] cmds = new String[cmdsList.size()];
TestResult tr = doExec(env, cmdsList.toArray(cmds));
+ System.out.println(tr);
analyze(tr, nLLPComponents, caseID);
}
- // no cross launch, ie. no change to the data model.
- static void run(Map<String, String> env, int nLLPComponents, String caseID)
- throws IOException {
- boolean want32 = is32Bit;
- run(want32, null, env, nLLPComponents, caseID);
- }
-
static void analyze(TestResult tr, int nLLPComponents, String caseID) {
String envValue = getValue(LD_LIBRARY_PATH, tr.testOutput);
/*
@@ -192,10 +149,6 @@ public class Test7029048 extends TestHelper {
copyFile(srcLibjvmSo, dstServerLibjvm);
// does not matter if it is client or a server
copyFile(srcLibjvmSo, dstClientLibjvm);
- // does not matter if the arch do not match either
- if (isDualMode) {
- copyFile(srcLibjvmSo, dstOtherServerLibjvm);
- }
desc = "LD_LIBRARY_PATH should be set";
break;
case LLP_SET_EMPTY_PATH:
@@ -211,14 +164,6 @@ public class Test7029048 extends TestHelper {
Files.deleteIfExists(dstServerLibjvm.toPath());
}
- if (isDualMode) {
- if (!dstOtherServerDir.exists()) {
- Files.createDirectories(dstOtherServerDir.toPath());
- } else {
- Files.deleteIfExists(dstOtherServerLibjvm.toPath());
- }
- }
-
desc = "LD_LIBRARY_PATH should not be set";
break;
case LLP_SET_NON_EXISTENT_PATH:
@@ -245,40 +190,14 @@ public class Test7029048 extends TestHelper {
env.put(LD_LIBRARY_PATH, dstClientDir.getAbsolutePath());
run(env, v.value + 1, "Case 2: " + desc);
- if (!isDualMode) {
- continue; // nothing more to do for Linux
- }
-
- // Tests applicable only to solaris.
-
- // initialize test variables for dual mode operations
- final File dst32ServerDir = is32Bit
- ? dstServerDir
- : dstOtherServerDir;
-
- final File dst64ServerDir = is64Bit
- ? dstServerDir
- : dstOtherServerDir;
-
- /*
- * Case 3: set the appropriate LLP_XX flag,
- * java32 -d32, LLP_32 is relevant, LLP_64 is ignored
- * java64 -d64, LLP_64 is relevant, LLP_32 is ignored
- */
- env.clear();
- env.put(LD_LIBRARY_PATH_32, dst32ServerDir.getAbsolutePath());
- env.put(LD_LIBRARY_PATH_64, dst64ServerDir.getAbsolutePath());
- run(is32Bit, null, env, v.value + 1, "Case 3: " + desc);
-
- /*
- * Case 4: we are in dual mode environment, running 64-bit then
- * we have the following scenarios:
- * java32 -d64, LLP_64 is relevant, LLP_32 is ignored
- * java64 -d32, LLP_32 is relevant, LLP_64 is ignored
- */
- if (dualModePresent()) {
- run(true, "-d64", env, v.value + 1, "Case 4A: " + desc);
- run(false,"-d32", env, v.value + 1, "Case 4B: " + desc);
+ if (isSolaris) {
+ /*
+ * Case 3: set the appropriate LLP_XX flag,
+ * java64 -d64, LLP_64 is relevant, LLP_32 is ignored
+ */
+ env.clear();
+ env.put(LD_LIBRARY_PATH_64, dstServerDir.getAbsolutePath());
+ run(env, v.value + 1, "Case 3: " + desc);
}
}
return;
@@ -297,9 +216,6 @@ public class Test7029048 extends TestHelper {
if (errors > 0) {
throw new Exception("Test7029048: FAIL: with "
+ errors + " errors and passes " + passes);
- } else if (dualModePresent() && passes < 15) {
- throw new Exception("Test7029048: FAIL: " +
- "all tests did not run, expected " + 15 + " got " + passes);
} else if (isSolaris && passes < 9) {
throw new Exception("Test7029048: FAIL: " +
"all tests did not run, expected " + 9 + " got " + passes);
diff --git a/test/tools/launcher/TestHelper.java b/test/tools/launcher/TestHelper.java
index 0115f05714..6f827f3ce0 100644
--- a/test/tools/launcher/TestHelper.java
+++ b/test/tools/launcher/TestHelper.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 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
@@ -66,10 +66,10 @@ public class TestHelper {
static final String JAVAHOME = System.getProperty("java.home");
static final String JAVA_BIN;
+ static final String JAVA_JRE_BIN;
static final boolean isSDK = JAVAHOME.endsWith("jre");
static final String javaCmd;
static final String javawCmd;
- static final String java64Cmd;
static final String javacCmd;
static final String jarCmd;
@@ -88,7 +88,7 @@ public class TestHelper {
System.getProperty("os.name", "unknown").startsWith("SunOS");
static final boolean isLinux =
System.getProperty("os.name", "unknown").startsWith("Linux");
- static final boolean isDualMode = isSolaris;
+
static final boolean isSparc = System.getProperty("os.arch").startsWith("sparc");
// make a note of the golden default locale
@@ -124,9 +124,12 @@ 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");
+ 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();
File javaCmdFile = (isWindows)
? new File(binDir, "java.exe")
: new File(binDir, "java");
@@ -165,17 +168,6 @@ public class TestHelper {
throw new RuntimeException("java <" + javacCmd +
"> must exist and should be executable");
}
- if (isSolaris) {
- File sparc64BinDir = new File(binDir,isSparc ? "sparcv9" : "amd64");
- File java64CmdFile= new File(sparc64BinDir, "java");
- if (java64CmdFile.exists() && java64CmdFile.canExecute()) {
- java64Cmd = java64CmdFile.getAbsolutePath();
- } else {
- java64Cmd = null;
- }
- } else {
- java64Cmd = null;
- }
}
void run(String[] args) throws Exception {
int passed = 0, failed = 0;
@@ -194,7 +186,13 @@ public class TestHelper {
System.out.printf("Passed: %d, Failed: %d, ExitValue: %d%n",
passed, failed, testExitValue);
} catch (Throwable ex) {
- System.out.printf("Test %s failed: %s %n", m, ex.getCause());
+ System.out.printf("Test %s failed: %s %n", m, ex);
+ System.out.println("----begin detailed exceptions----");
+ ex.printStackTrace(System.out);
+ for (Throwable t : ex.getSuppressed()) {
+ t.printStackTrace(System.out);
+ }
+ System.out.println("----end detailed exceptions----");
failed++;
}
}
@@ -210,41 +208,15 @@ public class TestHelper {
}
/*
- * is a dual mode available in the test jdk
- */
- static boolean dualModePresent() {
- return isDualMode && java64Cmd != null;
- }
-
- /*
* usually the jre/lib/arch-name is the same as os.arch, except for x86.
*/
static String getJreArch() {
String arch = System.getProperty("os.arch");
return arch.equals("x86") ? "i386" : arch;
}
-
- /*
- * get the complementary jre arch ie. if sparc then return sparcv9 and
- * vice-versa.
- */
- static String getComplementaryJreArch() {
- String arch = System.getProperty("os.arch");
- if (arch != null) {
- switch (arch) {
- case "sparc":
- return "sparcv9";
- case "sparcv9":
- return "sparc";
- case "x86":
- return "amd64";
- case "amd64":
- return "i386";
- }
- }
- return null;
+ static String getArch() {
+ return System.getProperty("os.arch");
}
-
static File getClassFile(File javaFile) {
String s = javaFile.getAbsolutePath().replace(JAVA_FILE_EXT, CLASS_FILE_EXT);
return new File(s);
@@ -623,6 +595,16 @@ public class TestHelper {
appendError("string <" + stringToMatch + "> not found");
return false;
}
+
+ boolean notMatches(String stringToMatch) {
+ for (String x : testOutput) {
+ if (!x.matches(stringToMatch)) {
+ return true;
+ }
+ }
+ appendError("string <" + stringToMatch + "> found");
+ return false;
+ }
}
/**
* Indicates that the annotated method is a test method.