This commit is contained in:
Alejandro Murillo 2015-07-31 10:15:03 -07:00
commit 972e5ce0a3
53 changed files with 412 additions and 46 deletions

View File

@ -27,6 +27,10 @@ include LauncherCommon.gmk
$(eval $(call SetupLauncher,jsadebugd, \
-DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.jvm.hotspot.jdi.SADebugServer"$(COMMA) }' \
-DAPP_CLASSPATH='{ "/lib/tools.jar"$(COMMA) "/lib/sa-jdi.jar"$(COMMA) "/classes" }' \
,,,,,,,,,Info-privileged.plist))
$(eval $(call SetupLauncher,jhsdb, \
-DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.jvm.hotspot.SALauncher"$(COMMA) }' \
,,,,,,,,,Info-privileged.plist))

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1994, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1994, 2015, 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
@ -159,11 +159,12 @@ enum {
ITEM_InitObject, /* "this" is init method, before call
to super() */
ITEM_ReturnAddress, /* Extra info gives instr # of start pc */
/* The following three are only used within array types.
/* The following four are only used within array types.
* Normally, we use ITEM_Integer, instead. */
ITEM_Byte,
ITEM_Short,
ITEM_Char
ITEM_Char,
ITEM_Boolean
};
@ -1446,7 +1447,9 @@ verify_opcode_operands(context_type *context, unsigned int inumber, int offset)
full_info = MAKE_FULLINFO(ITEM_Float, 1, 0); break;
case JVM_T_DOUBLE:
full_info = MAKE_FULLINFO(ITEM_Double, 1, 0); break;
case JVM_T_BYTE: case JVM_T_BOOLEAN:
case JVM_T_BOOLEAN:
full_info = MAKE_FULLINFO(ITEM_Boolean, 1, 0); break;
case JVM_T_BYTE:
full_info = MAKE_FULLINFO(ITEM_Byte, 1, 0); break;
case JVM_T_CHAR:
full_info = MAKE_FULLINFO(ITEM_Char, 1, 0); break;
@ -2250,10 +2253,11 @@ pop_stack(context_type *context, unsigned int inumber, stack_info_type *new_stac
break;
}
case 'B': /* array of bytes */
if (top_type != MAKE_FULLINFO(ITEM_Byte, 1, 0))
case 'B': /* array of bytes or booleans */
if (top_type != MAKE_FULLINFO(ITEM_Byte, 1, 0) &&
top_type != MAKE_FULLINFO(ITEM_Boolean, 1, 0))
CCerror(context,
"Expecting to find array of bytes on stack");
"Expecting to find array of bytes or Booleans on stack");
break;
case 'C': /* array of characters */
@ -2403,7 +2407,6 @@ pop_stack(context_type *context, unsigned int inumber, stack_info_type *new_stac
CCerror(context, "Call to wrong initialization method");
}
if (this_idata->protected
&& context->major_version > LDC_CLASS_MAJOR_VERSION
&& !isAssignableTo(context, object_type,
context->currentclass_info)) {
CCerror(context, "Bad access to protected data");
@ -3728,7 +3731,14 @@ signature_to_fieldtype(context_type *context,
result = 0;
break;
case JVM_SIGNATURE_BOOLEAN: case JVM_SIGNATURE_BYTE:
case JVM_SIGNATURE_BOOLEAN:
full_info = (array_depth > 0)
? MAKE_FULLINFO(ITEM_Boolean, 0, 0)
: MAKE_FULLINFO(ITEM_Integer, 0, 0);
result = 'I';
break;
case JVM_SIGNATURE_BYTE:
full_info = (array_depth > 0)
? MAKE_FULLINFO(ITEM_Byte, 0, 0)
: MAKE_FULLINFO(ITEM_Integer, 0, 0);
@ -3831,7 +3841,7 @@ decrement_indirection(fullinfo_type array_info)
int indirection = GET_INDIRECTION(array_info) - 1;
int extra_info = GET_EXTRA_INFO(array_info);
if ( (indirection == 0)
&& ((type == ITEM_Short || type == ITEM_Byte || type == ITEM_Char)))
&& ((type == ITEM_Short || type == ITEM_Byte || type == ITEM_Boolean || type == ITEM_Char)))
type = ITEM_Integer;
return MAKE_FULLINFO(type, indirection, extra_info);
}
@ -4286,6 +4296,8 @@ print_fullinfo_type(context_type *context, fullinfo_type type, jboolean verbose)
jio_fprintf(stdout, "C"); break;
case ITEM_Short:
jio_fprintf(stdout, "S"); break;
case ITEM_Boolean:
jio_fprintf(stdout, "Z"); break;
case ITEM_Byte:
jio_fprintf(stdout, "B"); break;
case ITEM_NewObject:

View File

@ -379,7 +379,4 @@ sun/tools/jinfo/JInfoRunningProcessFlagTest.java generic-all
# 8057732
sun/jvmstat/monitor/MonitoredVm/MonitorVmStartTerminate.java generic-all
# 8064572 8060736 8062938
sun/jvmstat/monitor/MonitoredVm/CR6672135.java generic-all
############################################################################

View File

@ -30,6 +30,7 @@
# TTY: dump <ArrayReference> command not implemented.
# @author Tim Bell
#
# @key intermittent
# @run shell ArrayLengthDumpTest.sh
#
classname=ArrayLengthDumpTarg

View File

@ -28,6 +28,7 @@
*
* @author jjh
*
* @key intermittent
* @modules jdk.jdi
* @run build TestScaffold VMConnection TargetListener TargetAdapter
* @run compile -g BreakpointTest.java
@ -45,7 +46,7 @@ import java.util.*;
// the debuggee, waits a bit, and enables the bkpt again.
class BreakpointTarg {
public final static int BKPT_LINE = 55;
public final static int BKPT_LINE = 56;
// LINE NUMBER SENSITIVE
public static long count;

View File

@ -29,6 +29,7 @@
# @author dcubed (based on the test program posted to the following
# Eclipse thread https://bugs.eclipse.org/bugs/show_bug.cgi?id=279137)
#
# @key intermittent
# @run shell BreakpointWithFullGC.sh
compileOptions=-g

View File

@ -29,6 +29,7 @@
# @summary REGRESSION: jdb rejects the syntax catch java.lang.IndexOutOfBoundsException
# @author Tim Bell
#
# @key intermittent
# @run shell CatchAllTest.sh
#
classname=CatchAllTestTarg

View File

@ -29,6 +29,7 @@
# @summary TTY: 'catch caught' with no class pattern throws NullPointerException
# @author Tim Bell
#
# @key intermittent
# @run shell CatchCaughtTest.sh
#
classname=CatchCaughtTestTarg

View File

@ -28,6 +28,7 @@
# @summary TTY: surprising ExceptionSpec.resolveEventRequest() wildcard results
# @author Tim Bell
#
# @key intermittent
# @run shell CatchPatternTest.sh
classname=CatchPatternTestTarg
createJavaFile()

View File

@ -28,6 +28,7 @@
# @bug 4507088
# @summary TTY: Add a comment delimiter to the jdb command set
# @author Tim Bell
# @key intermittent
# @run shell CommandCommentDelimiter.sh
#

View File

@ -27,6 +27,7 @@
# @bug 4525714
# @summary jtreg test PopAsynchronousTest fails in build 85 with -Xcomp
# @author Jim Holmlund/Swamy Venkataramanappa
# @key intermittent
# @run shell DeoptimizeWalk.sh
# This is another test of the same bug. The bug occurs when trying

View File

@ -28,6 +28,7 @@
*
* @author Robert Field
*
* @key intermittent
* @modules jdk.jdi
* @run build TestScaffold VMConnection
* @run compile -g ExceptionEvents.java

View File

@ -26,6 +26,7 @@
# @test
# @bug 4660158
# @author Staffan Larsen
# @key intermittent
# @run shell JdbExprTest.sh
# These are variables that can be set to control execution

View File

@ -28,6 +28,7 @@
# @summary REGRESSION: jdb / jdi not stopping at some breakpoints and steps in j2sdk1.4.
# @author Jim Holmlund
#
# @key intermittent
# @run shell JdbMissStep.sh
# These are variables that can be set to control execution

View File

@ -29,6 +29,7 @@
#
# @author jjh
#
# @key intermittent
# @run shell JdbVarargsTest.sh
classname=JdbVarargsTest

View File

@ -29,6 +29,7 @@
#
# @author Jim Holmlund
#
# @key intermittent
# @modules jdk.jdi
# @run build TestScaffold VMConnection TargetListener TargetAdapter
# @run shell MixedSuspendTest.sh

View File

@ -29,6 +29,7 @@
# @summary TTY: NullPointerException at
# com.sun.tools.jdi.MirrorImpl.validateMirrors
# @author Tim Bell
# @key intermittent
# @run shell NotAField.sh
#

View File

@ -31,6 +31,7 @@
# methods are called.
# @author Daniel D. Daugherty
#
# @key intermittent
# @run shell RedefineAbstractClass.sh
compileOptions=-g

View File

@ -28,6 +28,7 @@
# @summary Redefine a class that has an annotation and verify that the
# new annotation is returned.
#
# @key intermittent
# @run shell RedefineAnnotation.sh
compileOptions=-g

View File

@ -27,6 +27,7 @@
# @bug 4705330
# @summary Netbeans Fix and Continue crashes JVM
# @author Jim Holmlund/Swamy Venkataramanappa
# @key intermittent
# @run shell RedefineClearBreakpoint.sh
# The failure occurs after a bkpt is set and then cleared

View File

@ -28,6 +28,7 @@
# @summary The VM crashes when a method in a redefined class throws an exception.
# @author Jim Holmlund
#
# @key intermittent
# @run shell RedefineException.sh
# This is another symptomm of 4559100

View File

@ -27,6 +27,7 @@
# @bug 4788344
# @summary RedefineClasses is an apparent no-op if instance method is final
#
# @key intermittent
# @run shell RedefineFinal.sh
compileOptions=-g

View File

@ -27,6 +27,7 @@
# @bug 6394084
# @summary Redefine class can't handle addition of 64 bit constants in JDK1.5.0_05
#
# @key intermittent
# @run shell RedefineIntConstantToLong.sh
compileOptions=-g

View File

@ -30,6 +30,7 @@
#
# The failure occurs with debug java when the pop deletes the
# line that called the method which is being popped.
# @key intermittent
# @run shell RedefinePop.sh

View File

@ -27,6 +27,7 @@
# @bug 4689395
# @summary "step over" after a class is redefined acts like "step out"
# @author Jim Holmlund
# @key intermittent
# @run shell RedefineStep.sh
#

View File

@ -27,6 +27,7 @@
# @bug 4660756
# @summary TTY: Need to clear source cache after doing a redefine class
# @author Jim Holmlund
# @key intermittent
# @run shell/timeout=240 RedefineTTYLineNumber.sh
#set -x

View File

@ -28,6 +28,7 @@
*
* @author jjh
*
* @key intermittent
* @modules jdk.jdi
* @run build TestScaffold VMConnection TargetListener TargetAdapter
* @run compile -g SimulResumerTest.java

View File

@ -29,6 +29,7 @@
# 2. TTY: run on expression evaluation
# @author jim/suvasis mukherjee
#
# @key intermittent
# @run shell StringConvertTest.sh
# Run this script to see the bug. See comments at the end

View File

@ -5,6 +5,7 @@
*
* @author Robert Field / Jim Holmlund
*
* @key intermittent
* @library ..
* @modules jdk.jdi
* @run build TestScaffold VMConnection TargetListener TargetAdapter InstallSDE

View File

@ -41,7 +41,7 @@ import com.sun.tools.attach.VirtualMachineDescriptor;
* @test
* @bug 6173612 6273707 6277253 6335921 6348630 6342019 6381757
* @summary Basic unit tests for the VM attach mechanism.
* @modules jdk.jartool/sun.tools.jar
* @key intermittent
* @library /lib/testlibrary
* @modules java.instrument
* java.management

View File

@ -28,7 +28,7 @@
* @run main/othervm Assert
* @summary Test the assertion facility
* @author Mike McCloskey
* @key randomness
* @key randomness intermittent
*/
import package1.*;

View File

@ -26,6 +26,7 @@
# @summary Test non US-ASCII characters in the value of the Boot-Class-Path
# attribute.
#
# @key intermittent
# @modules java.instrument
# @run shell/timeout=240 BootClassPathTest.sh

View File

@ -26,6 +26,7 @@
# @summary JLI JAR manifest processing should ignore leading and trailing white space.
# @author Daniel D. Daugherty
#
# @key intermittent
# @modules java.instrument
# @run build ManifestTestApp ExampleForBootClassPath
# @run shell/timeout=900 ManifestTest.sh

View File

@ -27,6 +27,7 @@
* @summary test config (0,1,0,1): inherited 1-arg and declared 1-arg in agent class
* @author Daniel D. Daugherty, Sun Microsystems
*
* @key intermittent
* @run shell ../MakeJAR3.sh InheritAgent0101
* @run main/othervm -javaagent:InheritAgent0101.jar DummyMain
*/

View File

@ -26,6 +26,7 @@
# @summary Redefine a big class.
# @author Daniel D. Daugherty
#
# @key intermittent
# @modules java.instrument
# @run shell MakeJAR3.sh RedefineBigClassAgent 'Can-Redefine-Classes: true'
# @run build BigClass RedefineBigClassApp NMTHelper

View File

@ -26,6 +26,7 @@
# @summary Retransform a big class.
# @author Daniel D. Daugherty
#
# @key intermittent
# @modules java.instrument
# @run shell MakeJAR4.sh RetransformBigClassAgent SimpleIdentityTransformer 'Can-Retransform-Classes: true'
# @run build BigClass RetransformBigClassApp NMTHelper

View File

@ -27,6 +27,7 @@
* @summary Basic unit test of ThreadMXBean.getAllThreadIds()
* @author Alexei Guibadoulline and Mandy Chung
*
* @key intermittent
* @modules java.management
* @run main/othervm AllThreadIds
*/

View File

@ -27,6 +27,7 @@
* @summary Test that the jmx.monitor.error.runtime monitor notification
* is emitted when getAttribute throws ReflectionException.
* @author Luis-Miguel Alventosa
* @key intermittent
* @modules java.management
* @run clean ReflectionExceptionTest MBeanServerBuilderImpl
* MBeanServerForwarderInvocationHandler

View File

@ -27,6 +27,7 @@
* @summary Test that no locks are held when a monitor attribute is sampled
* or notif delivered.
* @author Eamonn McManus
* @key intermittent
* @modules java.management
* @run clean StringMonitorDeadlockTest
* @run build StringMonitorDeadlockTest

View File

@ -26,6 +26,7 @@
* @bug 6292705
* @summary Test support for arrays in parameterized types.
* @author Luis-Miguel Alventosa
* @key intermittent
* @modules java.management
* @run clean GenericArrayTypeTest
* @run build GenericArrayTypeTest

View File

@ -26,6 +26,7 @@
* @bug 4940957 8025205
* @summary Tests behaviour when connections break
* @author Eamonn McManus
* @key intermittent
* @modules java.management
* @run clean BrokenConnectionTest
* @run build BrokenConnectionTest

View File

@ -27,6 +27,7 @@
* @summary Check the emission of notifications when a Security Manager is
* installed. Test the property "jmx.remote.x.check.notification.emission".
* @author Luis-Miguel Alventosa
* @key intermittent
* @modules java.management
* @run clean NotificationEmissionTest
* @run build NotificationEmissionTest

View File

@ -21,11 +21,18 @@
* questions.
*/
import java.io.IOException;
import java.net.URISyntaxException;
import java.util.Set;
import java.util.ArrayList;
import java.util.List;
import jdk.testlibrary.Asserts;
import jdk.testlibrary.Utils;
import jdk.test.lib.apps.LingeredApp;
import sun.jvmstat.monitor.MonitorException;
import sun.jvmstat.monitor.MonitoredHost;
import sun.jvmstat.monitor.MonitoredVm;
import sun.jvmstat.monitor.MonitoredVmUtil;
import sun.jvmstat.monitor.VmIdentifier;
/**
@ -33,41 +40,41 @@ import sun.jvmstat.monitor.VmIdentifier;
* @test
* @bug 6672135
* @summary setInterval() for local MonitoredHost and local MonitoredVm
* @author Tomas Hurka
* @modules jdk.jvmstat/sun.jvmstat.monitor
* @run main/othervm -XX:+UsePerfData CR6672135
* @library /lib/testlibrary
* @library /../../test/lib/share/classes
* @build jdk.testlibrary.*
* @build jdk.test.lib.apps.*
* @run main TestPollingInterval
*/
public class CR6672135 {
public class TestPollingInterval {
private static final int INTERVAL = 2000;
public static void main(String[] args) {
int vmInterval;
int hostInterval;
public static void main(String[] args) throws IOException,
MonitorException, URISyntaxException {
LingeredApp app = null;
try {
List<String> vmArgs = new ArrayList<String>();
vmArgs.add("-XX:+UsePerfData");
vmArgs.addAll(Utils.getVmOptions());
app = LingeredApp.startApp(vmArgs);
MonitoredHost localHost = MonitoredHost.getMonitoredHost("localhost");
Set vms = localHost.activeVms();
Integer vmInt = (Integer) vms.iterator().next();
String uriString = "//" + vmInt + "?mode=r"; // NOI18N
String uriString = "//" + app.getPid() + "?mode=r"; // NOI18N
VmIdentifier vmId = new VmIdentifier(uriString);
MonitoredVm vm = localHost.getMonitoredVm(vmId);
System.out.println("Monitored vm command line: " + MonitoredVmUtil.commandLine(vm));
vm.setInterval(INTERVAL);
localHost.setInterval(INTERVAL);
vmInterval = vm.getInterval();
hostInterval = localHost.getInterval();
} catch (Exception ex) {
throw new Error ("Test failed",ex);
}
System.out.println("VM "+vmInterval);
if (vmInterval != INTERVAL) {
throw new Error("Test failed");
}
System.out.println("Host "+hostInterval);
if (hostInterval != INTERVAL) {
throw new Error("Test failed");
}
}
}
Asserts.assertEquals(vm.getInterval(), INTERVAL, "Monitored vm interval should be equal the test value");
Asserts.assertEquals(localHost.getInterval(), INTERVAL, "Monitored host interval should be equal the test value");
} finally {
LingeredApp.stopApp(app);
}
}
}

View File

@ -26,6 +26,7 @@
# @bug 6528083
# @summary Test RMI Bootstrap
#
# @key intermittent
# @library /lib/testlibrary
# @modules java.management/sun.management
# java.management/sun.management.jmxremote

View File

@ -40,6 +40,7 @@ import jdk.testlibrary.ProcessTools;
* @bug 8075926
* @summary Makes sure that the current management agent status is reflected
* in the related performance counters.
* @key intermittent
* @library /lib/testlibrary
* @build jdk.testlibrary.* PortAllocator TestApp ManagementAgentJcmd
* @run testng/othervm -XX:+UsePerfData JMXStatusPerfCountersTest

View File

@ -0,0 +1,145 @@
/*
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @summary Basic test for jhsdb launcher
* @library /../../test/lib/share/classes
* @library /lib/testlibrary
* @build jdk.testlibrary.*
* @build jdk.test.lib.apps.*
* @run main BasicLauncherTest
*/
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
import java.util.Arrays;
import jdk.testlibrary.JDKToolLauncher;
import jdk.testlibrary.Utils;
import jdk.testlibrary.OutputAnalyzer;
import jdk.testlibrary.ProcessTools;
import jdk.test.lib.apps.LingeredApp;
public class BasicLauncherTest {
private final static String toolName = "jhsdb";
private static LingeredApp theApp = null;
/**
*
* @return exit code of tool
*/
public static int launchCLHSDB()
throws IOException {
System.out.println("Starting LingeredApp");
try {
theApp = LingeredApp.startApp();
System.out.println("Starting clhsdb against " + theApp.getPid());
JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK(toolName);
launcher.addToolArg("clhsdb");
launcher.addToolArg("--pid=" + Long.toString(theApp.getPid()));
ProcessBuilder processBuilder = new ProcessBuilder(launcher.getCommand());
processBuilder.redirectError(ProcessBuilder.Redirect.INHERIT);
Process toolProcess = processBuilder.start();
toolProcess.getOutputStream().write("quit\n".getBytes());
toolProcess.getOutputStream().close();
// By default child process output stream redirected to pipe, so we are reading it in foreground.
BufferedReader reader = new BufferedReader(new InputStreamReader(toolProcess.getInputStream()));
String line;
while ((line = reader.readLine()) != null) {
System.out.println(line.trim());
}
toolProcess.waitFor();
return toolProcess.exitValue();
} catch (Exception ex) {
throw new RuntimeException("Test ERROR " + ex, ex);
} finally {
LingeredApp.stopApp(theApp);
}
}
/**
*
* @param vmArgs - vm and java arguments to launch test app
* @return exit code of tool
*/
public static void launch(String expectedMessage, List<String> toolArgs)
throws IOException {
System.out.println("Starting LingeredApp");
try {
theApp = LingeredApp.startApp();
System.out.println("Starting " + toolName + " " + toolArgs.get(0) + " against " + theApp.getPid());
JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK(toolName);
for (String cmd : toolArgs) {
launcher.addToolArg(cmd);
}
launcher.addToolArg("--pid=" + Long.toString(theApp.getPid()));
ProcessBuilder processBuilder = new ProcessBuilder(launcher.getCommand());
processBuilder.redirectError(ProcessBuilder.Redirect.INHERIT);
OutputAnalyzer output = ProcessTools.executeProcess(processBuilder);;
output.shouldContain(expectedMessage);
output.shouldHaveExitValue(0);
} catch (Exception ex) {
throw new RuntimeException("Test ERROR " + ex, ex);
} finally {
LingeredApp.stopApp(theApp);
}
}
public static void launch(String expectedMessage, String... toolArgs)
throws IOException {
launch(expectedMessage, Arrays.asList(toolArgs));
}
public static void main(String[] args)
throws IOException {
launchCLHSDB();
launch("No deadlocks found", "jstack");
launch("Server compiler detected", "jmap");
launch("Java System Properties", "jinfo");
// The test throws RuntimeException on error.
// IOException is thrown if LingeredApp can't start because of some bad
// environment condition
System.out.println("Test PASSED");
}
}

View File

@ -0,0 +1,156 @@
/*
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
/*
* @test
* @summary unit test for SAGetopt function
* @compile -XDignore.symbol.file SAGetoptTest.java
* @run main SAGetoptTest
*/
import sun.jvm.hotspot.SAGetopt;
public class SAGetoptTest {
private static boolean a_opt;
private static boolean b_opt;
private static boolean c_opt;
private static boolean e_opt;
private static boolean mixed_opt;
private static String d_value;
private static String exe_value;
private static String core_value;
private static void initArgValues() {
a_opt = false;
b_opt = false;
c_opt = false;
e_opt = false;
mixed_opt = false;
d_value = "";
exe_value = "";
core_value = "";
}
private static void optionsTest(String[] args) {
initArgValues();
SAGetopt sg = new SAGetopt(args);
String[] longOpts = {"exe=","core=","mixed"};
String shortOpts = "abcd:e";
String s;
while((s = sg.next(shortOpts, longOpts)) != null) {
if (s.equals("a")) {
a_opt = true;
continue;
}
if (s.equals("b")) {
b_opt = true;
continue;
}
if (s.equals("c")) {
c_opt = true;
continue;
}
if (s.equals("e")) {
e_opt = true;
continue;
}
if (s.equals("mixed")) {
mixed_opt = true;
continue;
}
if (s.equals("d")) {
d_value = sg.getOptarg();
continue;
}
if (s.equals("exe")) {
exe_value = sg.getOptarg();
continue;
}
if (s.equals("core")) {
core_value = sg.getOptarg();
continue;
}
}
}
private static void badOptionsTest(int setNumber, String[] args, String expectedMessage) {
String msg = null;
try {
optionsTest(args);
} catch(RuntimeException ex) {
msg = ex.getMessage();
}
if (msg == null || !msg.equals(expectedMessage)) {
if (msg != null) {
System.err.println("Unexpected error '" + msg + "'");
}
throw new RuntimeException("Bad option test " + setNumber + " failed");
}
}
public static void main(String[] args) {
String[] optionSet1 = {"-abd", "bla", "-c"};
optionsTest(optionSet1);
if (!a_opt || !b_opt || !d_value.equals("bla") || !c_opt) {
throw new RuntimeException("Good optionSet 1 failed");
}
String[] optionSet2 = {"-e", "--mixed"};
optionsTest(optionSet2);
if (!e_opt || !mixed_opt) {
throw new RuntimeException("Good optionSet 2 failed");
}
String[] optionSet3 = {"--exe=bla", "--core", "bla_core", "--mixed"};
optionsTest(optionSet3);
if (!exe_value.equals("bla") || !core_value.equals("bla_core") || !mixed_opt) {
throw new RuntimeException("Good optionSet 3 failed");
}
// Bad options test
String[] optionSet4 = {"-abd", "-c"};
badOptionsTest(4, optionSet4, "Argument is expected for 'd'");
String[] optionSet5 = {"-exe", "bla", "--core"};
badOptionsTest(5, optionSet5, "Invalid option 'x'");
String[] optionSet6 = {"--exe", "--core", "bla_core"};
badOptionsTest(6, optionSet6, "Argument is expected for 'exe'");
}
}

View File

@ -36,6 +36,7 @@ import jdk.testlibrary.ProcessTools;
* @test
* @bug 6321286
* @summary Unit test for jmap utility
* @key intermittent
* @library /lib/testlibrary
* @library /../../test/lib/share/classes
* @modules java.management

View File

@ -24,6 +24,7 @@
/*
* @test
* @bug 4990825
* @key intermittent
* @library /lib/testlibrary
* @modules java.management
* @build jdk.testlibrary.* JstatdTest JstatGCUtilParser

View File

@ -24,6 +24,7 @@
/*
* @test
* @bug 4990825 7092186
* @key intermittent
* @library /lib/testlibrary
* @modules java.management
* @build jdk.testlibrary.* JstatdTest JstatGCUtilParser

View File

@ -24,6 +24,7 @@
/*
* @test
* @bug 4990825
* @key intermittent
* @library /lib/testlibrary
* @modules java.management
* @build jdk.testlibrary.* JstatdTest JstatGCUtilParser

View File

@ -24,6 +24,7 @@
/*
* @test
* @bug 4990825
* @key intermittent
* @library /lib/testlibrary
* @modules java.management
* @build jdk.testlibrary.* JstatdTest JstatGCUtilParser

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -26,7 +26,7 @@
* @test
* @bug 6490436
* @summary Verify that protected constructor calls are not allowed for classfile version >= 50 (but that they are allowed for lesser versions).
* @summary Verify that protected constructor calls are not allowed for any classfile versions in either verifier.
* @author Keith McGuigan
*/
@ -38,9 +38,10 @@ public class VerifyProtectedConstructor extends ClassLoader {
try {
t.checkClassVersion(49); // should not throw VerifyError
throw new Exception("FAIL: should be a VerifyError for CF version 49");
}
catch(VerifyError e) {
throw new Exception("FAIL: should be no VerifyError for CF version 49");
System.out.println("PASS for CF version 49");
}
try {