提交 57110fdf 编写于 作者: A asaha

Merge

...@@ -50,3 +50,4 @@ b3f3240135f0c10b9f2481c174b81b7fcf0daa60 jdk7-b71 ...@@ -50,3 +50,4 @@ b3f3240135f0c10b9f2481c174b81b7fcf0daa60 jdk7-b71
f708138c9aca4b389872838fe6773872fce3609e jdk7-b73 f708138c9aca4b389872838fe6773872fce3609e jdk7-b73
eacb36e30327e7ae33baa068e82ddccbd91eaae2 jdk7-b74 eacb36e30327e7ae33baa068e82ddccbd91eaae2 jdk7-b74
8885b22565077236a927e824ef450742e434a230 jdk7-b75 8885b22565077236a927e824ef450742e434a230 jdk7-b75
8fb602395be0f7d5af4e7e93b7df2d960faf9d17 jdk7-b76
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
package com.sun.jmx.mbeanserver; package com.sun.jmx.mbeanserver;
import java.lang.annotation.Annotation; import java.lang.annotation.Annotation;
import java.lang.ref.SoftReference;
import java.lang.reflect.AnnotatedElement; import java.lang.reflect.AnnotatedElement;
import java.lang.reflect.Constructor; import java.lang.reflect.Constructor;
import java.lang.reflect.Method; import java.lang.reflect.Method;
...@@ -33,8 +34,13 @@ import java.lang.reflect.Modifier; ...@@ -33,8 +34,13 @@ import java.lang.reflect.Modifier;
import java.lang.reflect.Proxy; import java.lang.reflect.Proxy;
import java.lang.reflect.UndeclaredThrowableException; import java.lang.reflect.UndeclaredThrowableException;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
import java.util.LinkedList;
import java.util.Locale;
import java.util.Map; import java.util.Map;
import java.util.WeakHashMap;
import javax.management.Descriptor; import javax.management.Descriptor;
import javax.management.DescriptorKey; import javax.management.DescriptorKey;
...@@ -506,11 +512,25 @@ public class Introspector { ...@@ -506,11 +512,25 @@ public class Introspector {
} else { } else {
// Java Beans introspection // Java Beans introspection
// //
BeanInfo bi = java.beans.Introspector.getBeanInfo(complex.getClass()); Class<?> clazz = complex.getClass();
PropertyDescriptor[] pds = bi.getPropertyDescriptors(); Method readMethod = null;
for (PropertyDescriptor pd : pds) if (BeansHelper.isAvailable()) {
if (pd.getName().equals(element)) Object bi = BeansHelper.getBeanInfo(clazz);
return pd.getReadMethod().invoke(complex); Object[] pds = BeansHelper.getPropertyDescriptors(bi);
for (Object pd: pds) {
if (BeansHelper.getPropertyName(pd).equals(element)) {
readMethod = BeansHelper.getReadMethod(pd);
break;
}
}
} else {
// Java Beans not available so use simple introspection
// to locate method
readMethod = SimpleIntrospector.getReadMethod(clazz, element);
}
if (readMethod != null)
return readMethod.invoke(complex);
throw new AttributeNotFoundException( throw new AttributeNotFoundException(
"Could not find the getter method for the property " + "Could not find the getter method for the property " +
element + " using the Java Beans introspector"); element + " using the Java Beans introspector");
...@@ -524,4 +544,235 @@ public class Introspector { ...@@ -524,4 +544,235 @@ public class Introspector {
new AttributeNotFoundException(e.getMessage()), e); new AttributeNotFoundException(e.getMessage()), e);
} }
} }
/**
* A simple introspector that uses reflection to analyze a class and
* identify its "getter" methods. This class is intended for use only when
* Java Beans is not present (which implies that there isn't explicit
* information about the bean available).
*/
private static class SimpleIntrospector {
private SimpleIntrospector() { }
private static final String GET_METHOD_PREFIX = "get";
private static final String IS_METHOD_PREFIX = "is";
// cache to avoid repeated lookups
private static final Map<Class<?>,SoftReference<List<Method>>> cache =
Collections.synchronizedMap(
new WeakHashMap<Class<?>,SoftReference<List<Method>>> ());
/**
* Returns the list of methods cached for the given class, or {@code null}
* if not cached.
*/
private static List<Method> getCachedMethods(Class<?> clazz) {
// return cached methods if possible
SoftReference<List<Method>> ref = cache.get(clazz);
if (ref != null) {
List<Method> cached = ref.get();
if (cached != null)
return cached;
}
return null;
}
/**
* Returns {@code true} if the given method is a "getter" method (where
* "getter" method is a public method of the form getXXX or "boolean
* isXXX")
*/
static boolean isReadMethod(Method method) {
// ignore static methods
int modifiers = method.getModifiers();
if (Modifier.isStatic(modifiers))
return false;
String name = method.getName();
Class<?>[] paramTypes = method.getParameterTypes();
int paramCount = paramTypes.length;
if (paramCount == 0 && name.length() > 2) {
// boolean isXXX()
if (name.startsWith(IS_METHOD_PREFIX))
return (method.getReturnType() == boolean.class);
// getXXX()
if (name.length() > 3 && name.startsWith(GET_METHOD_PREFIX))
return (method.getReturnType() != void.class);
}
return false;
}
/**
* Returns the list of "getter" methods for the given class. The list
* is ordered so that isXXX methods appear before getXXX methods - this
* is for compatability with the JavaBeans Introspector.
*/
static List<Method> getReadMethods(Class<?> clazz) {
// return cached result if available
List<Method> cachedResult = getCachedMethods(clazz);
if (cachedResult != null)
return cachedResult;
// get list of public methods, filtering out methods that have
// been overridden to return a more specific type.
List<Method> methods =
StandardMBeanIntrospector.getInstance().getMethods(clazz);
methods = MBeanAnalyzer.eliminateCovariantMethods(methods);
// filter out the non-getter methods
List<Method> result = new LinkedList<Method>();
for (Method m: methods) {
if (isReadMethod(m)) {
// favor isXXX over getXXX
if (m.getName().startsWith(IS_METHOD_PREFIX)) {
result.add(0, m);
} else {
result.add(m);
}
}
}
// add result to cache
cache.put(clazz, new SoftReference<List<Method>>(result));
return result;
}
/**
* Returns the "getter" to read the given property from the given class or
* {@code null} if no method is found.
*/
static Method getReadMethod(Class<?> clazz, String property) {
// first character in uppercase (compatability with JavaBeans)
property = property.substring(0, 1).toUpperCase(Locale.ENGLISH) +
property.substring(1);
String getMethod = GET_METHOD_PREFIX + property;
String isMethod = IS_METHOD_PREFIX + property;
for (Method m: getReadMethods(clazz)) {
String name = m.getName();
if (name.equals(isMethod) || name.equals(getMethod)) {
return m;
}
}
return null;
}
}
/**
* A class that provides access to the JavaBeans Introspector and
* PropertyDescriptors without creating a static dependency on java.beans.
*/
private static class BeansHelper {
private static final Class<?> introspectorClass =
getClass("java.beans.Introspector");
private static final Class<?> beanInfoClass =
(introspectorClass == null) ? null : getClass("java.beans.BeanInfo");
private static final Class<?> getPropertyDescriptorClass =
(beanInfoClass == null) ? null : getClass("java.beans.PropertyDescriptor");
private static final Method getBeanInfo =
getMethod(introspectorClass, "getBeanInfo", Class.class);
private static final Method getPropertyDescriptors =
getMethod(beanInfoClass, "getPropertyDescriptors");
private static final Method getPropertyName =
getMethod(getPropertyDescriptorClass, "getName");
private static final Method getReadMethod =
getMethod(getPropertyDescriptorClass, "getReadMethod");
private static Class<?> getClass(String name) {
try {
return Class.forName(name, true, null);
} catch (ClassNotFoundException e) {
return null;
}
}
private static Method getMethod(Class<?> clazz,
String name,
Class<?>... paramTypes)
{
if (clazz != null) {
try {
return clazz.getMethod(name, paramTypes);
} catch (NoSuchMethodException e) {
throw new AssertionError(e);
}
} else {
return null;
}
}
private BeansHelper() { }
/**
* Returns {@code true} if java.beans is available.
*/
static boolean isAvailable() {
return introspectorClass != null;
}
/**
* Invokes java.beans.Introspector.getBeanInfo(Class)
*/
static Object getBeanInfo(Class<?> clazz) throws Exception {
try {
return getBeanInfo.invoke(null, clazz);
} catch (InvocationTargetException e) {
Throwable cause = e.getCause();
if (cause instanceof Exception)
throw (Exception)cause;
throw new AssertionError(e);
} catch (IllegalAccessException iae) {
throw new AssertionError(iae);
}
}
/**
* Invokes java.beans.BeanInfo.getPropertyDescriptors()
*/
static Object[] getPropertyDescriptors(Object bi) {
try {
return (Object[])getPropertyDescriptors.invoke(bi);
} catch (InvocationTargetException e) {
Throwable cause = e.getCause();
if (cause instanceof RuntimeException)
throw (RuntimeException)cause;
throw new AssertionError(e);
} catch (IllegalAccessException iae) {
throw new AssertionError(iae);
}
}
/**
* Invokes java.beans.PropertyDescriptor.getName()
*/
static String getPropertyName(Object pd) {
try {
return (String)getPropertyName.invoke(pd);
} catch (InvocationTargetException e) {
Throwable cause = e.getCause();
if (cause instanceof RuntimeException)
throw (RuntimeException)cause;
throw new AssertionError(e);
} catch (IllegalAccessException iae) {
throw new AssertionError(iae);
}
}
/**
* Invokes java.beans.PropertyDescriptor.getReadMethod()
*/
static Method getReadMethod(Object pd) {
try {
return (Method)getReadMethod.invoke(pd);
} catch (InvocationTargetException e) {
Throwable cause = e.getCause();
if (cause instanceof RuntimeException)
throw (RuntimeException)cause;
throw new AssertionError(e);
} catch (IllegalAccessException iae) {
throw new AssertionError(iae);
}
}
}
} }
...@@ -175,7 +175,7 @@ abstract class MBeanIntrospector<M> { ...@@ -175,7 +175,7 @@ abstract class MBeanIntrospector<M> {
/** /**
* Get the methods to be analyzed to build the MBean interface. * Get the methods to be analyzed to build the MBean interface.
*/ */
List<Method> getMethods(final Class<?> mbeanType) throws Exception { List<Method> getMethods(final Class<?> mbeanType) {
return Arrays.asList(mbeanType.getMethods()); return Arrays.asList(mbeanType.getMethods());
} }
......
...@@ -40,7 +40,6 @@ import java.security.PrivilegedExceptionAction; ...@@ -40,7 +40,6 @@ import java.security.PrivilegedExceptionAction;
import java.security.PrivilegedActionException; import java.security.PrivilegedActionException;
import java.security.ProtectionDomain; import java.security.ProtectionDomain;
import sun.security.util.ResourcesMgr; import sun.security.util.ResourcesMgr;
import sun.security.util.SecurityConstants;
/** /**
* <p> A <code>Subject</code> represents a grouping of related information * <p> A <code>Subject</code> represents a grouping of related information
...@@ -239,7 +238,7 @@ public final class Subject implements java.io.Serializable { ...@@ -239,7 +238,7 @@ public final class Subject implements java.io.Serializable {
public void setReadOnly() { public void setReadOnly() {
java.lang.SecurityManager sm = System.getSecurityManager(); java.lang.SecurityManager sm = System.getSecurityManager();
if (sm != null) { if (sm != null) {
sm.checkPermission(new AuthPermission("setReadOnly")); sm.checkPermission(AuthPermissionHolder.SET_READ_ONLY_PERMISSION);
} }
this.readOnly = true; this.readOnly = true;
...@@ -285,7 +284,7 @@ public final class Subject implements java.io.Serializable { ...@@ -285,7 +284,7 @@ public final class Subject implements java.io.Serializable {
java.lang.SecurityManager sm = System.getSecurityManager(); java.lang.SecurityManager sm = System.getSecurityManager();
if (sm != null) { if (sm != null) {
sm.checkPermission(new AuthPermission("getSubject")); sm.checkPermission(AuthPermissionHolder.GET_SUBJECT_PERMISSION);
} }
if (acc == null) { if (acc == null) {
...@@ -343,7 +342,7 @@ public final class Subject implements java.io.Serializable { ...@@ -343,7 +342,7 @@ public final class Subject implements java.io.Serializable {
java.lang.SecurityManager sm = System.getSecurityManager(); java.lang.SecurityManager sm = System.getSecurityManager();
if (sm != null) { if (sm != null) {
sm.checkPermission(SecurityConstants.DO_AS_PERMISSION); sm.checkPermission(AuthPermissionHolder.DO_AS_PERMISSION);
} }
if (action == null) if (action == null)
throw new NullPointerException throw new NullPointerException
...@@ -402,7 +401,7 @@ public final class Subject implements java.io.Serializable { ...@@ -402,7 +401,7 @@ public final class Subject implements java.io.Serializable {
java.lang.SecurityManager sm = System.getSecurityManager(); java.lang.SecurityManager sm = System.getSecurityManager();
if (sm != null) { if (sm != null) {
sm.checkPermission(SecurityConstants.DO_AS_PERMISSION); sm.checkPermission(AuthPermissionHolder.DO_AS_PERMISSION);
} }
if (action == null) if (action == null)
...@@ -456,7 +455,7 @@ public final class Subject implements java.io.Serializable { ...@@ -456,7 +455,7 @@ public final class Subject implements java.io.Serializable {
java.lang.SecurityManager sm = System.getSecurityManager(); java.lang.SecurityManager sm = System.getSecurityManager();
if (sm != null) { if (sm != null) {
sm.checkPermission(SecurityConstants.DO_AS_PRIVILEGED_PERMISSION); sm.checkPermission(AuthPermissionHolder.DO_AS_PRIVILEGED_PERMISSION);
} }
if (action == null) if (action == null)
...@@ -520,7 +519,7 @@ public final class Subject implements java.io.Serializable { ...@@ -520,7 +519,7 @@ public final class Subject implements java.io.Serializable {
java.lang.SecurityManager sm = System.getSecurityManager(); java.lang.SecurityManager sm = System.getSecurityManager();
if (sm != null) { if (sm != null) {
sm.checkPermission(SecurityConstants.DO_AS_PRIVILEGED_PERMISSION); sm.checkPermission(AuthPermissionHolder.DO_AS_PRIVILEGED_PERMISSION);
} }
if (action == null) if (action == null)
...@@ -1044,16 +1043,13 @@ public final class Subject implements java.io.Serializable { ...@@ -1044,16 +1043,13 @@ public final class Subject implements java.io.Serializable {
if (sm != null) { if (sm != null) {
switch (which) { switch (which) {
case Subject.PRINCIPAL_SET: case Subject.PRINCIPAL_SET:
sm.checkPermission(new AuthPermission sm.checkPermission(AuthPermissionHolder.MODIFY_PRINCIPALS_PERMISSION);
("modifyPrincipals"));
break; break;
case Subject.PUB_CREDENTIAL_SET: case Subject.PUB_CREDENTIAL_SET:
sm.checkPermission(new AuthPermission sm.checkPermission(AuthPermissionHolder.MODIFY_PUBLIC_CREDENTIALS_PERMISSION);
("modifyPublicCredentials"));
break; break;
default: default:
sm.checkPermission(new AuthPermission sm.checkPermission(AuthPermissionHolder.MODIFY_PRIVATE_CREDENTIALS_PERMISSION);
("modifyPrivateCredentials"));
break; break;
} }
} }
...@@ -1073,16 +1069,13 @@ public final class Subject implements java.io.Serializable { ...@@ -1073,16 +1069,13 @@ public final class Subject implements java.io.Serializable {
if (sm != null) { if (sm != null) {
switch (which) { switch (which) {
case Subject.PRINCIPAL_SET: case Subject.PRINCIPAL_SET:
sm.checkPermission sm.checkPermission(AuthPermissionHolder.MODIFY_PRINCIPALS_PERMISSION);
(new AuthPermission("modifyPrincipals"));
break; break;
case Subject.PUB_CREDENTIAL_SET: case Subject.PUB_CREDENTIAL_SET:
sm.checkPermission sm.checkPermission(AuthPermissionHolder.MODIFY_PUBLIC_CREDENTIALS_PERMISSION);
(new AuthPermission("modifyPublicCredentials"));
break; break;
default: default:
sm.checkPermission sm.checkPermission(AuthPermissionHolder.MODIFY_PRIVATE_CREDENTIALS_PERMISSION);
(new AuthPermission("modifyPrivateCredentials"));
break; break;
} }
} }
...@@ -1405,4 +1398,27 @@ public final class Subject implements java.io.Serializable { ...@@ -1405,4 +1398,27 @@ public final class Subject implements java.io.Serializable {
return set.add(o); return set.add(o);
} }
} }
static class AuthPermissionHolder {
static final AuthPermission DO_AS_PERMISSION =
new AuthPermission("doAs");
static final AuthPermission DO_AS_PRIVILEGED_PERMISSION =
new AuthPermission("doAsPrivileged");
static final AuthPermission SET_READ_ONLY_PERMISSION =
new AuthPermission("setReadOnly");
static final AuthPermission GET_SUBJECT_PERMISSION =
new AuthPermission("getSubject");
static final AuthPermission MODIFY_PRINCIPALS_PERMISSION =
new AuthPermission("modifyPrincipals");
static final AuthPermission MODIFY_PUBLIC_CREDENTIALS_PERMISSION =
new AuthPermission("modifyPublicCredentials");
static final AuthPermission MODIFY_PRIVATE_CREDENTIALS_PERMISSION =
new AuthPermission("modifyPrivateCredentials");
}
} }
...@@ -33,7 +33,6 @@ import java.security.Permission; ...@@ -33,7 +33,6 @@ import java.security.Permission;
import java.security.BasicPermission; import java.security.BasicPermission;
import java.security.SecurityPermission; import java.security.SecurityPermission;
import java.security.AllPermission; import java.security.AllPermission;
import javax.security.auth.AuthPermission;
/** /**
* Permission constants and string constants used to create permissions * Permission constants and string constants used to create permissions
...@@ -259,12 +258,4 @@ public final class SecurityConstants { ...@@ -259,12 +258,4 @@ public final class SecurityConstants {
// java.lang.SecurityManager // java.lang.SecurityManager
public static final SocketPermission LOCAL_LISTEN_PERMISSION = public static final SocketPermission LOCAL_LISTEN_PERMISSION =
new SocketPermission("localhost:1024-", SOCKET_LISTEN_ACTION); new SocketPermission("localhost:1024-", SOCKET_LISTEN_ACTION);
// javax.security.auth.Subject
public static final AuthPermission DO_AS_PERMISSION =
new AuthPermission("doAs");
// javax.security.auth.Subject
public static final AuthPermission DO_AS_PRIVILEGED_PERMISSION =
new AuthPermission("doAsPrivileged");
} }
...@@ -150,9 +150,17 @@ public final class PKIXValidator extends Validator { ...@@ -150,9 +150,17 @@ public final class PKIXValidator extends Validator {
("null or zero-length certificate chain"); ("null or zero-length certificate chain");
} }
if (TRY_VALIDATOR) { if (TRY_VALIDATOR) {
// check if chain contains trust anchor // check that chain is in correct order and check if chain contains
// trust anchor
X500Principal prevIssuer = null;
for (int i = 0; i < chain.length; i++) { for (int i = 0; i < chain.length; i++) {
if (trustedCerts.contains(chain[i])) { X509Certificate cert = chain[i];
if (i != 0 &&
!cert.getSubjectX500Principal().equals(prevIssuer)) {
// chain is not ordered correctly, call builder instead
return doBuild(chain, otherCerts);
}
if (trustedCerts.contains(cert)) {
if (i == 0) { if (i == 0) {
return new X509Certificate[] {chain[0]}; return new X509Certificate[] {chain[0]};
} }
...@@ -161,6 +169,7 @@ public final class PKIXValidator extends Validator { ...@@ -161,6 +169,7 @@ public final class PKIXValidator extends Validator {
System.arraycopy(chain, 0, newChain, 0, i); System.arraycopy(chain, 0, newChain, 0, i);
return doValidate(newChain); return doValidate(newChain);
} }
prevIssuer = cert.getIssuerX500Principal();
} }
// apparently issued by trust anchor? // apparently issued by trust anchor?
...@@ -303,5 +312,4 @@ public final class PKIXValidator extends Validator { ...@@ -303,5 +312,4 @@ public final class PKIXValidator extends Validator {
("PKIX path building failed: " + e.toString(), e); ("PKIX path building failed: " + e.toString(), e);
} }
} }
} }
...@@ -337,9 +337,11 @@ clean: ...@@ -337,9 +337,11 @@ clean:
# jtreg tests # jtreg tests
# Expect JT_HOME to be set for jtreg tests. (home for jtreg) # Expect JT_HOME to be set for jtreg tests. (home for jtreg)
JT_HOME = $(SLASH_JAVA)/re/jtreg/4.0/promoted/latest/binaries/jtreg ifndef JT_HOME
ifdef JPRT_JTREG_HOME JT_HOME = $(SLASH_JAVA)/re/jtreg/4.0/promoted/latest/binaries/jtreg
JT_HOME = $(JPRT_JTREG_HOME) ifdef JPRT_JTREG_HOME
JT_HOME = $(JPRT_JTREG_HOME)
endif
endif endif
# Expect JPRT to set TESTDIRS to the jtreg test dirs # Expect JPRT to set TESTDIRS to the jtreg test dirs
...@@ -361,21 +363,22 @@ endif ...@@ -361,21 +363,22 @@ endif
# Some tests annoy me and fail frequently # Some tests annoy me and fail frequently
PROBLEM_LIST=ProblemList.txt PROBLEM_LIST=ProblemList.txt
PROBLEM_LISTS=$(PROBLEM_LIST) $(wildcard closed/$(PROBLEM_LIST))
EXCLUDELIST=$(ABS_TEST_OUTPUT_DIR)/excludelist.txt EXCLUDELIST=$(ABS_TEST_OUTPUT_DIR)/excludelist.txt
# Create exclude list for this platform and arch # Create exclude list for this platform and arch
ifdef NO_EXCLUDES ifdef NO_EXCLUDES
$(EXCLUDELIST): $(PROBLEM_LIST) $(TESTDIRS) $(EXCLUDELIST): $(PROBLEM_LISTS) $(TESTDIRS)
@$(ECHO) "NOTHING_EXCLUDED" > $@ @$(ECHO) "NOTHING_EXCLUDED" > $@
else else
$(EXCLUDELIST): $(PROBLEM_LIST) $(TESTDIRS) $(EXCLUDELIST): $(PROBLEM_LISTS) $(TESTDIRS)
@$(RM) $@ $@.temp1 $@.temp2 @$(RM) $@ $@.temp1 $@.temp2
@( ( $(EGREP) -- '$(OS_NAME)-all' $< ) ;\ @(($(CAT) $(PROBLEM_LISTS) | $(EGREP) -- '$(OS_NAME)-all' ) ;\
( $(EGREP) -- '$(OS_NAME)-$(OS_ARCH)' $< ) ;\ ($(CAT) $(PROBLEM_LISTS) | $(EGREP) -- '$(OS_NAME)-$(OS_ARCH)' ) ;\
( $(EGREP) -- '$(OS_NAME)-$(OS_VERSION)' $< ) ;\ ($(CAT) $(PROBLEM_LISTS) | $(EGREP) -- '$(OS_NAME)-$(OS_VERSION)') ;\
( $(EGREP) -- 'generic-$(OS_ARCH)' $< ) ;\ ($(CAT) $(PROBLEM_LISTS) | $(EGREP) -- 'generic-$(OS_ARCH)' ) ;\
( $(EGREP) -- 'generic-all' $< ) ;\ ($(CAT) $(PROBLEM_LISTS) | $(EGREP) -- 'generic-all' ) ;\
( $(ECHO) "#") ;\ ($(ECHO) "#") ;\
) | $(SED) -e 's@^[\ ]*@@' \ ) | $(SED) -e 's@^[\ ]*@@' \
| $(EGREP) -v '^#' > $@.temp1 | $(EGREP) -v '^#' > $@.temp1
@for tdir in $(TESTDIRS) ; do \ @for tdir in $(TESTDIRS) ; do \
...@@ -386,14 +389,18 @@ $(EXCLUDELIST): $(PROBLEM_LIST) $(TESTDIRS) ...@@ -386,14 +389,18 @@ $(EXCLUDELIST): $(PROBLEM_LIST) $(TESTDIRS)
@$(ECHO) "Excluding list contains `$(EXPAND) $@ | $(WC) -l` items" @$(ECHO) "Excluding list contains `$(EXPAND) $@ | $(WC) -l` items"
endif endif
# Select list of directories that exist
define TestDirs
$(foreach i,$1,$(wildcard ${i})) $(foreach i,$1,$(wildcard closed/${i}))
endef
# Running batches of tests with or without samevm # Running batches of tests with or without samevm
define RunSamevmBatch define RunSamevmBatch
$(ECHO) "Running tests in samevm mode: $?" $(ECHO) "Running tests in samevm mode: $(call TestDirs, $?)"
$(MAKE) TESTDIRS="$?" USE_JTREG_SAMEVM=true UNIQUE_DIR=$@ jtreg_tests $(MAKE) TESTDIRS="$(call TestDirs, $?)" USE_JTREG_SAMEVM=true UNIQUE_DIR=$@ jtreg_tests
endef endef
define RunOthervmBatch define RunOthervmBatch
$(ECHO) "Running tests in othervm mode: $?" $(ECHO) "Running tests in othervm mode: $(call TestDirs, $?)"
$(MAKE) TESTDIRS="$?" USE_JTREG_SAMEVM=false UNIQUE_DIR=$@ jtreg_tests $(MAKE) TESTDIRS="$(call TestDirs, $?)" USE_JTREG_SAMEVM=false UNIQUE_DIR=$@ jtreg_tests
endef endef
define SummaryInfo define SummaryInfo
$(ECHO) "Summary for: $?" $(ECHO) "Summary for: $?"
...@@ -428,6 +435,9 @@ JDK_ALL_TARGETS += jdk_beans3 ...@@ -428,6 +435,9 @@ JDK_ALL_TARGETS += jdk_beans3
jdk_beans3: java/beans/XMLEncoder jdk_beans3: java/beans/XMLEncoder
$(call RunOthervmBatch) $(call RunOthervmBatch)
jdk_beans: jdk_beans1 jdk_beans2 jdk_beans3
@$(SummaryInfo)
# Stable samevm testruns (minus items from PROBLEM_LIST) # Stable samevm testruns (minus items from PROBLEM_LIST)
JDK_ALL_TARGETS += jdk_io JDK_ALL_TARGETS += jdk_io
jdk_io: java/io jdk_io: java/io
...@@ -450,6 +460,9 @@ JDK_ALL_TARGETS += jdk_management2 ...@@ -450,6 +460,9 @@ JDK_ALL_TARGETS += jdk_management2
jdk_management2: com/sun/jmx com/sun/management sun/management jdk_management2: com/sun/jmx com/sun/management sun/management
$(call RunOthervmBatch) $(call RunOthervmBatch)
jdk_management: jdk_management1 jdk_management2
@$(SummaryInfo)
# Stable samevm testruns (minus items from PROBLEM_LIST) # Stable samevm testruns (minus items from PROBLEM_LIST)
JDK_ALL_TARGETS += jdk_math JDK_ALL_TARGETS += jdk_math
jdk_math: java/math jdk_math: java/math
...@@ -482,6 +495,9 @@ JDK_ALL_TARGETS += jdk_nio3 ...@@ -482,6 +495,9 @@ JDK_ALL_TARGETS += jdk_nio3
jdk_nio3: com/sun/nio sun/nio jdk_nio3: com/sun/nio sun/nio
$(call RunOthervmBatch) $(call RunOthervmBatch)
jdk_nio: jdk_nio1 jdk_nio2 jdk_nio3
@$(SummaryInfo)
# Stable othervm testruns (minus items from PROBLEM_LIST) # Stable othervm testruns (minus items from PROBLEM_LIST)
# Using samevm has serious problems with these tests # Using samevm has serious problems with these tests
JDK_ALL_TARGETS += jdk_rmi JDK_ALL_TARGETS += jdk_rmi
...@@ -502,6 +518,9 @@ JDK_ALL_TARGETS += jdk_security3 ...@@ -502,6 +518,9 @@ JDK_ALL_TARGETS += jdk_security3
jdk_security3: com/sun/security lib/security javax/security sun/security jdk_security3: com/sun/security lib/security javax/security sun/security
$(call RunOthervmBatch) $(call RunOthervmBatch)
jdk_security: jdk_security1 jdk_security2 jdk_security3
@$(SummaryInfo)
# Stable othervm testruns (minus items from PROBLEM_LIST) # Stable othervm testruns (minus items from PROBLEM_LIST)
# Using samevm has problems, and doesn't help performance as much as others. # Using samevm has problems, and doesn't help performance as much as others.
JDK_ALL_TARGETS += jdk_swing JDK_ALL_TARGETS += jdk_swing
...@@ -517,11 +536,14 @@ jdk_text: java/text sun/text ...@@ -517,11 +536,14 @@ jdk_text: java/text sun/text
# Using samevm has serious problems with these tests # Using samevm has serious problems with these tests
JDK_ALL_TARGETS += jdk_tools1 JDK_ALL_TARGETS += jdk_tools1
jdk_tools1: com/sun/jdi jdk_tools1: com/sun/jdi
$(call RunOthervmBatch) $(call RunSamevmBatch)
JDK_ALL_TARGETS += jdk_tools2 JDK_ALL_TARGETS += jdk_tools2
jdk_tools2: com/sun/tools sun/jvmstat sun/tools tools vm com/sun/servicetag com/sun/tracing jdk_tools2: com/sun/tools sun/jvmstat sun/tools tools vm com/sun/servicetag com/sun/tracing
$(call RunOthervmBatch) $(call RunOthervmBatch)
jdk_tools: jdk_tools1 jdk_tools2
@$(SummaryInfo)
# Stable samevm testruns (minus items from PROBLEM_LIST) # Stable samevm testruns (minus items from PROBLEM_LIST)
JDK_ALL_TARGETS += jdk_util JDK_ALL_TARGETS += jdk_util
jdk_util: java/util sun/util jdk_util: java/util sun/util
......
...@@ -344,6 +344,9 @@ java/io/StreamTokenizer/Comment.java generic-all ...@@ -344,6 +344,9 @@ java/io/StreamTokenizer/Comment.java generic-all
# Some of these tests (like java/lang/management) may just need to be marked # Some of these tests (like java/lang/management) may just need to be marked
# othervm, but that is partially speculation. # othervm, but that is partially speculation.
# Samevm failure on OpenSolaris, security manager?
java/lang/ClassLoader/UninitializedParent.java generic-all
# Times out on solaris 10 sparc # Times out on solaris 10 sparc
java/lang/ClassLoader/Assert.java generic-all java/lang/ClassLoader/Assert.java generic-all
...@@ -538,6 +541,18 @@ javax/imageio/plugins/jpeg/ReadAsGrayTest.java generic-all ...@@ -538,6 +541,18 @@ javax/imageio/plugins/jpeg/ReadAsGrayTest.java generic-all
# Missing close on file wbmp*, windows samevm # Missing close on file wbmp*, windows samevm
javax/imageio/plugins/wbmp/CanDecodeTest.java generic-all javax/imageio/plugins/wbmp/CanDecodeTest.java generic-all
# Failures on OpenSolaris, cannot read input files? samevm issues?
javax/imageio/metadata/BooleanAttributes.java generic-all
javax/imageio/plugins/bmp/BMPSubsamplingTest.java generic-all
javax/imageio/plugins/bmp/TopDownTest.java generic-all
javax/imageio/plugins/gif/EncodeSubImageTest.java generic-all
javax/imageio/plugins/gif/GifTransparencyTest.java generic-all
javax/imageio/plugins/png/GrayPngTest.java generic-all
javax/imageio/plugins/png/ItxtUtf8Test.java generic-all
javax/imageio/plugins/png/MergeStdCommentTest.java generic-all
javax/imageio/plugins/png/ShortHistogramTest.java generic-all
javax/imageio/plugins/shared/BitDepth.java generic-all
# Exclude all javax/print tests, even if they passed, they may need samevm work # Exclude all javax/print tests, even if they passed, they may need samevm work
# Times out on solaris-sparc, sparcv9, x64 -server, some on i586 -client # Times out on solaris-sparc, sparcv9, x64 -server, some on i586 -client
...@@ -1073,9 +1088,6 @@ java/text/Bidi/Bug6665028.java linux-x64 ...@@ -1073,9 +1088,6 @@ java/text/Bidi/Bug6665028.java linux-x64
# So most if not all tools tests are now being run with "othervm" mode. # So most if not all tools tests are now being run with "othervm" mode.
# Some of these tools tests have a tendency to use fixed ports, bad idea. # Some of these tools tests have a tendency to use fixed ports, bad idea.
# Solaris 10 client x86, java.lang.IndexOutOfBoundsException resumer Interrupted
com/sun/jdi/SimulResumerTest.java generic-all
# Output of jps differs from expected output. # Output of jps differs from expected output.
# Invalid argument count on solaris-sparc and x64 # Invalid argument count on solaris-sparc and x64
sun/tools/jstatd/jstatdPort.sh generic-all sun/tools/jstatd/jstatdPort.sh generic-all
...@@ -1090,9 +1102,6 @@ sun/tools/jps/jps-m_2.sh generic-all ...@@ -1090,9 +1102,6 @@ sun/tools/jps/jps-m_2.sh generic-all
# Server name error, port 2098 problem? # Server name error, port 2098 problem?
sun/tools/jstatd/jstatdServerName.sh generic-all sun/tools/jstatd/jstatdServerName.sh generic-all
# Solaris, handshake failed, othervm mode
com/sun/jdi/RedefineException.sh generic-all
# These tests fail on solaris sparc, all the time # These tests fail on solaris sparc, all the time
com/sun/servicetag/DeleteServiceTag.java generic-all com/sun/servicetag/DeleteServiceTag.java generic-all
com/sun/servicetag/DuplicateNotFound.java generic-all com/sun/servicetag/DuplicateNotFound.java generic-all
......
...@@ -112,6 +112,8 @@ public class BadHandshakeTest { ...@@ -112,6 +112,8 @@ public class BadHandshakeTest {
String arch = System.getProperty("os.arch"); String arch = System.getProperty("os.arch");
if (arch.equals("sparcv9")) { if (arch.equals("sparcv9")) {
exe += "sparcv9/java"; exe += "sparcv9/java";
} else if (arch.equals("amd64")) {
exe += "amd64/java";
} else { } else {
exe += "java"; exe += "java";
} }
......
...@@ -94,6 +94,8 @@ public class DoubleAgentTest { ...@@ -94,6 +94,8 @@ public class DoubleAgentTest {
String arch = System.getProperty("os.arch"); String arch = System.getProperty("os.arch");
if (arch.equals("sparcv9")) { if (arch.equals("sparcv9")) {
exe += "sparcv9/java"; exe += "sparcv9/java";
} else if (arch.equals("amd64")) {
exe += "amd64/java";
} else { } else {
exe += "java"; exe += "java";
} }
......
...@@ -101,6 +101,8 @@ public class ExclusiveBind { ...@@ -101,6 +101,8 @@ public class ExclusiveBind {
String arch = System.getProperty("os.arch"); String arch = System.getProperty("os.arch");
if (arch.equals("sparcv9")) { if (arch.equals("sparcv9")) {
exe += "sparcv9/java"; exe += "sparcv9/java";
} else if (arch.equals("amd64")) {
exe += "amd64/java";
} else { } else {
exe += "java"; exe += "java";
} }
......
...@@ -103,10 +103,10 @@ if [ -z "${TESTJAVA}" ] ; then ...@@ -103,10 +103,10 @@ if [ -z "${TESTJAVA}" ] ; then
#if running standalone (no test harness of any kind), compile the #if running standalone (no test harness of any kind), compile the
#support files and the test case #support files and the test case
${TESTJAVA}/bin/javac -d ${TESTCLASSES} \ ${TESTJAVA}/bin/javac -d ${TESTCLASSES} \
-classpath "$TESTJAVA/lib/tools.jar${PATHSEP}." \ -classpath "$TESTJAVA/lib/tools.jar${PATHSEP}${TESTSRC}" \
TestScaffold.java VMConnection.java TargetListener.java TargetAdapter.java TestScaffold.java VMConnection.java TargetListener.java TargetAdapter.java
${TESTJAVA}/bin/javac -d ${TESTCLASSES} \ ${TESTJAVA}/bin/javac -d ${TESTCLASSES} \
-classpath "$TESTJAVA/lib/tools.jar${PATHSEP}." -g \ -classpath "$TESTJAVA/lib/tools.jar${PATHSEP}${TESTSRC}" -g \
JITDebug.java JITDebug.java
fi fi
echo "JDK under test is: $TESTJAVA" echo "JDK under test is: $TESTJAVA"
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
* @run compile -g RepStepTarg.java * @run compile -g RepStepTarg.java
* @run build VMConnection RepStep * @run build VMConnection RepStep
* *
* @run main RepStep * @run main/othervm RepStep
* *
* @summary RepStep detects missed step events due to lack of * @summary RepStep detects missed step events due to lack of
* frame pop events (in back-end). * frame pop events (in back-end).
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
* @summary Test that with server=y, when VM runs to System.exit() no error happens * @summary Test that with server=y, when VM runs to System.exit() no error happens
* *
* @build VMConnection RunToExit Exit0 * @build VMConnection RunToExit Exit0
* @run main RunToExit * @run main/othervm RunToExit
*/ */
import java.io.InputStream; import java.io.InputStream;
import java.io.IOException; import java.io.IOException;
...@@ -117,6 +117,8 @@ public class RunToExit { ...@@ -117,6 +117,8 @@ public class RunToExit {
String arch = System.getProperty("os.arch"); String arch = System.getProperty("os.arch");
if (arch.equals("sparcv9")) { if (arch.equals("sparcv9")) {
exe += "sparcv9/java"; exe += "sparcv9/java";
} else if (arch.equals("amd64")) {
exe += "amd64/java";
} else { } else {
exe += "java"; exe += "java";
} }
......
#!/bin/sh #!/bin/sh
# #
# Copyright 2002-2005 Sun Microsystems, Inc. All Rights Reserved. # Copyright 2002-2009 Sun Microsystems, Inc. All Rights Reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
...@@ -194,7 +194,7 @@ findPid() ...@@ -194,7 +194,7 @@ findPid()
# Return 0 if $1 is the pid of a running process. # Return 0 if $1 is the pid of a running process.
if [ -z "$isWin98" ] ; then if [ -z "$isWin98" ] ; then
if [ "$osname" = SunOS ] ; then if [ "$osname" = SunOS ] ; then
#Solaris and OpenSolaris use pgrep and not ps in psCmd # Solaris and OpenSolaris use pgrep and not ps in psCmd
findPidCmd="$psCmd" findPidCmd="$psCmd"
else else
# Never use plain 'ps', which requires a "controlling terminal" # Never use plain 'ps', which requires a "controlling terminal"
...@@ -298,15 +298,15 @@ EOF ...@@ -298,15 +298,15 @@ EOF
# On linux, core files take a long time, and can leave # On linux, core files take a long time, and can leave
# zombie processes # zombie processes
if [ "$osname" = SunOS ] ; then if [ "$osname" = SunOS ] ; then
#Experiments show Solaris '/usr/ucb/ps -axwww' and # Experiments show Solaris '/usr/ucb/ps -axwww' and
#'/usr/bin/pgrep -f -l' provide the same small amount of the # '/usr/bin/pgrep -f -l' provide the same small amount of the
#argv string (PRARGSZ=80 in /usr/include/sys/procfs.h) # argv string (PRARGSZ=80 in /usr/include/sys/procfs.h)
# 1) This seems to have been working OK in ShellScaffold. # 1) This seems to have been working OK in ShellScaffold.
# 2) OpenSolaris does not provide /usr/ucb/ps, so use pgrep # 2) OpenSolaris does not provide /usr/ucb/ps, so use pgrep
# instead # instead
#The alternative would be to use /usr/bin/pargs [pid] to get # The alternative would be to use /usr/bin/pargs [pid] to get
#all the args for a process, splice them back into one # all the args for a process, splice them back into one
#long string, then grep. # long string, then grep.
UU=`/usr/xpg4/bin/id -u -n` UU=`/usr/xpg4/bin/id -u -n`
psCmd="pgrep -f -l -U $UU" psCmd="pgrep -f -l -U $UU"
else else
...@@ -519,7 +519,7 @@ cmd() ...@@ -519,7 +519,7 @@ cmd()
# if jdb got a cont cmd that caused the debuggee # if jdb got a cont cmd that caused the debuggee
# to run to completion, jdb can be gone before # to run to completion, jdb can be gone before
# we get here. # we get here.
echo quit >& 2 echo "--Sending cmd: quit" >& 2
echo quit echo quit
# See 6562090. Maybe there is a way that the exit # See 6562090. Maybe there is a way that the exit
# can cause jdb to not get the quit. # can cause jdb to not get the quit.
...@@ -531,7 +531,7 @@ cmd() ...@@ -531,7 +531,7 @@ cmd()
# because after starting jdb, we waited # because after starting jdb, we waited
# for the prompt. # for the prompt.
fileSize=`wc -c $jdbOutFile | awk '{ print $1 }'` fileSize=`wc -c $jdbOutFile | awk '{ print $1 }'`
echo $* >&2 echo "--Sending cmd: " $* >&2
# jjh: We have a few intermittent failures here. # jjh: We have a few intermittent failures here.
# It is as if every so often, jdb doesn't # It is as if every so often, jdb doesn't
...@@ -558,12 +558,85 @@ cmd() ...@@ -558,12 +558,85 @@ cmd()
# seen the ]. # seen the ].
echo $* echo $*
# wait for jdb output to appear # Now we have to wait for the next jdb prompt. We wait for a pattern
# to appear in the last line of jdb output. Normally, the prompt is
#
# 1) ^main[89] @
#
# where ^ means start of line, and @ means end of file with no end of line
# and 89 is the current command counter. But we have complications e.g.,
# the following jdb output can appear:
#
# 2) a[89] = 10
#
# The above form is an array assignment and not a prompt.
#
# 3) ^main[89] main[89] ...
#
# This occurs if the next cmd is one that causes no jdb output, e.g.,
# 'trace methods'.
#
# 4) ^main[89] [main[89]] .... > @
#
# jdb prints a > as a prompt after something like a cont.
# Thus, even though the above is the last 'line' in the file, it
# isn't the next prompt we are waiting for after the cont completes.
# HOWEVER, sometimes we see this for a cont command:
#
# ^main[89] $
# <lines output for hitting a bkpt>
#
# 5) ^main[89] > @
#
# i.e., the > prompt comes out AFTER the prompt we we need to wait for.
#
# So, how do we know when the next prompt has appeared??
# 1. Search for
# main[89] $
# This will handle cases 1, 2, 3
# 2. This leaves cases 4 and 5.
#
# What if we wait for 4 more chars to appear and then search for
#
# main[89] [>]$
#
# on the last line?
#
# a. if we are currently at
#
# ^main[89] main[89] @
#
# and a 'trace methods comes in, we will wait until at least
#
# ^main[89] main[89] main@
#
# and then the search will find the new prompt when it completes.
#
# b. if we are currently at
#
# ^main[89] main[89] @
#
# and the first form of cont comes in, then we will see
#
# ^main[89] main[89] > $
# ^x@
#
# where x is the first char of the msg output when the bkpt is hit
# and we will start our search, which will find the prompt
# when it comes out after the bkpt output, with or without the
# trailing >
#
# wait for 4 new chars to appear in the jdb output
count=0 count=0
desiredFileSize=`expr $fileSize + 4`
msg1=`echo At start: cmd/size/waiting : $* / $fileSize / \`date\`` msg1=`echo At start: cmd/size/waiting : $* / $fileSize / \`date\``
while [ 1 = 1 ] ; do while [ 1 = 1 ] ; do
newFileSize=`wc -c $jdbOutFile | awk '{ print $1 } '` newFileSize=`wc -c $jdbOutFile | awk '{ print $1 } '`
if [ "$fileSize" != "$newFileSize" ] ; then #echo jj: desired = $desiredFileSize, new = $newFileSize >& 2
done=`expr $newFileSize \>= $desiredFileSize`
if [ $done = 1 ] ; then
break break
fi fi
sleep ${sleep_seconds} sleep ${sleep_seconds}
...@@ -573,14 +646,19 @@ cmd() ...@@ -573,14 +646,19 @@ cmd()
echo "--DEBUG: jdb $$ didn't responded to command in $count secs: $*" >& 2 echo "--DEBUG: jdb $$ didn't responded to command in $count secs: $*" >& 2
echo "--DEBUG:" $msg1 >& 2 echo "--DEBUG:" $msg1 >& 2
echo "--DEBUG: "done size/waiting : / $newFileSize / `date` >& 2 echo "--DEBUG: "done size/waiting : / $newFileSize / `date` >& 2
$psCmd | sed -e '/com.sun.javatest/d' -e '/nsk/d' >& 2 echo "-- $jdbOutFile follows-------------------------------" >& 2
cat $jdbOutFile >& 2
echo "------------------------------------------" >& 2
dojstack
#$psCmd | sed -e '/com.sun.javatest/d' -e '/nsk/d' >& 2
if [ $count = 60 ] ; then if [ $count = 60 ] ; then
dofail "jdb never responded to command: $*" dofail "jdb never responded to command: $*"
fi fi
fi fi
done done
# Note that this assumes just these chars in thread names.
waitForJdbMsg '^.*\[[0-9]*\] $' 1 allowExit waitForJdbMsg '[a-zA-Z0-9_-][a-zA-Z0-9_-]*\[[1-9][0-9]*\] [ >]*$' \
1 allowExit
} }
setBkpts() setBkpts()
...@@ -596,15 +674,19 @@ setBkpts() ...@@ -596,15 +674,19 @@ setBkpts()
runToBkpt() runToBkpt()
{ {
cmd run cmd run
# Don't need to do this - the above waits for the next prompt which comes out
# AFTER the Breakpoint hit message.
# Wait for jdb to hit the bkpt # Wait for jdb to hit the bkpt
waitForJdbMsg "Breakpoint hit" 5 #waitForJdbMsg "Breakpoint hit" 5
} }
contToBkpt() contToBkpt()
{ {
cmd cont cmd cont
# Don't need to do this - the above waits for the next prompt which comes out
# AFTER the Breakpoint hit message.
# Wait for jdb to hit the bkpt # Wait for jdb to hit the bkpt
waitForJdbMsg "Breakpoint hit" 5 #waitForJdbMsg "Breakpoint hit" 5
} }
...@@ -618,7 +700,7 @@ waitForJdbMsg() ...@@ -618,7 +700,7 @@ waitForJdbMsg()
nlines=$2 nlines=$2
allowExit="$3" allowExit="$3"
myCount=0 myCount=0
timeLimit=40 # wait a max of 40 secs for a response from a jdb command timeLimit=40 # wait a max of this many secs for a response from a jdb command
while [ 1 = 1 ] ; do while [ 1 = 1 ] ; do
if [ -r $jdbOutFile ] ; then if [ -r $jdbOutFile ] ; then
# Something here causes jdb to complain about Unrecognized cmd on x86. # Something here causes jdb to complain about Unrecognized cmd on x86.
...@@ -654,8 +736,11 @@ waitForJdbMsg() ...@@ -654,8 +736,11 @@ waitForJdbMsg()
myCount=`expr $myCount + ${sleep_seconds}` myCount=`expr $myCount + ${sleep_seconds}`
if [ $myCount -gt $timeLimit ] ; then if [ $myCount -gt $timeLimit ] ; then
echo "--Fail: waitForJdbMsg timed out after $timeLimit seconds, looking for /$1/, in $nlines lines; exitting" >> $failFile
echo "vv jdbOutFile vvvvvvvvvvvvvvvvvvvvvvvvvvvv" >& 2
cat $jdbOutFile >& 2
echo "^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^" >& 2
dojstack dojstack
echo "--Fail: waitForJdbMsg timed out after $timeLimit seconds; exitting" >> $failFile
exit 1 exit 1
fi fi
done done
...@@ -865,35 +950,29 @@ grepForString() ...@@ -865,35 +950,29 @@ grepForString()
# get inserted into the string we are searching for # get inserted into the string we are searching for
# so ignore those chars. # so ignore those chars.
if [ -z "$3" ] ; then if [ -z "$3" ] ; then
case "$2" in theCmd=cat
*\>*)
# Target string contains a > so we better
# not ignore it
$grep -s "$2" $1 > $devnull 2>&1
stat=$?
;;
*)
# Target string does not contain a >.
# Ignore > and '> ' in the file.
cat $1 | sed -e 's@> @@g' -e 's@>@@g' | $grep -s "$2" > $devnull 2>&1
stat=$?
esac
else else
case "$2" in theCmd="tail -$3"
*\>*) fi
# Target string contains a > so we better case "$2" in
# not ignore it *\>*)
tail -$3 $1 | $grep -s "$2" > $devnull 2>&1 # Target string contains a > so we better
stat=$? # not ignore it
;; $theCmd $1 | $grep -s "$2" > $devnull 2>&1
*) return $?
# Target string does not contain a >. ;;
# Ignore > and '> ' in the file. esac
tail -$3 $1 | sed -e 's@> @@g' -e 's@>@@g' | $grep -s "$2" > $devnull 2>&1 # Target string does not contain a >.
stat=$? # Ignore > and '> ' in the file.
;; # NOTE: if $1 does not end with a new line, piping it to sed doesn't include the
esac # chars on the last line. Detect this case, and add a new line.
cp $1 $1.tmp
if [ `tail -1 $1.tmp | wc -l | sed -e 's@ @@g'` = 0 ] ; then
echo >> $1.tmp
fi fi
$theCmd $1.tmp | sed -e 's@> @@g' -e 's@>@@g' | $grep -s "$2" > $devnull 2>&1
stat=$?
rm -f $1.tmp
return $stat return $stat
} }
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
* *
* @run build TestScaffold VMConnection TargetListener TargetAdapter * @run build TestScaffold VMConnection TargetListener TargetAdapter
* @run compile -g SimulResumerTest.java * @run compile -g SimulResumerTest.java
* @run main SimulResumerTest * @run main/othervm SimulResumerTest
*/ */
import com.sun.jdi.*; import com.sun.jdi.*;
import com.sun.jdi.event.*; import com.sun.jdi.event.*;
......
...@@ -164,10 +164,10 @@ fi ...@@ -164,10 +164,10 @@ fi
if [ -n "${STANDALONE}" ] ; then if [ -n "${STANDALONE}" ] ; then
#if running standalone, compile the support files #if running standalone, compile the support files
${TESTJAVA}/bin/javac -d ${TESTCLASSES} \ ${TESTJAVA}/bin/javac -d ${TESTCLASSES} \
-classpath "$TESTJAVA/lib/tools.jar${PATHSEP}." \ -classpath "$TESTJAVA/lib/tools.jar${PATHSEP}${TESTSRC}" \
TestScaffold.java VMConnection.java TargetListener.java TargetAdapter.java TestScaffold.java VMConnection.java TargetListener.java TargetAdapter.java
${TESTJAVA}/bin/javac -d ${TESTCLASSES} \ ${TESTJAVA}/bin/javac -d ${TESTCLASSES} \
-classpath "$TESTJAVA/lib/tools.jar${PATHSEP}." -g \ -classpath "$TESTJAVA/lib/tools.jar${PATHSEP}${TESTSRC}" -g \
FetchLocals.java DataModelTest.java FetchLocals.java DataModelTest.java
fi fi
......
...@@ -57,6 +57,7 @@ class VMConnection { ...@@ -57,6 +57,7 @@ class VMConnection {
if (testClasses == null) { if (testClasses == null) {
return retVal; return retVal;
} }
retVal += "-classpath " + testClasses + " ";
File myFile = new File(testClasses, "@debuggeeVMOptions"); File myFile = new File(testClasses, "@debuggeeVMOptions");
if (!myFile.canRead()) { if (!myFile.canRead()) {
...@@ -97,7 +98,7 @@ class VMConnection { ...@@ -97,7 +98,7 @@ class VMConnection {
if (line.length() != 0 && !line.startsWith("#")) { if (line.length() != 0 && !line.startsWith("#")) {
System.out.println("-- Added debuggeeVM options from file " + System.out.println("-- Added debuggeeVM options from file " +
wholePath + ": " + line); wholePath + ": " + line);
retVal = line; retVal += line;
break; break;
} }
// Else, read he next line. // Else, read he next line.
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
* This tests launches a debuggee using a custom LaunchingConnector. * This tests launches a debuggee using a custom LaunchingConnector.
* *
* @build DebugUsingCustomConnector SimpleLaunchingConnector Foo NullTransportService * @build DebugUsingCustomConnector SimpleLaunchingConnector Foo NullTransportService
* @run main DebugUsingCustomConnector * @run main/othervm DebugUsingCustomConnector
*/ */
import com.sun.jdi.*; import com.sun.jdi.*;
import com.sun.jdi.connect.*; import com.sun.jdi.connect.*;
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
* created and that they have an "address" argument. * created and that they have an "address" argument.
* *
* @build GeneratedConnectors NullTransportService * @build GeneratedConnectors NullTransportService
* @run main GeneratedConnectors * @run main/othervm GeneratedConnectors
*/ */
import com.sun.jdi.*; import com.sun.jdi.*;
......
...@@ -147,11 +147,15 @@ public class SimpleLaunchingConnector implements LaunchingConnector { ...@@ -147,11 +147,15 @@ public class SimpleLaunchingConnector implements LaunchingConnector {
String arch = System.getProperty("os.arch"); String arch = System.getProperty("os.arch");
if (arch.equals("sparcv9")) { if (arch.equals("sparcv9")) {
exe += "sparcv9/java"; exe += "sparcv9/java";
} else if (arch.equals("amd64")) {
exe += "amd64/java";
} else { } else {
exe += "java"; exe += "java";
} }
String cmd = exe + " -Xdebug -Xrunjdwp:transport=dt_socket,timeout=15000,address=" + String cmd = exe + " -Xdebug -Xrunjdwp:transport=dt_socket,timeout=15000,address=" +
key.address() + "" + className; key.address() +
" -classpath " + System.getProperty("test.classes") +
" " + className;
Process process = Runtime.getRuntime().exec(cmd); Process process = Runtime.getRuntime().exec(cmd);
Connection conn = ts.accept(key, 30*1000, 9*1000); Connection conn = ts.accept(key, 30*1000, 9*1000);
ts.stopListening(key); ts.stopListening(key);
......
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
* @run build TestScaffold VMConnection TargetListener TargetAdapter * @run build TestScaffold VMConnection TargetListener TargetAdapter
* @run compile -g RedefineTest.java * @run compile -g RedefineTest.java
* @run shell RedefineSetUp.sh * @run shell RedefineSetUp.sh
* @run main RedefineTest * @run main/othervm RedefineTest
*/ */
import com.sun.jdi.*; import com.sun.jdi.*;
import com.sun.jdi.event.*; import com.sun.jdi.event.*;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册