8195630: [Graal] vmTestbase/nsk/jvmti/AttachOnDemand/attach024/TestDescription.java fails with Graal

Reviewed-by: kvn
This commit is contained in:
Ekaterina Pavlova 2018-06-28 19:33:00 -07:00
parent b57ff34325
commit b4c6d6ae31
5 changed files with 90 additions and 56 deletions
test/hotspot/jtreg

@ -153,8 +153,6 @@ vmTestbase/nsk/jvmti/PopFrame/popframe009/TestDescription.java
vmTestbase/nsk/jvmti/ForceEarlyReturn/ForceEarlyReturn001/TestDescription.java 8195674 generic-all
vmTestbase/nsk/jvmti/ForceEarlyReturn/ForceEarlyReturn002/TestDescription.java 8195674 generic-all
vmTestbase/nsk/jvmti/AttachOnDemand/attach024/TestDescription.java 8195630 generic-all
vmTestbase/nsk/jvmti/unit/FollowReferences/followref003/TestDescription.java 8202342 generic-all
vmTestbase/nsk/jvmti/scenarios/hotswap/HS102/hs102t002/TestDescription.java 8204506 macosx-all

@ -35,8 +35,8 @@
* agent starts new thread from the 'agentmain' method, and all test checks are executed
* in this thread.
* Test checks that agent's JAR file is appended at the end of the system class path.
* Agent's JAR file contains modified class java.util.ServiceConfigurationError (it is assumed
* that this class isn't loaded before agent is loaded), agent instantiates ServiceConfigurationError
* Agent's JAR file contains modified class java.util.TooManyListenersException (it is assumed
* that this class isn't loaded before agent is loaded), agent instantiates TooManyListenersException
* and checks that non-modified version of this class was loaded from rt.jar (not from agent's JAR).
*
* @library /vmTestbase
@ -46,7 +46,7 @@
* nsk.share.aod.TargetApplicationWaitingAgents
* nsk.jvmti.AttachOnDemand.attach024.attach024Agent00
*
* @comment compile modified java.util.ServiceConfigurationError
* @comment compile modified java.util.TooManyListenersException
* @build ExecDriver
* @run driver PropertyResolvingWrapper ExecDriver --cmd
* ${compile.jdk}/bin/javac
@ -54,14 +54,14 @@
* -d ./bin/classes
* --patch-module java.base=${test.src}/java.base
* --add-reads java.base=ALL-UNNAMED
* ${test.src}/java.base/java/util/ServiceConfigurationError.java
* ${test.src}/java.base/java/util/TooManyListenersException.java
*
* @comment create attach024Agent00.jar in current directory
* @run driver PropertyResolvingWrapper ExecDriver --cmd
* ${compile.jdk}/bin/jar
* -cfm attach024Agent00.jar ${test.src}/attach024Agent00.mf
* -C ./bin/classes
* java/util/ServiceConfigurationError.class
* java/util/TooManyListenersException.class
* @run driver ClassFileInstaller
* nsk.jvmti.AttachOnDemand.attach024.attach024Agent00
* @run driver PropertyResolvingWrapper ExecDriver --cmd

@ -30,27 +30,27 @@ public class attach024Agent00 extends AbstractJarAgent {
public static final String MODIFIED_TO_STRING = "attach024: Modified version";
private static final String TESTED_CLASS_NAME = "java.util.ServiceConfigurationError";
private static final String TESTED_CLASS_NAME = "java.util.TooManyListenersException";
protected void agentActions() {
/*
* Check that ServiceConfigurationError isn't loaded, otherwise test checks
* Check that TooManyListenersException isn't loaded, otherwise test checks
* doesn't make sense
*/
for (Class<?> klass : inst.getAllLoadedClasses()) {
if (klass.getName().equals(TESTED_CLASS_NAME)) {
throw new TestBug("ServiceConfigurationError already loaded");
throw new TestBug("TooManyListenersException already loaded");
}
}
checkServiceConfigurationError();
checkTooManyListenersException();
}
void checkServiceConfigurationError() {
java.util.ServiceConfigurationError e = new java.util.ServiceConfigurationError("Test");
display("ServiceConfigurationError.toString(): " + e.toString());
void checkTooManyListenersException() {
java.util.TooManyListenersException e = new java.util.TooManyListenersException("Test");
display("TooManyListenersException.toString(): " + e.toString());
if (e.toString().equals(MODIFIED_TO_STRING)) {
setStatusFailed("Class ServiceConfigurationError was erroneously loaded from agent's jar");
setStatusFailed("Class TooManyListenersException was erroneously loaded from agent's jar");
}
}

@ -1,41 +0,0 @@
/*
* Copyright (c) 2008, 2018, 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.
*/
package java.util;
import nsk.jvmti.AttachOnDemand.attach024.*;
public class ServiceConfigurationError extends Error {
private static final long serialVersionUID = 74132770414881L;
public ServiceConfigurationError(String msg) {
super(msg);
}
public ServiceConfigurationError(String msg, Throwable cause) {
super(msg, cause);
}
public String toString() {
return attach024Agent00.MODIFIED_TO_STRING;
}
}

@ -0,0 +1,77 @@
/*
* Copyright (c) 1996, 2008, 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. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* 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.
*/
package java.util;
import nsk.jvmti.AttachOnDemand.attach024.*;
/**
* <p>
* The <code> TooManyListenersException </code> Exception is used as part of
* the Java Event model to annotate and implement a unicast special case of
* a multicast Event Source.
* </p>
* <p>
* The presence of a "throws TooManyListenersException" clause on any given
* concrete implementation of the normally multicast "void addXyzEventListener"
* event listener registration pattern is used to annotate that interface as
* implementing a unicast Listener special case, that is, that one and only
* one Listener may be registered on the particular event listener source
* concurrently.
* </p>
*
* @see java.util.EventObject
* @see java.util.EventListener
*
* @author Laurence P. G. Cable
* @since 1.1
*/
public class TooManyListenersException extends Exception {
private static final long serialVersionUID = 5074640544770687831L;
/**
* Constructs a TooManyListenersException with no detail message.
* A detail message is a String that describes this particular exception.
*/
public TooManyListenersException() {
super();
}
/**
* Constructs a TooManyListenersException with the specified detail message.
* A detail message is a String that describes this particular exception.
* @param s the detail message
*/
public TooManyListenersException(String s) {
super(s);
}
public String toString() {
return attach024Agent00.MODIFIED_TO_STRING;
}
}