Mercurial > hg > release > icedtea7-forest-2.2 > jdk
changeset 2384:338c8775f0a3
Merge
author | asaha |
---|---|
date | Thu, 26 Nov 2009 07:17:08 -0800 |
parents | 621edf6b03fc (current diff) 57195a368d33 (diff) |
children | f0b63b6d9709 |
files | |
diffstat | 22 files changed, 510 insertions(+), 120 deletions(-) [+] |
line wrap: on
line diff
--- a/.hgtags Wed Nov 25 16:02:08 2009 -0800 +++ b/.hgtags Thu Nov 26 07:17:08 2009 -0800 @@ -50,3 +50,4 @@ f708138c9aca4b389872838fe6773872fce3609e jdk7-b73 eacb36e30327e7ae33baa068e82ddccbd91eaae2 jdk7-b74 8885b22565077236a927e824ef450742e434a230 jdk7-b75 +8fb602395be0f7d5af4e7e93b7df2d960faf9d17 jdk7-b76
--- a/src/share/classes/com/sun/jmx/mbeanserver/Introspector.java Wed Nov 25 16:02:08 2009 -0800 +++ b/src/share/classes/com/sun/jmx/mbeanserver/Introspector.java Thu Nov 26 07:17:08 2009 -0800 @@ -26,6 +26,7 @@ package com.sun.jmx.mbeanserver; import java.lang.annotation.Annotation; +import java.lang.ref.SoftReference; import java.lang.reflect.AnnotatedElement; import java.lang.reflect.Constructor; import java.lang.reflect.Method; @@ -33,8 +34,13 @@ import java.lang.reflect.Proxy; import java.lang.reflect.UndeclaredThrowableException; import java.util.Arrays; +import java.util.Collections; import java.util.HashMap; +import java.util.List; +import java.util.LinkedList; +import java.util.Locale; import java.util.Map; +import java.util.WeakHashMap; import javax.management.Descriptor; import javax.management.DescriptorKey; @@ -506,11 +512,25 @@ } else { // Java Beans introspection // - BeanInfo bi = java.beans.Introspector.getBeanInfo(complex.getClass()); - PropertyDescriptor[] pds = bi.getPropertyDescriptors(); - for (PropertyDescriptor pd : pds) - if (pd.getName().equals(element)) - return pd.getReadMethod().invoke(complex); + Class<?> clazz = complex.getClass(); + Method readMethod = null; + if (BeansHelper.isAvailable()) { + Object bi = BeansHelper.getBeanInfo(clazz); + 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( "Could not find the getter method for the property " + element + " using the Java Beans introspector"); @@ -524,4 +544,235 @@ 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); + } + } + } }
--- a/src/share/classes/com/sun/jmx/mbeanserver/MBeanIntrospector.java Wed Nov 25 16:02:08 2009 -0800 +++ b/src/share/classes/com/sun/jmx/mbeanserver/MBeanIntrospector.java Thu Nov 26 07:17:08 2009 -0800 @@ -175,7 +175,7 @@ /** * 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()); }
--- a/src/share/classes/javax/security/auth/Subject.java Wed Nov 25 16:02:08 2009 -0800 +++ b/src/share/classes/javax/security/auth/Subject.java Thu Nov 26 07:17:08 2009 -0800 @@ -40,7 +40,6 @@ import java.security.PrivilegedActionException; import java.security.ProtectionDomain; import sun.security.util.ResourcesMgr; -import sun.security.util.SecurityConstants; /** * <p> A <code>Subject</code> represents a grouping of related information @@ -239,7 +238,7 @@ public void setReadOnly() { java.lang.SecurityManager sm = System.getSecurityManager(); if (sm != null) { - sm.checkPermission(new AuthPermission("setReadOnly")); + sm.checkPermission(AuthPermissionHolder.SET_READ_ONLY_PERMISSION); } this.readOnly = true; @@ -285,7 +284,7 @@ java.lang.SecurityManager sm = System.getSecurityManager(); if (sm != null) { - sm.checkPermission(new AuthPermission("getSubject")); + sm.checkPermission(AuthPermissionHolder.GET_SUBJECT_PERMISSION); } if (acc == null) { @@ -343,7 +342,7 @@ java.lang.SecurityManager sm = System.getSecurityManager(); if (sm != null) { - sm.checkPermission(SecurityConstants.DO_AS_PERMISSION); + sm.checkPermission(AuthPermissionHolder.DO_AS_PERMISSION); } if (action == null) throw new NullPointerException @@ -402,7 +401,7 @@ java.lang.SecurityManager sm = System.getSecurityManager(); if (sm != null) { - sm.checkPermission(SecurityConstants.DO_AS_PERMISSION); + sm.checkPermission(AuthPermissionHolder.DO_AS_PERMISSION); } if (action == null) @@ -456,7 +455,7 @@ java.lang.SecurityManager sm = System.getSecurityManager(); if (sm != null) { - sm.checkPermission(SecurityConstants.DO_AS_PRIVILEGED_PERMISSION); + sm.checkPermission(AuthPermissionHolder.DO_AS_PRIVILEGED_PERMISSION); } if (action == null) @@ -520,7 +519,7 @@ java.lang.SecurityManager sm = System.getSecurityManager(); if (sm != null) { - sm.checkPermission(SecurityConstants.DO_AS_PRIVILEGED_PERMISSION); + sm.checkPermission(AuthPermissionHolder.DO_AS_PRIVILEGED_PERMISSION); } if (action == null) @@ -1044,16 +1043,13 @@ if (sm != null) { switch (which) { case Subject.PRINCIPAL_SET: - sm.checkPermission(new AuthPermission - ("modifyPrincipals")); + sm.checkPermission(AuthPermissionHolder.MODIFY_PRINCIPALS_PERMISSION); break; case Subject.PUB_CREDENTIAL_SET: - sm.checkPermission(new AuthPermission - ("modifyPublicCredentials")); + sm.checkPermission(AuthPermissionHolder.MODIFY_PUBLIC_CREDENTIALS_PERMISSION); break; default: - sm.checkPermission(new AuthPermission - ("modifyPrivateCredentials")); + sm.checkPermission(AuthPermissionHolder.MODIFY_PRIVATE_CREDENTIALS_PERMISSION); break; } } @@ -1073,16 +1069,13 @@ if (sm != null) { switch (which) { case Subject.PRINCIPAL_SET: - sm.checkPermission - (new AuthPermission("modifyPrincipals")); + sm.checkPermission(AuthPermissionHolder.MODIFY_PRINCIPALS_PERMISSION); break; case Subject.PUB_CREDENTIAL_SET: - sm.checkPermission - (new AuthPermission("modifyPublicCredentials")); + sm.checkPermission(AuthPermissionHolder.MODIFY_PUBLIC_CREDENTIALS_PERMISSION); break; default: - sm.checkPermission - (new AuthPermission("modifyPrivateCredentials")); + sm.checkPermission(AuthPermissionHolder.MODIFY_PRIVATE_CREDENTIALS_PERMISSION); break; } } @@ -1405,4 +1398,27 @@ 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"); + } }
--- a/src/share/classes/sun/security/util/SecurityConstants.java Wed Nov 25 16:02:08 2009 -0800 +++ b/src/share/classes/sun/security/util/SecurityConstants.java Thu Nov 26 07:17:08 2009 -0800 @@ -33,7 +33,6 @@ import java.security.BasicPermission; import java.security.SecurityPermission; import java.security.AllPermission; -import javax.security.auth.AuthPermission; /** * Permission constants and string constants used to create permissions @@ -259,12 +258,4 @@ // java.lang.SecurityManager public static final SocketPermission LOCAL_LISTEN_PERMISSION = 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"); }
--- a/src/share/classes/sun/security/validator/PKIXValidator.java Wed Nov 25 16:02:08 2009 -0800 +++ b/src/share/classes/sun/security/validator/PKIXValidator.java Thu Nov 26 07:17:08 2009 -0800 @@ -150,9 +150,17 @@ ("null or zero-length certificate chain"); } 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++) { - 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) { return new X509Certificate[] {chain[0]}; } @@ -161,6 +169,7 @@ System.arraycopy(chain, 0, newChain, 0, i); return doValidate(newChain); } + prevIssuer = cert.getIssuerX500Principal(); } // apparently issued by trust anchor? @@ -303,5 +312,4 @@ ("PKIX path building failed: " + e.toString(), e); } } - }
--- a/test/Makefile Wed Nov 25 16:02:08 2009 -0800 +++ b/test/Makefile Thu Nov 26 07:17:08 2009 -0800 @@ -337,9 +337,11 @@ # jtreg tests # Expect JT_HOME to be set for jtreg tests. (home for jtreg) -JT_HOME = $(SLASH_JAVA)/re/jtreg/4.0/promoted/latest/binaries/jtreg -ifdef JPRT_JTREG_HOME - JT_HOME = $(JPRT_JTREG_HOME) +ifndef JT_HOME + JT_HOME = $(SLASH_JAVA)/re/jtreg/4.0/promoted/latest/binaries/jtreg + ifdef JPRT_JTREG_HOME + JT_HOME = $(JPRT_JTREG_HOME) + endif endif # Expect JPRT to set TESTDIRS to the jtreg test dirs @@ -361,21 +363,22 @@ # Some tests annoy me and fail frequently PROBLEM_LIST=ProblemList.txt +PROBLEM_LISTS=$(PROBLEM_LIST) $(wildcard closed/$(PROBLEM_LIST)) EXCLUDELIST=$(ABS_TEST_OUTPUT_DIR)/excludelist.txt # Create exclude list for this platform and arch ifdef NO_EXCLUDES -$(EXCLUDELIST): $(PROBLEM_LIST) $(TESTDIRS) +$(EXCLUDELIST): $(PROBLEM_LISTS) $(TESTDIRS) @$(ECHO) "NOTHING_EXCLUDED" > $@ else -$(EXCLUDELIST): $(PROBLEM_LIST) $(TESTDIRS) +$(EXCLUDELIST): $(PROBLEM_LISTS) $(TESTDIRS) @$(RM) $@ $@.temp1 $@.temp2 - @( ( $(EGREP) -- '$(OS_NAME)-all' $< ) ;\ - ( $(EGREP) -- '$(OS_NAME)-$(OS_ARCH)' $< ) ;\ - ( $(EGREP) -- '$(OS_NAME)-$(OS_VERSION)' $< ) ;\ - ( $(EGREP) -- 'generic-$(OS_ARCH)' $< ) ;\ - ( $(EGREP) -- 'generic-all' $< ) ;\ - ( $(ECHO) "#") ;\ + @(($(CAT) $(PROBLEM_LISTS) | $(EGREP) -- '$(OS_NAME)-all' ) ;\ + ($(CAT) $(PROBLEM_LISTS) | $(EGREP) -- '$(OS_NAME)-$(OS_ARCH)' ) ;\ + ($(CAT) $(PROBLEM_LISTS) | $(EGREP) -- '$(OS_NAME)-$(OS_VERSION)') ;\ + ($(CAT) $(PROBLEM_LISTS) | $(EGREP) -- 'generic-$(OS_ARCH)' ) ;\ + ($(CAT) $(PROBLEM_LISTS) | $(EGREP) -- 'generic-all' ) ;\ + ($(ECHO) "#") ;\ ) | $(SED) -e 's@^[\ ]*@@' \ | $(EGREP) -v '^#' > $@.temp1 @for tdir in $(TESTDIRS) ; do \ @@ -386,14 +389,18 @@ @$(ECHO) "Excluding list contains `$(EXPAND) $@ | $(WC) -l` items" 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 define RunSamevmBatch -$(ECHO) "Running tests in samevm mode: $?" -$(MAKE) TESTDIRS="$?" USE_JTREG_SAMEVM=true UNIQUE_DIR=$@ jtreg_tests +$(ECHO) "Running tests in samevm mode: $(call TestDirs, $?)" +$(MAKE) TESTDIRS="$(call TestDirs, $?)" USE_JTREG_SAMEVM=true UNIQUE_DIR=$@ jtreg_tests endef define RunOthervmBatch -$(ECHO) "Running tests in othervm mode: $?" -$(MAKE) TESTDIRS="$?" USE_JTREG_SAMEVM=false UNIQUE_DIR=$@ jtreg_tests +$(ECHO) "Running tests in othervm mode: $(call TestDirs, $?)" +$(MAKE) TESTDIRS="$(call TestDirs, $?)" USE_JTREG_SAMEVM=false UNIQUE_DIR=$@ jtreg_tests endef define SummaryInfo $(ECHO) "Summary for: $?" @@ -428,6 +435,9 @@ jdk_beans3: java/beans/XMLEncoder $(call RunOthervmBatch) +jdk_beans: jdk_beans1 jdk_beans2 jdk_beans3 + @$(SummaryInfo) + # Stable samevm testruns (minus items from PROBLEM_LIST) JDK_ALL_TARGETS += jdk_io jdk_io: java/io @@ -450,6 +460,9 @@ jdk_management2: com/sun/jmx com/sun/management sun/management $(call RunOthervmBatch) +jdk_management: jdk_management1 jdk_management2 + @$(SummaryInfo) + # Stable samevm testruns (minus items from PROBLEM_LIST) JDK_ALL_TARGETS += jdk_math jdk_math: java/math @@ -482,6 +495,9 @@ jdk_nio3: com/sun/nio sun/nio $(call RunOthervmBatch) +jdk_nio: jdk_nio1 jdk_nio2 jdk_nio3 + @$(SummaryInfo) + # Stable othervm testruns (minus items from PROBLEM_LIST) # Using samevm has serious problems with these tests JDK_ALL_TARGETS += jdk_rmi @@ -502,6 +518,9 @@ jdk_security3: com/sun/security lib/security javax/security sun/security $(call RunOthervmBatch) +jdk_security: jdk_security1 jdk_security2 jdk_security3 + @$(SummaryInfo) + # Stable othervm testruns (minus items from PROBLEM_LIST) # Using samevm has problems, and doesn't help performance as much as others. JDK_ALL_TARGETS += jdk_swing @@ -517,11 +536,14 @@ # Using samevm has serious problems with these tests JDK_ALL_TARGETS += jdk_tools1 jdk_tools1: com/sun/jdi - $(call RunOthervmBatch) + $(call RunSamevmBatch) JDK_ALL_TARGETS += jdk_tools2 jdk_tools2: com/sun/tools sun/jvmstat sun/tools tools vm com/sun/servicetag com/sun/tracing $(call RunOthervmBatch) +jdk_tools: jdk_tools1 jdk_tools2 + @$(SummaryInfo) + # Stable samevm testruns (minus items from PROBLEM_LIST) JDK_ALL_TARGETS += jdk_util jdk_util: java/util sun/util
--- a/test/ProblemList.txt Wed Nov 25 16:02:08 2009 -0800 +++ b/test/ProblemList.txt Thu Nov 26 07:17:08 2009 -0800 @@ -344,6 +344,9 @@ # Some of these tests (like java/lang/management) may just need to be marked # 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 java/lang/ClassLoader/Assert.java generic-all @@ -538,6 +541,18 @@ # Missing close on file wbmp*, windows samevm 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 # Times out on solaris-sparc, sparcv9, x64 -server, some on i586 -client @@ -1073,9 +1088,6 @@ # 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. -# Solaris 10 client x86, java.lang.IndexOutOfBoundsException resumer Interrupted -com/sun/jdi/SimulResumerTest.java generic-all - # Output of jps differs from expected output. # Invalid argument count on solaris-sparc and x64 sun/tools/jstatd/jstatdPort.sh generic-all @@ -1090,9 +1102,6 @@ # Server name error, port 2098 problem? 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 com/sun/servicetag/DeleteServiceTag.java generic-all com/sun/servicetag/DuplicateNotFound.java generic-all
--- a/test/com/sun/jdi/BadHandshakeTest.java Wed Nov 25 16:02:08 2009 -0800 +++ b/test/com/sun/jdi/BadHandshakeTest.java Thu Nov 26 07:17:08 2009 -0800 @@ -112,6 +112,8 @@ String arch = System.getProperty("os.arch"); if (arch.equals("sparcv9")) { exe += "sparcv9/java"; + } else if (arch.equals("amd64")) { + exe += "amd64/java"; } else { exe += "java"; }
--- a/test/com/sun/jdi/DoubleAgentTest.java Wed Nov 25 16:02:08 2009 -0800 +++ b/test/com/sun/jdi/DoubleAgentTest.java Thu Nov 26 07:17:08 2009 -0800 @@ -94,6 +94,8 @@ String arch = System.getProperty("os.arch"); if (arch.equals("sparcv9")) { exe += "sparcv9/java"; + } else if (arch.equals("amd64")) { + exe += "amd64/java"; } else { exe += "java"; }
--- a/test/com/sun/jdi/ExclusiveBind.java Wed Nov 25 16:02:08 2009 -0800 +++ b/test/com/sun/jdi/ExclusiveBind.java Thu Nov 26 07:17:08 2009 -0800 @@ -101,6 +101,8 @@ String arch = System.getProperty("os.arch"); if (arch.equals("sparcv9")) { exe += "sparcv9/java"; + } else if (arch.equals("amd64")) { + exe += "amd64/java"; } else { exe += "java"; }
--- a/test/com/sun/jdi/JITDebug.sh Wed Nov 25 16:02:08 2009 -0800 +++ b/test/com/sun/jdi/JITDebug.sh Thu Nov 26 07:17:08 2009 -0800 @@ -103,10 +103,10 @@ #if running standalone (no test harness of any kind), compile the #support files and the test case ${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 ${TESTJAVA}/bin/javac -d ${TESTCLASSES} \ - -classpath "$TESTJAVA/lib/tools.jar${PATHSEP}." -g \ + -classpath "$TESTJAVA/lib/tools.jar${PATHSEP}${TESTSRC}" -g \ JITDebug.java fi echo "JDK under test is: $TESTJAVA"
--- a/test/com/sun/jdi/RepStep.java Wed Nov 25 16:02:08 2009 -0800 +++ b/test/com/sun/jdi/RepStep.java Thu Nov 26 07:17:08 2009 -0800 @@ -29,7 +29,7 @@ * @run compile -g RepStepTarg.java * @run build VMConnection RepStep * - * @run main RepStep + * @run main/othervm RepStep * * @summary RepStep detects missed step events due to lack of * frame pop events (in back-end).
--- a/test/com/sun/jdi/RunToExit.java Wed Nov 25 16:02:08 2009 -0800 +++ b/test/com/sun/jdi/RunToExit.java Thu Nov 26 07:17:08 2009 -0800 @@ -26,7 +26,7 @@ * @summary Test that with server=y, when VM runs to System.exit() no error happens * * @build VMConnection RunToExit Exit0 - * @run main RunToExit + * @run main/othervm RunToExit */ import java.io.InputStream; import java.io.IOException; @@ -117,6 +117,8 @@ String arch = System.getProperty("os.arch"); if (arch.equals("sparcv9")) { exe += "sparcv9/java"; + } else if (arch.equals("amd64")) { + exe += "amd64/java"; } else { exe += "java"; }
--- a/test/com/sun/jdi/ShellScaffold.sh Wed Nov 25 16:02:08 2009 -0800 +++ b/test/com/sun/jdi/ShellScaffold.sh Thu Nov 26 07:17:08 2009 -0800 @@ -1,7 +1,7 @@ #!/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. # # This code is free software; you can redistribute it and/or modify it @@ -194,7 +194,7 @@ # Return 0 if $1 is the pid of a running process. if [ -z "$isWin98" ] ; 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" else # Never use plain 'ps', which requires a "controlling terminal" @@ -298,15 +298,15 @@ # On linux, core files take a long time, and can leave # zombie processes if [ "$osname" = SunOS ] ; then - #Experiments show Solaris '/usr/ucb/ps -axwww' and - #'/usr/bin/pgrep -f -l' provide the same small amount of the - #argv string (PRARGSZ=80 in /usr/include/sys/procfs.h) - # 1) This seems to have been working OK in ShellScaffold. - # 2) OpenSolaris does not provide /usr/ucb/ps, so use pgrep - # instead - #The alternative would be to use /usr/bin/pargs [pid] to get - #all the args for a process, splice them back into one - #long string, then grep. + # Experiments show Solaris '/usr/ucb/ps -axwww' and + # '/usr/bin/pgrep -f -l' provide the same small amount of the + # argv string (PRARGSZ=80 in /usr/include/sys/procfs.h) + # 1) This seems to have been working OK in ShellScaffold. + # 2) OpenSolaris does not provide /usr/ucb/ps, so use pgrep + # instead + # The alternative would be to use /usr/bin/pargs [pid] to get + # all the args for a process, splice them back into one + # long string, then grep. UU=`/usr/xpg4/bin/id -u -n` psCmd="pgrep -f -l -U $UU" else @@ -519,7 +519,7 @@ # if jdb got a cont cmd that caused the debuggee # to run to completion, jdb can be gone before # we get here. - echo quit >& 2 + echo "--Sending cmd: quit" >& 2 echo quit # See 6562090. Maybe there is a way that the exit # can cause jdb to not get the quit. @@ -531,7 +531,7 @@ # because after starting jdb, we waited # for the prompt. fileSize=`wc -c $jdbOutFile | awk '{ print $1 }'` - echo $* >&2 + echo "--Sending cmd: " $* >&2 # jjh: We have a few intermittent failures here. # It is as if every so often, jdb doesn't @@ -558,12 +558,85 @@ # seen the ]. 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 + desiredFileSize=`expr $fileSize + 4` msg1=`echo At start: cmd/size/waiting : $* / $fileSize / \`date\`` while [ 1 = 1 ] ; do 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 fi sleep ${sleep_seconds} @@ -573,14 +646,19 @@ echo "--DEBUG: jdb $$ didn't responded to command in $count secs: $*" >& 2 echo "--DEBUG:" $msg1 >& 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 dofail "jdb never responded to command: $*" fi fi done - - waitForJdbMsg '^.*\[[0-9]*\] $' 1 allowExit + # Note that this assumes just these chars in thread names. + waitForJdbMsg '[a-zA-Z0-9_-][a-zA-Z0-9_-]*\[[1-9][0-9]*\] [ >]*$' \ + 1 allowExit } setBkpts() @@ -596,15 +674,19 @@ runToBkpt() { 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 - waitForJdbMsg "Breakpoint hit" 5 + #waitForJdbMsg "Breakpoint hit" 5 } contToBkpt() { 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 - waitForJdbMsg "Breakpoint hit" 5 + #waitForJdbMsg "Breakpoint hit" 5 } @@ -618,7 +700,7 @@ nlines=$2 allowExit="$3" 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 if [ -r $jdbOutFile ] ; then # Something here causes jdb to complain about Unrecognized cmd on x86. @@ -654,8 +736,11 @@ myCount=`expr $myCount + ${sleep_seconds}` 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 - echo "--Fail: waitForJdbMsg timed out after $timeLimit seconds; exitting" >> $failFile exit 1 fi done @@ -865,35 +950,29 @@ # get inserted into the string we are searching for # so ignore those chars. if [ -z "$3" ] ; then - case "$2" in - *\>*) - # 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 + theCmd=cat else - case "$2" in - *\>*) - # Target string contains a > so we better - # not ignore it - tail -$3 $1 | $grep -s "$2" > $devnull 2>&1 - stat=$? - ;; - *) - # Target string does not contain a >. - # Ignore > and '> ' in the file. - tail -$3 $1 | sed -e 's@> @@g' -e 's@>@@g' | $grep -s "$2" > $devnull 2>&1 - stat=$? - ;; - esac + theCmd="tail -$3" fi + case "$2" in + *\>*) + # Target string contains a > so we better + # not ignore it + $theCmd $1 | $grep -s "$2" > $devnull 2>&1 + return $? + ;; + esac + # Target string does not contain a >. + # Ignore > and '> ' in the file. + # NOTE: if $1 does not end with a new line, piping it to sed doesn't include the + # 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 + $theCmd $1.tmp | sed -e 's@> @@g' -e 's@>@@g' | $grep -s "$2" > $devnull 2>&1 + stat=$? + rm -f $1.tmp return $stat }
--- a/test/com/sun/jdi/SimulResumerTest.java Wed Nov 25 16:02:08 2009 -0800 +++ b/test/com/sun/jdi/SimulResumerTest.java Thu Nov 26 07:17:08 2009 -0800 @@ -30,7 +30,7 @@ * * @run build TestScaffold VMConnection TargetListener TargetAdapter * @run compile -g SimulResumerTest.java - * @run main SimulResumerTest + * @run main/othervm SimulResumerTest */ import com.sun.jdi.*; import com.sun.jdi.event.*;
--- a/test/com/sun/jdi/Solaris32AndSolaris64Test.sh Wed Nov 25 16:02:08 2009 -0800 +++ b/test/com/sun/jdi/Solaris32AndSolaris64Test.sh Thu Nov 26 07:17:08 2009 -0800 @@ -164,10 +164,10 @@ if [ -n "${STANDALONE}" ] ; then #if running standalone, compile the support files ${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 ${TESTJAVA}/bin/javac -d ${TESTCLASSES} \ - -classpath "$TESTJAVA/lib/tools.jar${PATHSEP}." -g \ + -classpath "$TESTJAVA/lib/tools.jar${PATHSEP}${TESTSRC}" -g \ FetchLocals.java DataModelTest.java fi
--- a/test/com/sun/jdi/VMConnection.java Wed Nov 25 16:02:08 2009 -0800 +++ b/test/com/sun/jdi/VMConnection.java Thu Nov 26 07:17:08 2009 -0800 @@ -57,6 +57,7 @@ if (testClasses == null) { return retVal; } + retVal += "-classpath " + testClasses + " "; File myFile = new File(testClasses, "@debuggeeVMOptions"); if (!myFile.canRead()) { @@ -97,7 +98,7 @@ if (line.length() != 0 && !line.startsWith("#")) { System.out.println("-- Added debuggeeVM options from file " + wholePath + ": " + line); - retVal = line; + retVal += line; break; } // Else, read he next line.
--- a/test/com/sun/jdi/connect/spi/DebugUsingCustomConnector.java Wed Nov 25 16:02:08 2009 -0800 +++ b/test/com/sun/jdi/connect/spi/DebugUsingCustomConnector.java Thu Nov 26 07:17:08 2009 -0800 @@ -28,7 +28,7 @@ * This tests launches a debuggee using a custom LaunchingConnector. * * @build DebugUsingCustomConnector SimpleLaunchingConnector Foo NullTransportService - * @run main DebugUsingCustomConnector + * @run main/othervm DebugUsingCustomConnector */ import com.sun.jdi.*; import com.sun.jdi.connect.*;
--- a/test/com/sun/jdi/connect/spi/GeneratedConnectors.java Wed Nov 25 16:02:08 2009 -0800 +++ b/test/com/sun/jdi/connect/spi/GeneratedConnectors.java Thu Nov 26 07:17:08 2009 -0800 @@ -31,7 +31,7 @@ * created and that they have an "address" argument. * * @build GeneratedConnectors NullTransportService - * @run main GeneratedConnectors + * @run main/othervm GeneratedConnectors */ import com.sun.jdi.*;
--- a/test/com/sun/jdi/connect/spi/SimpleLaunchingConnector.java Wed Nov 25 16:02:08 2009 -0800 +++ b/test/com/sun/jdi/connect/spi/SimpleLaunchingConnector.java Thu Nov 26 07:17:08 2009 -0800 @@ -147,11 +147,15 @@ String arch = System.getProperty("os.arch"); if (arch.equals("sparcv9")) { exe += "sparcv9/java"; + } else if (arch.equals("amd64")) { + exe += "amd64/java"; } else { exe += "java"; } 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); Connection conn = ts.accept(key, 30*1000, 9*1000); ts.stopListening(key);
--- a/test/com/sun/jdi/redefine/RedefineTest.java Wed Nov 25 16:02:08 2009 -0800 +++ b/test/com/sun/jdi/redefine/RedefineTest.java Thu Nov 26 07:17:08 2009 -0800 @@ -34,7 +34,7 @@ * @run build TestScaffold VMConnection TargetListener TargetAdapter * @run compile -g RedefineTest.java * @run shell RedefineSetUp.sh - * @run main RedefineTest + * @run main/othervm RedefineTest */ import com.sun.jdi.*; import com.sun.jdi.event.*;