提交 7ab055df 编写于 作者: K ksrini

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
上级 6d0eb0c3
#
# 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
......@@ -190,6 +190,26 @@ $(foreach f,$(filter $(OVERLAY_FILTER),$(JDK_BIN_LIST)),\
$(foreach f,$(filter $(OVERLAY_FILTER),$(JDKJRE_BIN_LIST)),\
$(eval $(call AddFileToCopy,$(JDK_OUTPUTDIR),$(JDK_OVERLAY_IMAGE_DIR)/jre,$f,JDKJRE_BIN_TARGETS)))
ifeq ($(OPENJDK_TARGET_OS)-$(OPENJDK_TARGET_CPU_BITS),solaris-64)
define AddIsadirLink
# Param 1 - src file
# Param 2 - variable to add targets to
$1_LINK := $$(dir $1)$(OPENJDK_TARGET_CPU_ISADIR)/$$(notdir $1)
$$($1_LINK):
$(ECHO) $(LOG_INFO) Creating link $$(patsubst $(OUTPUT_ROOT)/%,%,$$@)
$(MKDIR) -p $$(@D)
$(LN) -s ../$$(@F) $$@
$2 += $$($1_LINK)
endef
$(foreach f,$(JRE_BIN_TARGETS),$(eval $(call AddIsadirLink,$f,JRE_BIN_ISADIR_LINK_TARGETS)))
$(foreach f,$(JDK_BIN_TARGETS),$(eval $(call AddIsadirLink,$f,JDK_BIN_ISADIR_LINK_TARGETS)))
$(foreach f,$(JDKJRE_BIN_TARGETS),$(eval $(call AddIsadirLink,$f,JDKJRE_BIN_ISADIR_LINK_TARGETS)))
endif
################################################################################
# /lib dir
ifneq ($(OPENJDK_TARGET_OS), macosx)
......@@ -730,7 +750,8 @@ endif
jre-image: $(JRE_BIN_TARGETS) $(JRE_LIB_TARGETS) $(JRE_IMAGE_DIR)/lib/applet \
$(JRE_IMAGE_DIR)/lib/meta-index $(JRE_IMAGE_DIR)/lib/ext/meta-index \
$(JRE_MAN_PAGE_LIST) $(JRE_DOC_TARGETS) $(JRE_INFO_FILE) $(JRE_STRIP_LIST)
$(JRE_MAN_PAGE_LIST) $(JRE_DOC_TARGETS) $(JRE_INFO_FILE) $(JRE_STRIP_LIST) \
$(JRE_BIN_ISADIR_LINK_TARGETS)
jdk-image: $(JDK_BIN_TARGETS) $(JDKJRE_BIN_TARGETS) \
$(JDK_LIB_TARGETS) $(JDKJRE_LIB_TARGETS) \
......@@ -741,7 +762,8 @@ jdk-image: $(JDK_BIN_TARGETS) $(JDKJRE_BIN_TARGETS) \
$(JDK_DB_TARGETS) $(JDK_INCLUDE_TARGETS) \
$(JDKJRE_DOC_TARGETS) $(JDK_DOC_TARGETS) \
$(JDK_INFO_FILE) $(JDKJRE_STRIP_LIST) $(JDK_BIN_STRIP_LIST) \
$(JDK_IMAGE_DIR)/src.zip
$(JDK_IMAGE_DIR)/src.zip \
$(JDK_BIN_ISADIR_LINK_TARGETS) $(JDKJRE_BIN_ISADIR_LINK_TARGETS)
jre-overlay-image: $(JRE_OVERLAY_BIN_TARGETS) $(JRE_OVERLAY_LIB_TARGETS) \
$(JRE_OVERLAY_INFO_FILE) $(JRE_OVERLAY_STRIP_LIST)
......
/*
* Copyright (c) 1998, 2011, 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
......@@ -196,19 +196,7 @@ public class SunCommandLineLauncher extends AbstractLauncher implements Launchin
try {
if (home.length() > 0) {
/*
* A wrinkle in the environment:
* 64-bit executables are stored under $JAVA_HOME/bin/os_arch
* 32-bit executables are stored under $JAVA_HOME/bin
*/
String os_arch = System.getProperty("os.arch");
if ("SunOS".equals(System.getProperty("os.name")) &&
("sparcv9".equals(os_arch) || "amd64".equals(os_arch))) {
exePath = home + File.separator + "bin" + File.separator +
os_arch + File.separator + exe;
} else {
exePath = home + File.separator + "bin" + File.separator + exe;
}
exePath = home + File.separator + "bin" + File.separator + exe;
} else {
exePath = exe;
}
......
/*
* 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
......@@ -59,7 +59,6 @@
*/
#ifdef __solaris__
# define DUAL_MODE
# ifndef LIBARCH32NAME
# error "The macro LIBARCH32NAME was not defined on the compile line"
# endif
......
/*
* Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 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
......@@ -108,16 +108,7 @@ public class BadHandshakeTest {
*/
private static Process launch(String address, String class_name) throws IOException {
String exe = System.getProperty("java.home")
+ File.separator + "bin" + File.separator;
String arch = System.getProperty("os.arch");
String osname = System.getProperty("os.name");
if (osname.equals("SunOS") && arch.equals("sparcv9")) {
exe += "sparcv9/java";
} else if (osname.equals("SunOS") && arch.equals("amd64")) {
exe += "amd64/java";
} else {
exe += "java";
}
+ File.separator + "bin" + File.separator + "java";
String cmd = exe + " " + VMConnection.getDebuggeeVMOptions() +
" -agentlib:jdwp=transport=dt_socket" +
",server=y" + ",suspend=y" + ",address=" + address +
......
/*
* Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 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
......@@ -90,16 +90,7 @@ public class DoubleAgentTest {
*/
private static Process launch(String address, String class_name) throws IOException {
String exe = System.getProperty("java.home")
+ File.separator + "bin" + File.separator;
String arch = System.getProperty("os.arch");
String osname = System.getProperty("os.name");
if (osname.equals("SunOS") && arch.equals("sparcv9")) {
exe += "sparcv9/java";
} else if (osname.equals("SunOS") && arch.equals("amd64")) {
exe += "amd64/java";
} else {
exe += "java";
}
+ File.separator + "bin" + File.separator + "java";
String jdwpOption = "-agentlib:jdwp=transport=dt_socket"
+ ",server=y" + ",suspend=y" + ",address=" + address;
String cmd = exe + " " + VMConnection.getDebuggeeVMOptions()
......
/*
* Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 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
......@@ -97,16 +97,7 @@ public class ExclusiveBind {
*/
private static Process launch(String address, boolean suspend, String class_name) throws IOException {
String exe = System.getProperty("java.home") + File.separator + "bin" +
File.separator;
String arch = System.getProperty("os.arch");
String osname = System.getProperty("os.name");
if (osname.equals("SunOS") && arch.equals("sparcv9")) {
exe += "sparcv9/java";
} else if (osname.equals("SunOS") && arch.equals("amd64")) {
exe += "amd64/java";
} else {
exe += "java";
}
File.separator + "java";
String cmd = exe + " " + VMConnection.getDebuggeeVMOptions() +
" -agentlib:jdwp=transport=dt_socket,server=y,suspend=";
if (suspend) {
......
#!/bin/ksh -p
#
# Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2005, 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
......@@ -102,28 +102,7 @@ libdir=${TESTCLASSES}
is_windows=false
is_cygwin=false
case `uname -s` in
SunOS)
libarch=`uname -p`
d64=`echo "${DEBUGGEEFLAGS}" | fgrep -- -d64`
case `uname -p` in
sparc)
if [ "${d64}" != "" ] ; then
libarch=sparcv9
fi
;;
i386)
if [ "${d64}" != "" ] ; then
libarch=amd64
fi
;;
*)
echo "FAILURE: Unknown uname -p: " `uname -p`
exit 1
;;
esac
libloc=${jreloc}/lib/${libarch}
;;
Linux)
SunOS|Linux)
xx=`find ${jreloc}/lib -name libdt_socket.so`
libloc=`dirname ${xx}`
;;
......
/*
* Copyright (c) 2004, 2006, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2004, 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
......@@ -113,16 +113,7 @@ public class RunToExit {
*/
private static Process launch(String address, String class_name) throws IOException {
String exe = System.getProperty("java.home")
+ File.separator + "bin" + File.separator;
String arch = System.getProperty("os.arch");
String osname = System.getProperty("os.name");
if (osname.equals("SunOS") && arch.equals("sparcv9")) {
exe += "sparcv9/java";
} else if (osname.equals("SunOS") && arch.equals("amd64")) {
exe += "amd64/java";
} else {
exe += "java";
}
+ File.separator + "bin" + File.separator + "java";
String cmd = exe + " " + VMConnection.getDebuggeeVMOptions() +
" -agentlib:jdwp=transport=dt_socket" +
",server=y" + ",suspend=y" + ",address=" + address +
......
#!/bin/ksh -p
#
# Copyright (c) 2001, 2012, 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
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# 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.
#
#
# @test Solaris32AndSolaris64Test.sh
# @bug 4478312 4780570 4913748 6730273
# @summary Test debugging with mixed 32/64bit VMs.
# @author Tim Bell
# Based on test/java/awt/TEMPLATE/AutomaticShellTest.sh
#
# @run build TestScaffold VMConnection TargetListener TargetAdapter
# @run compile -g FetchLocals.java
# @run compile -g DataModelTest.java
# @run shell/timeout=240 Solaris32AndSolaris64Test.sh DataModelTest
# @run shell/timeout=240 Solaris32AndSolaris64Test.sh FetchLocals
# Beginning of subroutines:
status=1
#Call this from anywhere to fail the test with an error message
# usage: fail "reason why the test failed"
fail()
{ echo "The test failed :-("
echo "$*" 1>&2
echo "exit status was $status"
exit $status
} #end of fail()
#Call this from anywhere to pass the test with a message
# usage: pass "reason why the test passed if applicable"
pass()
{ echo "The test passed!!!"
echo "$*" 1>&2
exit 0
} #end of pass()
# end of subroutines
if [ $# = 0 ] ; then
echo "Error: no testname specified on cmd line"
exit 1
fi
testName=$1
shift
#Set appropriate jdk
if [ -z "${TESTJAVA}" ] ; then
# TESTJAVA is not set, so the test is running stand-alone.
# TESTJAVA holds the path to the root directory of the build of the JDK
# to be tested. That is, any java files run explicitly in this shell
# should use TESTJAVA in the path to the java interpreter.
# So, we'll set this to the JDK spec'd on the command line. If none
# is given on the command line, tell the user that and use a default.
# THIS IS THE JDK BEING TESTED.
if [ -n "$1" ] ; then
TESTJAVA=$1
else
echo "no JDK specified on command line so using JAVA_HOME=$JAVA_HOME"
TESTJAVA=$JAVA_HOME
fi
TESTSRC=.
TESTCLASSES=.
STANDALONE=1;
fi
echo "JDK under test is: $TESTJAVA"
# The beginning of the script proper
# Checking for proper OS and processor type.
#
# This test is only interested in SunOS SPARC sparcv9 and SunOS AMD64
# (supporting both 32 and 64 bit Solaris binaries).
#
# All other platforms will instantly complete with passing
# status.
#
OS=`uname -s`
case "$OS" in
SunOS )
PATHSEP=":"
PTYPE=`uname -p`
if [ -x /usr/bin/isainfo ]; then
# Instruction set being used by the OS
ISET=`isainfo -k`
else
#SunOS 5.6 didn't have "isainfo"
pass "This test always passes on $OS/$PTYPE (32-bit ${ISET})"
fi
;;
Linux | Darwin )
pass "This test always passes on $OS"
;;
Windows* | CYGWIN*)
pass "This test always passes on $OS"
;;
# catch all other OSs
* )
echo "Unrecognized system! $OS"
fail "Unrecognized system! $OS"
;;
esac
# Is the OS running in sparcv9 or amd64 mode?
case "${ISET}" in
sparc )
pass "This test always passes on $OS/$PTYPE (32-bit ${ISET})"
;;
i386 )
pass "This test always passes on $OS/$PTYPE (32-bit ${ISET})"
;;
amd64 )
echo "OS is running in ${ISET} mode"
;;
sparcv9 )
echo "OS is running in ${ISET} mode"
;;
# catch all others
* )
echo "Unrecognized instruction set! $OS/$PTYPE/${ISET}"
fail "Unrecognized instruction set! $OS/$PTYPE/${ISET}"
;;
esac
# SunOS 32 and 64 bit binaries must be available
# to test in the remainder of the script below.
$TESTJAVA/bin/java -d64 -version > /dev/null 2<&1
if [ $? = 1 ]; then
# The 64 bit version is not installed. Make the test pass.
pass "This test always passes on $OS/$PTYPE if 64 bit jdk is not installed"
fi
# Want this test to run standalone as well as in the harness, so do the
# following to copy the test's directory into the harness's scratch directory
# and set all appropriate variables:
#Deal with .class files:
if [ -n "${STANDALONE}" ] ; then
#if running standalone, compile the support files
${TESTJAVA}/bin/javac -d ${TESTCLASSES} \
-classpath "$TESTJAVA/lib/tools.jar${PATHSEP}${TESTSRC}" \
TestScaffold.java VMConnection.java TargetListener.java TargetAdapter.java
${TESTJAVA}/bin/javac -d ${TESTCLASSES} \
-classpath "$TESTJAVA/lib/tools.jar${PATHSEP}${TESTSRC}" -g \
FetchLocals.java DataModelTest.java
fi
# Get DEBUGGEE flags
DEBUGGEEFLAGS=
filename=$TESTCLASSES/@debuggeeVMOptions
if [ ! -r ${filename} ] ; then
filename=$TESTCLASSES/../@debuggeeVMOptions
fi
# Remove -d32, -d64 if present, and remove -XX:[+-]UseCompressedOops
# if present since it is illegal in 32 bit mode.
if [ -r ${filename} ] ; then
DEBUGGEEFLAGS=`cat ${filename} | sed \
-e 's/-d32//g' \
-e 's/-d64//g' \
-e 's/-XX:.UseCompressedOops//g' \
`
fi
#
CLASSPATH="$TESTJAVA/lib/tools.jar${PATHSEP}${TESTCLASSES}"
export CLASSPATH
CP="-classpath \"${CLASSPATH}\""
for DEBUGGERMODEL in \
32 \
64 \
; do
for TARGETMODEL in \
32 \
64 \
; do
DEBUGGERFLAGS="-d${DEBUGGERMODEL} -showversion -DEXPECTED=${TARGETMODEL}"
CONNECTSTRING="-connect 'com.sun.jdi.CommandLineLaunch:options=-d${TARGETMODEL} $DEBUGGEEFLAGS -showversion'"
for TARGETCLASS in $testName ; do
echo "--------------------------------------------"
echo "debugger=${DEBUGGERMODEL} debugee=${TARGETMODEL} class=${TARGETCLASS}"
echo "--------------------------------------------"
echo ${TESTJAVA}/bin/java -DHANGINGJAVA_DEB ${DEBUGGERFLAGS} ${CP} ${TARGETCLASS} ${CONNECTSTRING}
eval ${TESTJAVA}/bin/java -DHANGINGJAVA_DEB ${DEBUGGERFLAGS} ${CP} ${TARGETCLASS} ${CONNECTSTRING}
status=$?
if [ $status -ne "0" ];
then fail "$DEBUGGERMODEL to $TARGETMODEL test failed for class=$TARGETCLASS!"
fi
done
done
done
#
# pass or fail the test based on status of the command
if [ $status -eq "0" ];
then pass ""
else fail "unspecified test failure"
fi
/*
* Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 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
......@@ -143,16 +143,7 @@ public class SimpleLaunchingConnector implements LaunchingConnector {
TransportService.ListenKey key = ts.startListening();
String exe = System.getProperty("java.home") + File.separator + "bin" +
File.separator;
String arch = System.getProperty("os.arch");
String osname = System.getProperty("os.name");
if (osname.equals("SunOS") && arch.equals("sparcv9")) {
exe += "sparcv9/java";
} else if (osname.equals("SunOS") && arch.equals("amd64")) {
exe += "amd64/java";
} else {
exe += "java";
}
File.separator + "java";
String cmd = exe + " -Xdebug -Xrunjdwp:transport=dt_socket,timeout=15000,address=" +
key.address() +
" -classpath " + System.getProperty("test.classes") +
......
/*
* Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2004, 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
......@@ -125,28 +125,22 @@ public class DemoRun {
String libprefix = os_name.contains("Windows")?"":"lib";
String libsuffix = os_name.contains("Windows")?".dll":
os_name.contains("OS X")?".dylib":".so";
boolean d64 = ( os_name.contains("Solaris") ||
os_name.contains("SunOS") )
&& ( os_arch.equals("sparcv9") ||
os_arch.equals("amd64"));
boolean hprof = demo_name.equals("hprof");
String isa_dir = d64?(File.separator+os_arch):"";
String java = jre_home
+ File.separator + "bin" + isa_dir
+ File.separator + "bin"
+ File.separator + "java";
/* Array of strings to be passed in for exec:
* 1. java
* 2. -Dtest.classes=.
* 3. -d64 (optional)
* 4. -Xcheck:jni (Just because it finds bugs)
* 5. -Xverify:all (Make sure verification is on full blast)
* 6. -agent
* 3. -Xcheck:jni (Just because it finds bugs)
* 4. -Xverify:all (Make sure verification is on full blast)
* 5. -agent
* vm_options
* 7+i. classname
* 6+i. classname
*/
int nvm_options = 0;
if ( vm_options != null ) nvm_options = vm_options.length;
String cmd[] = new String[1 + (d64?1:0) + 7 + nvm_options];
String cmd[] = new String[1 + 7 + nvm_options];
String cmdLine;
int exitStatus;
int i,j;
......@@ -160,10 +154,6 @@ public class DemoRun {
cmdLine += (cmd[i++] = cdir);
cmdLine += " ";
cmdLine += (cmd[i++] = "-Dtest.classes=" + cdir);
if ( d64 ) {
cmdLine += " ";
cmdLine += (cmd[i++] = "-d64");
}
cmdLine += " ";
cmdLine += (cmd[i++] = "-Xcheck:jni");
cmdLine += " ";
......@@ -178,7 +168,7 @@ public class DemoRun {
+ File.separator + "demo"
+ File.separator + "jvmti"
+ File.separator + demo_name
+ File.separator + "lib" + isa_dir
+ File.separator + "lib"
+ File.separator + libprefix + demo_name + libsuffix;
cmdLine += " ";
cmdLine += (cmd[i++] = "-agentpath:" + libname
......
......@@ -21,33 +21,14 @@ uname := $(shell uname)
ifeq ($(uname), SunOS)
PLATFORM = solaris
ISAINFO = isainfo
ifndef ARCH_DATA_MODEL
ARCH_DATA_MODEL=32
endif
ifeq ($(ARCH_DATA_MODEL), 32)
archExpr = case "`$(UNAME) -p`" in \
i386) \
$(ECHO) i586 \
;; \
sparc*) \
$(ECHO) sparc \
;; \
*) \
$(UNAME) -p \
;; \
esac
ARCH := $(shell $(archExpr) )
else
ARCH := $(shell $(ISAINFO) -n)
endif
ARCH_DATA_MODEL=64
ARCH := $(shell $(ISAINFO) -n)
CC = cc
LD = ld
CFLAGS = -D_REENTRANT -D__solaris__
LDFLAGS_COMMON = -G
EXTRA_LIBS = -lc
ifeq ($(ARCH_DATA_MODEL), 64)
CC += -xarch=v9
endif
CC += -m64 -Kpic
endif
ifeq ($(uname), Linux)
......
#!/bin/sh
#
# Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2003, 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
......@@ -23,7 +23,6 @@
# questions.
#
# @test
# @bug 4673940
# @bug 4930794
......@@ -39,7 +38,6 @@ if [ "$os" != "Linux" -a "$os" != "SunOS" ]; then
exit 0
fi
# if TESTJAVA isn't set then we assume an interactive run. So that it's
# clear which version of 'java' is running we do a 'which java' and
# a 'java -version'.
......@@ -64,24 +62,17 @@ export CLASSPATH
# Check that we have libLauncher.so for the right platform.
# On Solaris we assume 64-bit if java -d64 works.
# On Solaris we assume 64-bit
DFLAG=
if [ "$os" = "SunOS" ]; then
PLATFORM=solaris
case "`uname -p`" in
i[3-9]86)
ARCH=i586
ARCH=amd64
;;
sparc)
ARCH=sparc
${JAVA} -d64 -version > /dev/null 2<&1
if [ $? = 1 ]; then
ARCH=sparc
else
ARCH=sparcv9
DFLAG=-d64
fi
ARCH=sparcv9
;;
esac
fi
......
#
# Copyright (c) 2006, 2012, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2006, 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
......@@ -58,7 +58,7 @@ OS=`uname -s`
case "$OS" in
SunOS )
FS="/"
LIBNAME="/usr/lib/mps/libsoftokn3.so"
LIBNAME="/usr/lib/mps/`isainfo -n`/libsoftokn3.so"
;;
Linux )
FS="/"
......
/*
* Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 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
......@@ -167,28 +167,23 @@ public class HatRun {
String cdir = System.getProperty("test.classes", ".");
String os_arch = System.getProperty("os.arch");
String os_name = System.getProperty("os.name");
boolean d64 = os_name.equals("SunOS") && (
os_arch.equals("sparcv9") ||
os_arch.equals("amd64"));
String isa_dir = d64?(File.separator+os_arch):"";
String java = jre_home
+ File.separator + "bin" + isa_dir
+ File.separator + "bin"
+ File.separator + "java";
String jhat = sdk_home + File.separator + "bin"
+ File.separator + "jhat";
/* Array of strings to be passed in for exec:
* 1. java
* 2. -Dtest.classes=.
* 3. -d64 (optional)
* 4. -Xcheck:jni (Just because it finds bugs)
* 5. -Xverify:all (Make sure verification is on full blast)
* 6. -agent
* 3. -Xcheck:jni (Just because it finds bugs)
* 4. -Xverify:all (Make sure verification is on full blast)
* 5. -agent
* vm_options
* 7+i. classname
* 6+i. classname
*/
int nvm_options = 0;
if ( vm_options != null ) nvm_options = vm_options.length;
String cmd[] = new String[1 + (d64?1:0) + 7 + nvm_options];
String cmd[] = new String[1 + 7 + nvm_options];
int i,j;
i = 0;
......@@ -196,9 +191,6 @@ public class HatRun {
cmd[i++] = "-cp";
cmd[i++] = cdir;
cmd[i++] = "-Dtest.classes=" + cdir;
if ( d64 ) {
cmd[i++] = "-d64";
}
cmd[i++] = "-Xcheck:jni";
cmd[i++] = "-Xverify:all";
dumpfile= cdir + File.separator + class_name + ".hdump";
......
#
# 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
......
/*
* 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");
}
}
......
/*
* 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);
}
}
......@@ -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.");
}
}
}
/*
* 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 {
......
/*
* 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);
......
/*
* 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++;
}
}
......@@ -209,13 +207,6 @@ 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.
*/
......@@ -223,28 +214,9 @@ public class TestHelper {
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.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册