mirror of
https://github.com/openjdk/jdk.git
synced 2026-01-28 12:09:14 +00:00
8199382: [TESTBUG] Open source VM testbase JDI tests
Reviewed-by: erikj, kvn, sspitsyn
This commit is contained in:
parent
1e0c45b250
commit
e48cfc709d
@ -63,6 +63,21 @@ NSK_MONITORING_INCLUDES := \
|
||||
-I$(VM_TESTBASE_DIR)/nsk/share/native \
|
||||
-I$(VM_TESTBASE_DIR)/nsk/share/jni
|
||||
|
||||
NSK_JDI_INCLUDES := \
|
||||
-I$(VM_TESTBASE_DIR)/nsk/share/native
|
||||
|
||||
NSK_SHARE_JDI_INCLUDES := \
|
||||
-I$(VM_TESTBASE_DIR)/nsk/share/native \
|
||||
-I$(VM_TESTBASE_DIR)/nsk/share/jdi
|
||||
|
||||
NSK_SHARE_JNI_INCLUDES := \
|
||||
-I$(VM_TESTBASE_DIR)/nsk/share/native \
|
||||
-I$(VM_TESTBASE_DIR)/nsk/share/jni
|
||||
|
||||
NSK_SHARE_LOCKS_INCLUDES := \
|
||||
-I$(VM_TESTBASE_DIR)/nsk/share/native \
|
||||
-I$(VM_TESTBASE_DIR)/nsk/share/locks
|
||||
|
||||
BUILD_HOTSPOT_JTREG_LIBRARIES_CFLAGS_libProcessUtils := $(VM_SHARE_INCLUDES)
|
||||
|
||||
BUILD_HOTSPOT_JTREG_LIBRARIES_CFLAGS_libThreadController := $(NSK_MONITORING_INCLUDES)
|
||||
@ -71,6 +86,15 @@ BUILD_HOTSPOT_JTREG_LIBRARIES_CFLAGS_libRecursiveMonitoringThread := $(NSK_MONIT
|
||||
BUILD_HOTSPOT_JTREG_LIBRARIES_CFLAGS_libLockingThreads := $(NSK_MONITORING_INCLUDES)
|
||||
BUILD_HOTSPOT_JTREG_LIBRARIES_CFLAGS_libStackTraceController := $(NSK_MONITORING_INCLUDES)
|
||||
|
||||
BUILD_HOTSPOT_JTREG_LIBRARIES_CFLAGS_libforceEarlyReturn005a := $(NSK_JDI_INCLUDES)
|
||||
|
||||
BUILD_HOTSPOT_JTREG_LIBRARIES_CFLAGS_libMonitorEnterExecutor := $(NSK_SHARE_JDI_INCLUDES)
|
||||
|
||||
BUILD_HOTSPOT_JTREG_LIBRARIES_CFLAGS_libJNIreferences := $(NSK_SHARE_JNI_INCLUDES)
|
||||
|
||||
BUILD_HOTSPOT_JTREG_LIBRARIES_CFLAGS_libLockingThread := $(NSK_SHARE_LOCKS_INCLUDES)
|
||||
BUILD_HOTSPOT_JTREG_LIBRARIES_CFLAGS_libJNIMonitorLocker := $(NSK_SHARE_LOCKS_INCLUDES)
|
||||
|
||||
################################################################################
|
||||
|
||||
# Platform specific setup
|
||||
|
||||
@ -84,3 +84,54 @@ compiler/jvmci/meta/StableFieldTest.java CODETOOLS-790216
|
||||
compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/HotSpotConstantReflectionProviderTest.java CODETOOLS-7902162 generic-all
|
||||
compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/MemoryAccessProviderTest.java CODETOOLS-7902162 generic-all
|
||||
compiler/jvmci/events/JvmciShutdownEventTest.java CODETOOLS-7902162 generic-all
|
||||
|
||||
vmTestbase/nsk/jdi/ThreadReference/forceEarlyReturn/forceEarlyReturn009/forceEarlyReturn009.java 8191047 generic-all
|
||||
|
||||
vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod012/TestDescription.java 8195600 generic-all
|
||||
vmTestbase/nsk/jdi/ClassType/setValue/setvalue006/TestDescription.java 8195600 generic-all
|
||||
vmTestbase/nsk/jdi/ListeningConnector/listennosuspend/listennosuspend001/TestDescription.java 8195600 generic-all
|
||||
vmTestbase/nsk/jdi/Location/lineNumber_s/lineNumber_s002/lineNumber_s002.java 8195600 generic-all
|
||||
vmTestbase/nsk/jdi/Location/sourcePath_s/sourcePath_s002/sourcePath_s002.java 8195600 generic-all
|
||||
vmTestbase/nsk/jdi/Method/allLineLocations_ss/allLineLocations_ss003/allLineLocations_ss003.java 8195600 generic-all
|
||||
vmTestbase/nsk/jdi/Method/locationsOfLine_ssi/locationsOfLine_ssi003/locationsOfLine_ssi003.java 8195600 generic-all
|
||||
vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod011/TestDescription.java 8195600 generic-all
|
||||
vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod012/TestDescription.java 8195600 generic-all
|
||||
vmTestbase/nsk/jdi/ObjectReference/referringObjects/referringObjects001/referringObjects001.java 8195600 generic-all
|
||||
vmTestbase/nsk/jdi/ObjectReference/referringObjects/referringObjects002/referringObjects002.java 8195600 generic-all
|
||||
vmTestbase/nsk/jdi/ObjectReference/referringObjects/referringObjects004/referringObjects004.java 8195600 generic-all
|
||||
vmTestbase/nsk/jdi/ObjectReference/setValue/setvalue005/TestDescription.java 8195600 generic-all
|
||||
vmTestbase/nsk/jdi/ReferenceType/instances/instances001/instances001.java 8195600 generic-all
|
||||
vmTestbase/nsk/jdi/ReferenceType/instances/instances002/instances002.java 8195600 generic-all
|
||||
vmTestbase/nsk/jdi/ReferenceType/instances/instances005/instances005.java 8195600 generic-all
|
||||
vmTestbase/nsk/jdi/ThreadReference/forceEarlyReturn/forceEarlyReturn007/TestDescription.java 8195600 generic-all
|
||||
vmTestbase/nsk/jdi/ThreadReference/ownedMonitorsAndFrames/ownedMonitorsAndFrames001/ownedMonitorsAndFrames001.java 8195600 generic-all
|
||||
vmTestbase/nsk/jdi/VMOutOfMemoryException/VMOutOfMemoryException001/VMOutOfMemoryException001.java 8195600 generic-all
|
||||
vmTestbase/nsk/jdi/VirtualMachine/instanceCounts/instancecounts003/instancecounts003.java 8195600 generic-all
|
||||
vmTestbase/nsk/jdi/stress/serial/ownedMonitorsAndFrames002/TestDescription.java 8195600 generic-all
|
||||
vmTestbase/nsk/jdi/ThreadReference/forceEarlyReturn/forceEarlyReturn003/forceEarlyReturn003.java 8195600 generic-all
|
||||
vmTestbase/nsk/jdi/ThreadReference/forceEarlyReturn/forceEarlyReturn004/forceEarlyReturn004.java 8195600 generic-all
|
||||
|
||||
vmTestbase/nsk/jdi/Location/sourceName_s/sourceName_s002/sourceName_s002.java 8200387 generic-all
|
||||
vmTestbase/nsk/jdi/Method/allLineLocations_ss/allLineLocations_ss002/allLineLocations_ss002.java 8200387 generic-all
|
||||
vmTestbase/nsk/jdi/Method/locationsOfLine_ssi/locationsOfLine_ssi002/locationsOfLine_ssi002.java 8200387 generic-all
|
||||
vmTestbase/nsk/jdi/ObjectReference/referringObjects/referringObjects003/referringObjects003.java 8200387 generic-all
|
||||
vmTestbase/nsk/jdi/ReferenceType/allLineLocations_ss/allLineLocations_ss003/allLineLocations_ss003.java 8200387 generic-all
|
||||
vmTestbase/nsk/jdi/ReferenceType/allLineLocations_ss/allLineLocations_ss004/allLineLocations_ss004.java 8200387 generic-all
|
||||
vmTestbase/nsk/jdi/ReferenceType/availableStrata/availableStrata002/availableStrata002.java 8200387 generic-all
|
||||
vmTestbase/nsk/jdi/ReferenceType/defaultStratum/defaultStratum002/defaultStratum002.java 8200387 generic-all
|
||||
vmTestbase/nsk/jdi/ReferenceType/locationsOfLine_ssi/locationsOfLine_ssi003/locationsOfLine_ssi003.java 8200387 generic-all
|
||||
vmTestbase/nsk/jdi/ReferenceType/locationsOfLine_ssi/locationsOfLine_ssi004/locationsOfLine_ssi004.java 8200387 generic-all
|
||||
vmTestbase/nsk/jdi/ReferenceType/sourceNames/sourceNames003/sourceNames003.java 8200387 generic-all
|
||||
vmTestbase/nsk/jdi/ReferenceType/sourcePaths/sourcePaths003/sourcePaths003.java 8200387 generic-all
|
||||
vmTestbase/nsk/jdi/StackFrame/getArgumentValues/getArgumentValues002/getArgumentValues002.java 8200387 generic-all
|
||||
vmTestbase/nsk/jdi/StackFrame/getArgumentValues/getArgumentValues003/getArgumentValues003.java 8200387 generic-all
|
||||
vmTestbase/nsk/jdi/stress/serial/heapwalking001/TestDescription.java 8200387 generic-all
|
||||
vmTestbase/nsk/jdi/ThreadReference/ownedMonitorsAndFrames/ownedMonitorsAndFrames004/ownedMonitorsAndFrames004.java 8200387 generic-all
|
||||
vmTestbase/nsk/jdi/VirtualMachine/instanceCounts/instancecounts001/instancecounts001.java 8200387 generic-all
|
||||
vmTestbase/nsk/jdi/VirtualMachine/instanceCounts/instancecounts002/TestDescription.java 8200387 generic-all
|
||||
vmTestbase/nsk/jdi/VirtualMachine/setDefaultStratum/setDefaultStratum002/setDefaultStratum002.java 8200387 generic-all
|
||||
|
||||
vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses026/TestDescription.java 8195627 generic-all
|
||||
vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses028/TestDescription.java 8195627 generic-all
|
||||
vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses030/TestDescription.java 8195627 generic-all
|
||||
|
||||
|
||||
@ -109,4 +109,18 @@ vmTestbase/nsk/monitoring/MemoryPoolMBean/isUsageThresholdExceeded/isexceeded004
|
||||
vmTestbase/nsk/monitoring/MemoryPoolMBean/isUsageThresholdExceeded/isexceeded005/TestDescription.java 8153598 generic-all
|
||||
vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/Deadlock/JavaDeadlock001/TestDescription.java 8060733 generic-all
|
||||
|
||||
vmTestbase/nsk/jdi/AttachingConnector/attachnosuspend/attachnosuspend001/TestDescription.java 8153613 generic-all
|
||||
vmTestbase/nsk/jdi/ThreadReference/frameCount/framecount001/TestDescription.java 6530620 generic-all
|
||||
vmTestbase/nsk/jdi/ThreadReference/isSuspended/issuspended002/TestDescription.java 4903717 generic-all
|
||||
vmTestbase/nsk/jdi/ThreadReference/resume/resume001/TestDescription.java 8072701 generic-all
|
||||
vmTestbase/nsk/jdi/ThreadReference/stop/stop001/TestDescription.java 7034630 generic-all
|
||||
vmTestbase/nsk/jdi/BScenarios/hotswap/tc10x001/TestDescription.java 8013728 generic-all
|
||||
vmTestbase/nsk/jdi/BScenarios/multithrd/tc02x004/TestDescription.java 4751860 generic-all
|
||||
vmTestbase/nsk/jdi/EventRequest/setEnabled/setenabled003/TestDescription.java 8066993 generic-all
|
||||
vmTestbase/nsk/jdi/StackFrame/_bounds_/bounds001/TestDescription.java 6604963 generic-all
|
||||
vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses021/TestDescription.java 8065773 generic-all
|
||||
vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses023/TestDescription.java 8065773 generic-all
|
||||
vmTestbase/nsk/jdi/EventQueue/remove_l/remove_l005/TestDescription.java 8068225 generic-all
|
||||
vmTestbase/nsk/jdi/stress/ClassPrepareEvents/ClassPrepareEvents001/ClassPrepareEvents001.java 6426321 generic-all
|
||||
|
||||
#############################################################################
|
||||
|
||||
@ -587,4 +587,565 @@ vmTestbase_nsk_monitoring_quick = \
|
||||
vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/noAllocationTest_proxy_default/TestDescription.java \
|
||||
vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadAllocatedBytes/noAllocationTest_proxy_custom/TestDescription.java
|
||||
|
||||
# JDI tests
|
||||
vmTestbase_nsk_jdi = \
|
||||
vmTestbase/nsk/jdi
|
||||
|
||||
vmTestbase_nsk_jdi_quick = \
|
||||
vmTestbase/nsk/jdi/Argument/description/description001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/Argument/isValid/isvalid001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/Argument/isValid/isvalid002/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/Argument/isValid/isvalid003/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/Argument/isValid/isvalid004/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/Argument/isValid/isvalid005/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/Argument/name/name001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/Argument/value/value001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/Argument/value/value002/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/Argument/value/value003/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/Argument/setValue/setvalue001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/Argument/setValue/setvalue002/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/Argument/mustSpecify/mustspecify001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/AttachingConnector/attach/attach002/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/BooleanArgument/booleanValue/booleanvalue001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/BooleanArgument/booleanValue/booleanvalue002/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/BooleanArgument/isValid/isvalid001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/BooleanArgument/isValid/isvalid002/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/BooleanArgument/setValue/setvalue001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/BooleanArgument/setValue/setvalue002/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/BooleanArgument/stringValueOf/stringvalueof001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/BooleanArgument/stringValueOf/stringvalueof002/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/ClassLoaderReference/definedClasses/definedclasses001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/ClassLoaderReference/definedClasses/definedclasses002/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/ClassLoaderReference/definedClasses/definedclasses003/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/ClassLoaderReference/definedClasses/definedclasses004/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/ClassLoaderReference/definedClasses/definedclasses005/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/ClassLoaderReference/visibleClasses/visibleclasses002/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/Connector/defaultArguments/defaultArguments001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/Connector/defaultArguments/defaultArguments002/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/Connector/defaultArguments/defaultArguments003/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/Connector/description/description001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/Connector/name/name001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/Connector/transport/transport001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/FloatValue/compareTo/compareto001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/IntegerArgument/intValue/intvalue001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/IntegerArgument/intValue/intvalue002/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/IntegerArgument/isValid/isvalid001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/IntegerArgument/isValid/isvalid002/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/IntegerArgument/isValid/isvalid003/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/IntegerArgument/max/max001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/IntegerArgument/min/min001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/IntegerArgument/setValue/setvalue001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/IntegerArgument/stringValueOf/stringvalueof001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/IntegerValue/compareTo/compareto001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/LaunchingConnector/launch/launch001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/LaunchingConnector/launch/launch002/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/LaunchingConnector/launch/launch004/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/ListeningConnector/accept/accept001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/ListeningConnector/accept/accept002/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/ListeningConnector/stopListening/stoplis001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/ListeningConnector/supportsMultipleConnections/supportsmultipleconnections001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/ListeningConnector/listennosuspend/listennosuspend001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/LongValue/compareTo/compareto001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/ObjectReference/entryCount/entrycount002/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/ObjectReference/owningThread/owningthread002/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/ObjectReference/waitingThreads/waitingthreads002/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/ObjectReference/waitingThreads/waitingthreads003/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/ObjectReference/waitingThreads/waitingthreads004/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/ReferenceType/isVerified/isverified003/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/SelectedArgument/choices/choices001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/SelectedArgument/isValid/isvalid001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/SelectedArgument/isValid/isvalid002/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/ShortType/_itself_/shorttype001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/ShortValue/compareTo/compareto001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/StackFrame/thisObject/thisobject002/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/StackFrame/thread/thread001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/StackFrame/visibleVariableByName/visiblevarbyname001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/StackFrame/visibleVariableByName/visiblevarbyname002/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/StackFrame/visibleVariables/visiblevariables001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/StackFrame/visibleVariables/visiblevariables002/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/StepEvent/_itself_/stepevent001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/StepEvent/_itself_/stepevent002/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/StepRequest/addClassExclusionFilter/filter001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/StepRequest/addClassExclusionFilter/filter002/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/StepRequest/addClassFilter_s/filter_s001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/StepRequest/addClassFilter_s/filter_s002/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/StepRequest/addClassFilter_rt/filter_rt001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/StepRequest/addClassFilter_rt/filter_rt002/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/StepRequest/depth/depth001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/StepRequest/depth/depth002/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/StepRequest/depth/depth003/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/StepRequest/size/size001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/StepRequest/size/size002/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/StepRequest/thread/thread001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/StringArgument/isValid/isvalid001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/StringArgument/isValid/isvalid002/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/StringArgument/isValid/isvalid003/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/StringReference/value/value001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/ThreadDeathEvent/thread/thread001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/ThreadDeathRequest/addThreadFilter/addthreadfilter001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/ThreadDeathRequest/addThreadFilter/addthreadfilter002/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/ThreadDeathRequest/addThreadFilter/addthreadfilter003/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/ThreadDeathRequest/addThreadFilter/addthreadfilter004/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/ThreadDeathRequest/addThreadFilter/addthreadfilter005/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/ThreadGroupReference/name/name001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/ThreadGroupReference/parent/parent001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/ThreadGroupReference/resume/resume001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/ThreadGroupReference/suspend/suspend001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/ThreadGroupReference/threadGroups/threadgroups001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/ThreadGroupReference/threads/threads001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/ThreadReference/frame/frame001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/ThreadReference/frameCount/framecount001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/ThreadReference/frames/frames001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/ThreadReference/frames_ii/frames_ii002/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/ThreadReference/isAtBreakpoint/isatbreakpoint001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/ThreadReference/isSuspended/issuspended001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/ThreadReference/isSuspended/issuspended003/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/ThreadReference/isSuspended/issuspended004/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/ThreadReference/name/name001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/ThreadReference/ownedMonitors/ownedmonitors001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/ThreadReference/suspendCount/suspendcount001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/ThreadReference/threadGroup/threadgroup001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/ThreadReference/currentContendedMonitor/currentcm001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/ThreadReference/interrupt/interrupt001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/ThreadReference/resume/resume001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/ThreadReference/status/status003/status003.java \
|
||||
vmTestbase/nsk/jdi/ThreadReference/status/status004/status004.java \
|
||||
vmTestbase/nsk/jdi/ThreadReference/status/status005/status005.java \
|
||||
vmTestbase/nsk/jdi/ThreadReference/status/status006/status006.java \
|
||||
vmTestbase/nsk/jdi/ThreadReference/status/status007/status007.java \
|
||||
vmTestbase/nsk/jdi/ThreadReference/status/status008/status008.java \
|
||||
vmTestbase/nsk/jdi/ThreadReference/stop/stop001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/ThreadStartRequest/addThreadFilter/addthreadfilter001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/ThreadStartRequest/addThreadFilter/addthreadfilter002/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/ThreadStartRequest/addThreadFilter/addthreadfilter003/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/ThreadStartRequest/addThreadFilter/addthreadfilter004/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/ThreadStartRequest/addThreadFilter/addthreadfilter005/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/Transport/name/name001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/Type/name/name001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/Type/name/name002/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/Type/name/name003/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/Type/signature/signature001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/Type/signature/signature002/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/Type/signature/signature003/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/TypeComponent/declaringType/decltype001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/TypeComponent/declaringType/decltype002/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/TypeComponent/declaringType/decltype003/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/TypeComponent/declaringType/decltype007/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/TypeComponent/declaringType/decltype008/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/TypeComponent/isFinal/isfinal001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/TypeComponent/isFinal/isfinal003/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/TypeComponent/isStatic/isstatic001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/TypeComponent/isStatic/isstatic003/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/TypeComponent/isSynthetic/issynthetic001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/TypeComponent/isSynthetic/issynthetic002/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/TypeComponent/name/name001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/TypeComponent/name/name003/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/TypeComponent/signature/sign001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/TypeComponent/signature/sign003/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/Value/type/type001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/Value/type/type002/type002.java \
|
||||
vmTestbase/nsk/jdi/Value/type/type003/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/Value/_itself_/value001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/VirtualMachine/allClasses/allclasses001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/VirtualMachine/allClasses/allclasses002/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/VirtualMachine/allThreads/allthreads001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/VirtualMachine/canGetBytecodes/cangetbytecodes001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/VirtualMachine/canGetCurrentContendedMonitor/cangccm001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/VirtualMachine/canGetMonitorInfo/cangetmonitorinfo001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/VirtualMachine/canGetOwnedMonitorInfo/cangetinfo001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/VirtualMachine/canGetSyntheticAttribute/cangetattr001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/VirtualMachine/canWatchFieldAccess/canwatchaccess001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/VirtualMachine/canWatchFieldModification/canwatchmod001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/VirtualMachine/classesByName/classesbyname001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/VirtualMachine/description/description001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/VirtualMachine/eventQueue/eventqueue001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/VirtualMachine/eventRequestManager/eventrmanager001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/VirtualMachine/exit/exit001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/VirtualMachine/exit/exit002/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/VirtualMachine/mirrorOf_bool/mirrorof_bool001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/VirtualMachine/mirrorOf_byte/mirrorof_byte001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/VirtualMachine/mirrorOf_char/mirrorof_char001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/VirtualMachine/mirrorOf_double/mirrorof_double001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/VirtualMachine/mirrorOf_float/mirrorof_float001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/VirtualMachine/mirrorOf_int/mirrorof_int001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/VirtualMachine/mirrorOf_long/mirrorof_long001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/VirtualMachine/mirrorOf_short/mirrorof_short001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/VirtualMachine/mirrorOf_string/mirrorof_string001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/VirtualMachine/name/name001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/VirtualMachine/process/process001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/VirtualMachine/topLevelThreadGroups/toplevelgroups001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/VirtualMachine/version/version001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/VirtualMachineManager/allConnectors/allconnectors001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/VirtualMachineManager/attachingConnectors/attaching001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/VirtualMachineManager/connectedVirtualMachines/convm001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/VirtualMachineManager/connectedVirtualMachines/convm002/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/VirtualMachineManager/connectedVirtualMachines/convm003/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/VirtualMachineManager/defaultConnector/default001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/VirtualMachineManager/launchingConnectors/launching001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/VirtualMachineManager/listeningConnectors/listening001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/VirtualMachineManager/majorInterfaceVersion/major001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/VirtualMachineManager/minorInterfaceVersion/minor001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/VoidType/_itself_/voidtype001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/VoidValue/equals/equals001/equals001.java \
|
||||
vmTestbase/nsk/jdi/VoidValue/hashCode/hashcode001/hashcode001.java \
|
||||
vmTestbase/nsk/jdi/VMDeathEvent/_itself_/vmdeath001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/VMDeathEvent/_itself_/vmdeath002/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/VMDeathEvent/_itself_/vmdeath003/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/VMDisconnectEvent/_itself_/disconnect001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/VMDisconnectEvent/_itself_/disconnect002/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/VMDisconnectEvent/_itself_/disconnect003/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/VMStartEvent/thread/thread001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/WatchpointEvent/object/object001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/WatchpointEvent/field/field001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/WatchpointEvent/valueCurrent/valuecur001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/WatchpointRequest/addClassExclusionFilter/filter001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/WatchpointRequest/addClassExclusionFilter/filter002/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/WatchpointRequest/addClassExclusionFilter/filter003/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/WatchpointRequest/addClassExclusionFilter/filter004/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/WatchpointRequest/addClassFilter_s/filter_s001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/WatchpointRequest/addClassFilter_s/filter_s002/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/WatchpointRequest/addClassFilter_s/filter_s003/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/WatchpointRequest/addClassFilter_s/filter_s004/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/WatchpointRequest/addClassFilter_rt/filter_rt001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/WatchpointRequest/addClassFilter_rt/filter_rt002/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/WatchpointRequest/addClassFilter_rt/filter_rt003/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/WatchpointRequest/addClassFilter_rt/filter_rt004/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/WatchpointRequest/addClassFilter_rt/filter_rt005/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/WatchpointRequest/addClassFilter_rt/filter_rt006/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/WatchpointRequest/addThreadFilter/addthreadfilter001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/WatchpointRequest/addThreadFilter/addthreadfilter002/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/WatchpointRequest/addThreadFilter/addthreadfilter003/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/WatchpointRequest/addThreadFilter/addthreadfilter004/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/WatchpointRequest/addThreadFilter/addthreadfilter005/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/WatchpointRequest/addThreadFilter/addthreadfilter006/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/WatchpointRequest/addThreadFilter/addthreadfilter007/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/WatchpointRequest/addThreadFilter/addthreadfilter008/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/WatchpointRequest/field/field001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/WatchpointRequest/field/field002/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/AttachingConnector/attach/attach003/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/ClassObjectReference/toString/tostring001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod003/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod010/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod011/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod012/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod013/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod014/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/ClassType/newInstance/newinstance009/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/ClassType/setValue/setvalue006/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/ClassType/setValue/setvalue007/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/Connector/_bounds_/bounds001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/Connector/toString/tostring001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/BScenarios/hotswap/tc01x001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/BScenarios/hotswap/tc01x002/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/BScenarios/hotswap/tc02x001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/BScenarios/hotswap/tc02x002/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/BScenarios/hotswap/tc03x001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/BScenarios/hotswap/tc04x001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/BScenarios/hotswap/tc04x002/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/BScenarios/hotswap/tc05x002/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/BScenarios/hotswap/tc06x001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/BScenarios/hotswap/tc07x001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/BScenarios/hotswap/tc08x001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/BScenarios/hotswap/tc09x001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/BScenarios/hotswap/tc09x002/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/BScenarios/hotswap/tc10x001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/BScenarios/hotswap/tc10x002/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/BScenarios/multithrd/tc01x001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/BScenarios/multithrd/tc02x001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/BScenarios/multithrd/tc02x002/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/BScenarios/multithrd/tc02x003/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/BScenarios/multithrd/tc02x004/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/BScenarios/multithrd/tc03x001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/BScenarios/multithrd/tc04x001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/BScenarios/singlethrd/tc01x001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/BScenarios/singlethrd/tc01x002/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/BScenarios/singlethrd/tc02x001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/BScenarios/singlethrd/tc03x001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/BScenarios/singlethrd/tc03x002/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/BScenarios/singlethrd/tc03x003/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/BScenarios/singlethrd/tc04x001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/BScenarios/singlethrd/tc05x001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/Event/equals/equals001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/Event/hashCode/hashcode001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/EventQueue/hashCode/hashcode001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/EventRequest/disable/disable003/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/EventRequest/hashCode/hashcode001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/EventRequestManager/deleteEventRequest/delevtreq003/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/EventRequestManager/hashCode/hashcode001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/EventSet/resume/resume011/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/EventSet/toString/tostring001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/EventSet/virtualMachine/virtualmachine001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/LocalVariable/toString/tostring001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/Method/_bounds_/bounds001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/Method/isObsolete/isobsolete003/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/MethodEntryRequest/_bounds_/filters001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/MethodExitRequest/_bounds_/filters001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/Mirror/hashCode/hashcode001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/ObjectReference/_bounds_/bounds001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/ObjectReference/_bounds_/bounds002/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod002/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod003/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod004/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod005/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod007/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod008/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod009/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod010/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod011/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod012/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod013/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod014/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/ObjectReference/setValue/setvalue002/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/ObjectReference/setValue/setvalue003/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/ObjectReference/setValue/setvalue004/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/ObjectReference/setValue/setvalue005/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/ReferenceType/_bounds_/bounds001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/ReferenceType/_bounds_/bounds002/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/ReferenceType/allFields/allfields005/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/ReferenceType/allLineLocations/alllinelocations002/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/ReferenceType/allLineLocations_ss/alllinelocations_ss002/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/ReferenceType/allMethods/allmethods005/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/ReferenceType/fields/fields005/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/ReferenceType/getValue/getvalue004/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/ReferenceType/getValue/getvalue005/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/ReferenceType/getValues/getvalues002/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/ReferenceType/getValues/getvalues003/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/ReferenceType/locationsOfLine_i/locationsofline_i002/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/ReferenceType/locationsOfLine_ssi/locationsofline_ssi002/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/ReferenceType/methods/methods005/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/ReferenceType/sourceName/sourcename004/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/ReferenceType/sourceNames/sourcenames002/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/ReferenceType/sourcePaths/sourcepaths002/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/ReferenceType/visibleFields/visibfield005/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/ReferenceType/visibleMethods/visibmethod006/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/Scenarios/invokeMethod/popframes001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/Scenarios/invokeMethod/redefineclasses001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/StackFrame/_bounds_/bounds002/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/StackFrame/getValue/getvalue003/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/StackFrame/getValues/getvalues003/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/StackFrame/hashCode/hashcode001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/StackFrame/setValue/setvalue005/setvalue005.java \
|
||||
vmTestbase/nsk/jdi/StackFrame/setValue/setvalue006/setvalue006.java \
|
||||
vmTestbase/nsk/jdi/StackFrame/toString/tostring001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/StepRequest/_bounds_/filters001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/StepRequest/addClassFilter_rt/filter_rt003/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/StepRequest/addInstanceFilter/instancefilter001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/StepRequest/addInstanceFilter/instancefilter002/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/StepRequest/addInstanceFilter/instancefilter003/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/StepRequest/addInstanceFilter/instancefilter004/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/ThreadGroupReference/toString/tostring001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/ThreadReference/frames_ii/frames_ii001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/ThreadReference/ownedMonitors/ownedmonitors002/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/ThreadReference/popFrames/popframes001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/ThreadReference/popFrames/popframes002/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/ThreadReference/popFrames/popframes003/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/ThreadReference/popFrames/popframes004/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/ThreadReference/popFrames/popframes005/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/ThreadReference/popFrames/popframes006/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/ThreadReference/popFrames/popframes007/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/ThreadReference/stop/stop002/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/Type/hashCode/hashcode001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/TypeComponent/isPackagePrivate/ispackageprivate001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/TypeComponent/isPrivate/isprivate001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/TypeComponent/isProtected/isprotected001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/TypeComponent/isPublic/ispublic001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/WatchpointEvent/_itself_/wevent001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/WatchpointRequest/_bounds_/filters001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/WatchpointRequest/addInstanceFilter/instancefilter001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/WatchpointRequest/addInstanceFilter/instancefilter002/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/WatchpointRequest/addInstanceFilter/instancefilter003/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/WatchpointRequest/addInstanceFilter/instancefilter004/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/WatchpointRequest/addInstanceFilter/instancefilter005/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/WatchpointRequest/addInstanceFilter/instancefilter006/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/WatchpointRequest/addInstanceFilter/instancefilter007/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/WatchpointRequest/addInstanceFilter/instancefilter008/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/VirtualMachine/canAddMethod/canaddmethod001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/VirtualMachine/canGetSourceDebugExtension/cangetsde001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/VirtualMachine/canPopFrames/canpopframes001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/VirtualMachine/canRedefineClasses/canredefineclasses001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/VirtualMachine/canRequestVMDeathEvent/canreqvmdev001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/VirtualMachine/canUnrestrictedlyRedefineClasses/curc001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/VirtualMachine/canUseInstanceFilters/canusefilters001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/VirtualMachine/getDefaultStratum/getdefaultstratum001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses002/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses003/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses004/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses005/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses006/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses007/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses008/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses009/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses010/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses011/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses012/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses013/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses014/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses015/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses016/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses020/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses022/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses024/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses026/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses027/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses028/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses029/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses030/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses032/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses034/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses035/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/VirtualMachine/setDefaultStratum/setdefaultstratum001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/VoidType/toString/tostring001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/VoidValue/equals/equals002/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/VoidValue/toString/tostring001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/ConstantField/values001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/Accessible/isPackagePrivate/accipp002/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/Accessible/isPrivate/isprivate002/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/Accessible/isProtected/isprotected002/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/Accessible/isPublic/ispublic002/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/Accessible/isPublic/ispublic003/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/Accessible/modifiers/modifiers002/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/ClassType/allInterfaces/allinterfaces002/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/ClassType/interfaces/interfaces002/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod015/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/ClassType/isEnum/isenum001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/ClassType/setValue/setvalue008/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/ClassType/subclasses/subclasses002/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/ClassType/superclass/superclass002/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/Field/isEnumConstant/isenumconstant001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/Field/type/type004/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/Field/typeName/typename002/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/LocalVariable/genericSignature/gensignature001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/Method/arguments/arguments003/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/Method/argumentTypeNames/argumenttypenames003/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/Method/isBridge/isbridge001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/Method/isVarArgs/isvarargs001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/PlugConnectors/AttachConnector/plugAttachConnect001/plugAttachConnect001.java \
|
||||
vmTestbase/nsk/jdi/PlugConnectors/AttachConnector/plugAttachConnect002/plugAttachConnect002.java \
|
||||
vmTestbase/nsk/jdi/PlugConnectors/AttachConnector/plugAttachConnect003/plugAttachConnect003.java \
|
||||
vmTestbase/nsk/jdi/PlugConnectors/LaunchConnector/plugLaunchConnect001/plugLaunchConnect001.java \
|
||||
vmTestbase/nsk/jdi/PlugConnectors/LaunchConnector/plugLaunchConnect002/plugLaunchConnect002.java \
|
||||
vmTestbase/nsk/jdi/PlugConnectors/LaunchConnector/plugLaunchConnect003/plugLaunchConnect003.java \
|
||||
vmTestbase/nsk/jdi/PlugConnectors/ListenConnector/plugListenConnect001/plugListenConnect001.java \
|
||||
vmTestbase/nsk/jdi/PlugConnectors/ListenConnector/plugListenConnect002/plugListenConnect002.java \
|
||||
vmTestbase/nsk/jdi/PlugConnectors/ListenConnector/plugListenConnect003/plugListenConnect003.java \
|
||||
vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect001/plugMultiConnect001.java \
|
||||
vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect002/plugMultiConnect002.java \
|
||||
vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect003/plugMultiConnect003.java \
|
||||
vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect004/plugMultiConnect004.java \
|
||||
vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect005/plugMultiConnect005.java \
|
||||
vmTestbase/nsk/jdi/PlugConnectors/MultiConnectors/plugMultiConnect006/plugMultiConnect006.java \
|
||||
vmTestbase/nsk/jdi/PlugConnectors/TransportService/transportService001/transportService001.java \
|
||||
vmTestbase/nsk/jdi/PlugConnectors/TransportService/transportService002/transportService002.java \
|
||||
vmTestbase/nsk/jdi/PlugConnectors/TransportService/transportService003/transportService003.java \
|
||||
vmTestbase/nsk/jdi/ReferenceType/allFields/allfields006/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/ReferenceType/allMethods/allmethods006/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/ReferenceType/classObject/classobj003/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/ReferenceType/fields/fields006/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/ReferenceType/genericSignature/genericSignature001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/ReferenceType/genericSignature/genericSignature002/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/ReferenceType/isAbstract/isabstract003/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/ReferenceType/isFinal/isfinal002/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/ReferenceType/isInitialized/isinit003/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/ReferenceType/methods/methods006/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/ReferenceType/visibleFields/visibfield006/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/ReferenceType/visibleMethods/visibmethod007/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/TypeComponent/declaringType/decltype009/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/TypeComponent/genericSignature/genericSignature001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/TypeComponent/genericSignature/genericSignature002/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/TypeComponent/isFinal/isfinal004/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/TypeComponent/isStatic/isstatic004/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/VirtualMachine/canBeModified/canbemodified001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/VirtualMachineManager/createVirtualMachine/createVM001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/VirtualMachineManager/createVirtualMachine/createVM002/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/VirtualMachineManager/createVirtualMachine/createVM003/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/VirtualMachineManager/createVirtualMachine/createVM004/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/VirtualMachineManager/createVirtualMachine/createVM005/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/VMCannotBeModifiedEx/_itself_/canntbemod001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/VirtualMachine/instanceCounts/instancecounts001/instancecounts001.java \
|
||||
vmTestbase/nsk/jdi/VirtualMachine/instanceCounts/instancecounts002/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/VirtualMachine/instanceCounts/instancecounts003/instancecounts003.java \
|
||||
vmTestbase/nsk/jdi/VirtualMachine/instanceCounts/instancecounts004/instancecounts004.java \
|
||||
vmTestbase/nsk/jdi/ReferenceType/instances/instances001/instances001.java \
|
||||
vmTestbase/nsk/jdi/ReferenceType/instances/instances002/instances002.java \
|
||||
vmTestbase/nsk/jdi/ReferenceType/instances/instances005/instances005.java \
|
||||
vmTestbase/nsk/jdi/ObjectReference/referringObjects/referringObjects001/referringObjects001.java \
|
||||
vmTestbase/nsk/jdi/ObjectReference/referringObjects/referringObjects002/referringObjects002.java \
|
||||
vmTestbase/nsk/jdi/ObjectReference/referringObjects/referringObjects003/referringObjects003.java \
|
||||
vmTestbase/nsk/jdi/ObjectReference/referringObjects/referringObjects004/referringObjects004.java \
|
||||
vmTestbase/nsk/jdi/ThreadReference/forceEarlyReturn/forceEarlyReturn002/forceEarlyReturn002.java \
|
||||
vmTestbase/nsk/jdi/ThreadReference/forceEarlyReturn/forceEarlyReturn003/forceEarlyReturn003.java \
|
||||
vmTestbase/nsk/jdi/ThreadReference/forceEarlyReturn/forceEarlyReturn004/forceEarlyReturn004.java \
|
||||
vmTestbase/nsk/jdi/ThreadReference/forceEarlyReturn/forceEarlyReturn005/forceEarlyReturn005.java \
|
||||
vmTestbase/nsk/jdi/ThreadReference/forceEarlyReturn/forceEarlyReturn006/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/ThreadReference/forceEarlyReturn/forceEarlyReturn007/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/ThreadReference/forceEarlyReturn/forceEarlyReturn008/forceEarlyReturn008.java \
|
||||
vmTestbase/nsk/jdi/ThreadReference/forceEarlyReturn/forceEarlyReturn009/forceEarlyReturn009.java \
|
||||
vmTestbase/nsk/jdi/ThreadReference/forceEarlyReturn/forceEarlyReturn013/forceEarlyReturn013.java \
|
||||
vmTestbase/nsk/jdi/ThreadReference/forceEarlyReturn/forceEarlyReturn014/forceEarlyReturn014.java \
|
||||
vmTestbase/nsk/jdi/ThreadReference/forceEarlyReturn/forceEarlyReturn015/forceEarlyReturn015.java \
|
||||
vmTestbase/nsk/jdi/ThreadReference/ownedMonitorsAndFrames/ownedMonitorsAndFrames001/ownedMonitorsAndFrames001.java \
|
||||
vmTestbase/nsk/jdi/ThreadReference/ownedMonitorsAndFrames/ownedMonitorsAndFrames002/ownedMonitorsAndFrames002.java \
|
||||
vmTestbase/nsk/jdi/ThreadReference/ownedMonitorsAndFrames/ownedMonitorsAndFrames003/ownedMonitorsAndFrames003.java \
|
||||
vmTestbase/nsk/jdi/ThreadReference/ownedMonitorsAndFrames/ownedMonitorsAndFrames004/ownedMonitorsAndFrames004.java \
|
||||
vmTestbase/nsk/jdi/ThreadReference/ownedMonitorsAndFrames/ownedMonitorsAndFrames005/ownedMonitorsAndFrames005.java \
|
||||
vmTestbase/nsk/jdi/ThreadReference/ownedMonitorsAndFrames/ownedMonitorsAndFrames008/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/MonitorContendedEnteredRequest/addClassExclusionFilter/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/MonitorContendedEnteredRequest/addClassFilter_ClassName/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/MonitorContendedEnteredRequest/addClassFilter_ReferenceType/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/MonitorContendedEnteredRequest/addInstanceFilter/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/MonitorContendedEnteredRequest/addThreadFilter/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/MonitorContendedEnterRequest/addClassExclusionFilter/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/MonitorContendedEnterRequest/addClassFilter_ClassName/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/MonitorContendedEnterRequest/addClassFilter_ReferenceType/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/MonitorContendedEnterRequest/addInstanceFilter/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/MonitorContendedEnterRequest/addThreadFilter/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/MonitorWaitRequest/addClassExclusionFilter/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/MonitorWaitRequest/addClassFilter_ClassName/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/MonitorWaitRequest/addClassFilter_ReferenceType/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/MonitorWaitRequest/addInstanceFilter/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/MonitorWaitRequest/addThreadFilter/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/MonitorWaitedRequest/addClassExclusionFilter/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/MonitorWaitedRequest/addClassFilter_ClassName/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/MonitorWaitedRequest/addClassFilter_ReferenceType/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/MonitorWaitedRequest/addInstanceFilter/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/MonitorWaitedRequest/addThreadFilter/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/stress/ClassPrepareEvents/ClassPrepareEvents001/ClassPrepareEvents001.java \
|
||||
vmTestbase/nsk/jdi/ClassPrepareRequest/addSourceNameFilter/addSourceNameFilter001/addSourceNameFilter001.java \
|
||||
vmTestbase/nsk/jdi/ClassPrepareRequest/addSourceNameFilter/addSourceNameFilter002/addSourceNameFilter002.java \
|
||||
vmTestbase/nsk/jdi/VMOutOfMemoryException/VMOutOfMemoryException001/VMOutOfMemoryException001.java \
|
||||
vmTestbase/nsk/jdi/stress/serial/forceEarlyReturn001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/stress/serial/heapwalking001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/stress/serial/monitorEvents001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/stress/serial/ownedMonitorsAndFrames001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/stress/serial/mixed001/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/stress/serial/forceEarlyReturn002/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/stress/serial/monitorEvents002/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/stress/serial/ownedMonitorsAndFrames002/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/VirtualMachine/setDefaultStratum/setDefaultStratum002/setDefaultStratum002.java \
|
||||
vmTestbase/nsk/jdi/ReferenceType/allLineLocations_ss/allLineLocations_ss003/allLineLocations_ss003.java \
|
||||
vmTestbase/nsk/jdi/ReferenceType/allLineLocations_ss/allLineLocations_ss004/allLineLocations_ss004.java \
|
||||
vmTestbase/nsk/jdi/Method/allLineLocations_ss/allLineLocations_ss002/allLineLocations_ss002.java \
|
||||
vmTestbase/nsk/jdi/Method/allLineLocations_ss/allLineLocations_ss003/allLineLocations_ss003.java \
|
||||
vmTestbase/nsk/jdi/ReferenceType/locationsOfLine_ssi/locationsOfLine_ssi003/locationsOfLine_ssi003.java \
|
||||
vmTestbase/nsk/jdi/ReferenceType/locationsOfLine_ssi/locationsOfLine_ssi004/locationsOfLine_ssi004.java \
|
||||
vmTestbase/nsk/jdi/Method/locationsOfLine_ssi/locationsOfLine_ssi002/locationsOfLine_ssi002.java \
|
||||
vmTestbase/nsk/jdi/Method/locationsOfLine_ssi/locationsOfLine_ssi003/locationsOfLine_ssi003.java \
|
||||
vmTestbase/nsk/jdi/ReferenceType/sourceNames/sourceNames003/sourceNames003.java \
|
||||
vmTestbase/nsk/jdi/ReferenceType/sourcePaths/sourcePaths003/sourcePaths003.java \
|
||||
vmTestbase/nsk/jdi/ReferenceType/availableStrata/availableStrata002/availableStrata002.java \
|
||||
vmTestbase/nsk/jdi/ReferenceType/defaultStratum/defaultStratum002/defaultStratum002.java \
|
||||
vmTestbase/nsk/jdi/Location/lineNumber_s/lineNumber_s002/lineNumber_s002.java \
|
||||
vmTestbase/nsk/jdi/Location/sourceName_s/sourceName_s002/sourceName_s002.java \
|
||||
vmTestbase/nsk/jdi/Location/sourcePath_s/sourcePath_s002/sourcePath_s002.java \
|
||||
vmTestbase/nsk/jdi/AttachingConnector/attach/attach005/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/AttachingConnector/attachnosuspend/attachnosuspend002/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/AttachingConnector/attachnosuspend/attachnosuspend003/TestDescription.java \
|
||||
vmTestbase/nsk/jdi/MethodExitEvent/returnValue/returnValue001/returnValue001.java \
|
||||
vmTestbase/nsk/jdi/MethodExitEvent/returnValue/returnValue002/returnValue002.java \
|
||||
vmTestbase/nsk/jdi/MethodExitEvent/returnValue/returnValue003/returnValue003.java \
|
||||
vmTestbase/nsk/jdi/MethodExitEvent/returnValue/returnValue004/returnValue004.java \
|
||||
vmTestbase/nsk/jdi/StackFrame/getArgumentValues/getArgumentValues001/getArgumentValues001.java \
|
||||
vmTestbase/nsk/jdi/StackFrame/getArgumentValues/getArgumentValues002/getArgumentValues002.java \
|
||||
vmTestbase/nsk/jdi/StackFrame/getArgumentValues/getArgumentValues003/getArgumentValues003.java
|
||||
|
||||
|
||||
@ -0,0 +1,425 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 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 nsk.jdi.AccessWatchpointEvent._itself_;
|
||||
|
||||
import com.sun.jdi.Field;
|
||||
import com.sun.jdi.Method;
|
||||
import com.sun.jdi.ReferenceType;
|
||||
import com.sun.jdi.VirtualMachine;
|
||||
import com.sun.jdi.request.AccessWatchpointRequest;
|
||||
import com.sun.jdi.request.BreakpointRequest;
|
||||
import com.sun.jdi.request.EventRequestManager;
|
||||
import com.sun.jdi.VMDisconnectedException;
|
||||
import com.sun.jdi.VMMismatchException;
|
||||
import com.sun.jdi.event.*;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.io.*;
|
||||
|
||||
import nsk.share.*;
|
||||
import nsk.share.jpda.*;
|
||||
import nsk.share.jdi.*;
|
||||
|
||||
/**
|
||||
* The test checks that the JDI method
|
||||
* <b>com.sun.jdi.request.AccessWatchpointEvent.createAccessWatchpointRequest()</b>
|
||||
* properly creates new disabled watchpoints which watch accesses to
|
||||
* the fields of different types.
|
||||
* A debugger part of the test checks that:
|
||||
* <li>all created watchpoint requests are disabled
|
||||
* <li>after the watchpoint requests activation, all events corresponding
|
||||
* to them, are properly generated.
|
||||
*/
|
||||
public class awevent001 {
|
||||
public static final int PASSED = 0;
|
||||
public static final int FAILED = 2;
|
||||
public static final int JCK_STATUS_BASE = 95;
|
||||
static final String DEBUGGEE_CLASS =
|
||||
"nsk.jdi.AccessWatchpointEvent._itself_.awevent001t";
|
||||
static final String COMMAND_READY = "ready";
|
||||
static final String COMMAND_QUIT = "quit";
|
||||
static final String COMMAND_BREAKPOINT = "breakpoint";
|
||||
static final String COMMAND_RUN1 = "run1";
|
||||
static final int FLDS_NUM = 9; // number of debuggee's fields
|
||||
static final String COMMAND_RUN[] = {
|
||||
"run1", "run2", "run3", "run4",
|
||||
"run5", "run6", "run7", "run8", "run9"
|
||||
};
|
||||
static final String DEBUGGEE_FLDS[][] = {
|
||||
{"byte", "byteFld"},
|
||||
{"short", "shortFld"},
|
||||
{"int", "intFld"},
|
||||
{"long", "longFld"},
|
||||
{"float", "floatFld"},
|
||||
{"double", "doubleFld"},
|
||||
{"char", "charFld"},
|
||||
{"boolean", "booleanFld"},
|
||||
{"java.lang.String", "strFld"}
|
||||
};
|
||||
private volatile int accFCount[] = {
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0
|
||||
};
|
||||
|
||||
private ArgumentHandler argHandler;
|
||||
private Log log;
|
||||
private IOPipe pipe;
|
||||
private Debugee debuggee;
|
||||
private VirtualMachine vm;
|
||||
private EventListener elThread;
|
||||
private volatile AccessWatchpointRequest awpRequest[];
|
||||
private volatile int tot_res = PASSED;
|
||||
private volatile boolean breakPointReceived = false;
|
||||
|
||||
// for notification a main thread about received events
|
||||
private Object gotEvent = new Object();
|
||||
|
||||
public static void main (String argv[]) {
|
||||
System.exit(run(argv,System.out) + JCK_STATUS_BASE);
|
||||
}
|
||||
|
||||
public static int run(String argv[], PrintStream out) {
|
||||
return new awevent001().runIt(argv, out);
|
||||
}
|
||||
|
||||
private int runIt(String args[], PrintStream out) {
|
||||
argHandler = new ArgumentHandler(args);
|
||||
log = new Log(out, argHandler);
|
||||
Binder binder = new Binder(argHandler, log);
|
||||
ReferenceType rType;
|
||||
List fields;
|
||||
String cmd;
|
||||
|
||||
debuggee = binder.bindToDebugee(DEBUGGEE_CLASS);
|
||||
pipe = debuggee.createIOPipe();
|
||||
debuggee.redirectStderr(log, "awevent001t.err> ");
|
||||
vm = debuggee.VM();
|
||||
EventRequestManager erManager = vm.eventRequestManager();
|
||||
debuggee.resume();
|
||||
cmd = pipe.readln();
|
||||
if (!cmd.equals(COMMAND_READY)) {
|
||||
log.complain("TEST BUG: unknown debuggee's command: "
|
||||
+ cmd);
|
||||
tot_res = FAILED;
|
||||
return quitDebuggee();
|
||||
}
|
||||
|
||||
if ( !vm.canWatchFieldAccess() ) {
|
||||
log.display(" TEST CANCELLED due to: vm.canWatchFieldAccess() == false");
|
||||
return quitDebuggee();
|
||||
}
|
||||
|
||||
// Create testing requests
|
||||
if ((rType = debuggee.classByName(DEBUGGEE_CLASS)) == null) {
|
||||
log.complain("TEST FAILURE: Method Debugee.classByName() returned null");
|
||||
tot_res = FAILED;
|
||||
return quitDebuggee();
|
||||
}
|
||||
try {
|
||||
fields = rType.allFields();
|
||||
} catch (Exception e) {
|
||||
log.complain("TEST FAILURE: allFields: caught " + e);
|
||||
tot_res = FAILED;
|
||||
return quitDebuggee();
|
||||
}
|
||||
if (createRequests(erManager, fields, rType) == FAILED) {
|
||||
tot_res = FAILED;
|
||||
return quitDebuggee();
|
||||
}
|
||||
|
||||
// Create a thread listening JDI events
|
||||
elThread = new EventListener();
|
||||
elThread.setPriority(Thread.NORM_PRIORITY + 2);
|
||||
synchronized(gotEvent) {
|
||||
elThread.start();
|
||||
|
||||
// Check that all created AccessWatchpointRequests are disabled
|
||||
log.display("\na) Getting disabled requested AccessWatchpointEvents...");
|
||||
if (checkEvents(false) != PASSED) {
|
||||
return FAILED;
|
||||
}
|
||||
|
||||
// Stop at the breakpoint so we can verify that there were no AccessWatchPointEvent
|
||||
if (sendCommand(COMMAND_BREAKPOINT, true) != PASSED) {
|
||||
return FAILED;
|
||||
}
|
||||
if (!breakPointReceived) {
|
||||
log.display("TEST FAILED: Did not receive the breakpoint event.");
|
||||
return FAILED;
|
||||
}
|
||||
|
||||
// Check that no AccessWatchpoint events occurred
|
||||
for (int i=0; i<FLDS_NUM; i++) {
|
||||
if (accFCount[i] != 0) {
|
||||
log.complain("TEST FAILED: got AccessWatchpointEvent for the following field:\n\t"
|
||||
+ DEBUGGEE_FLDS[i][0] + " " + DEBUGGEE_FLDS[i][1]
|
||||
+ "\n\tbut a corresponding request, created by EventRequestManager.createAccessWatchpointRequest(), should by disabled");
|
||||
tot_res = FAILED;
|
||||
} else
|
||||
log.display("\nTEST PASSED: no event for the disabled AccessWatchpointRequest #"
|
||||
+ i);
|
||||
}
|
||||
|
||||
// Check that all events corresponding requested AccessWatchpointRequest
|
||||
// are properly generated
|
||||
log.display("\nb) Getting enabled requested AccessWatchpointEvents...");
|
||||
for (int i=0; i<FLDS_NUM; i++) {
|
||||
if (awpRequest[i] != null) {
|
||||
awpRequest[i].enable();
|
||||
} else {
|
||||
log.complain("TEST FAILED: AccessWatchpointRequest object #"
|
||||
+ i + " is null.\n\t"
|
||||
+ "It means that appropriate AccessWatchpoint request has not been really created");
|
||||
tot_res = FAILED;
|
||||
}
|
||||
}
|
||||
checkEvents(true);
|
||||
|
||||
// Finish the test
|
||||
for (int i=0; i<FLDS_NUM; i++) {
|
||||
if (awpRequest[i] != null) {
|
||||
awpRequest[i].disable();
|
||||
}
|
||||
}
|
||||
}
|
||||
return quitDebuggee();
|
||||
}
|
||||
|
||||
private int createRequests(EventRequestManager erManager,
|
||||
List fields,
|
||||
ReferenceType debuggeeType) {
|
||||
Field fld = null;
|
||||
int i = 0;
|
||||
|
||||
awpRequest =
|
||||
new AccessWatchpointRequest[FLDS_NUM];
|
||||
for (i=0; i<FLDS_NUM; i++) {
|
||||
boolean notFound = true;
|
||||
Iterator iter = fields.iterator();
|
||||
while (iter.hasNext()) {
|
||||
fld = (Field) iter.next();
|
||||
if (fld.name().equals(DEBUGGEE_FLDS[i][1]) &&
|
||||
fld.typeName().equals(DEBUGGEE_FLDS[i][0])) {
|
||||
log.display("\nCreating AccessWatchpointRequest #"
|
||||
+ i + " for the debuggee's field:\n\t"
|
||||
+ fld.typeName() + " " + fld.name());
|
||||
try {
|
||||
awpRequest[i] =
|
||||
erManager.createAccessWatchpointRequest(fld);
|
||||
awpRequest[i].setSuspendPolicy(AccessWatchpointRequest.SUSPEND_NONE);
|
||||
} catch (NullPointerException e) {
|
||||
log.complain("TEST FAILED: createAccessWatchpointRequest: caught "
|
||||
+ e);
|
||||
tot_res = FAILED;
|
||||
return FAILED;
|
||||
} catch(VMMismatchException e) {
|
||||
log.complain("TEST FAILED: createAccessWatchpointRequest: caught "
|
||||
+ e);
|
||||
tot_res = FAILED;
|
||||
return FAILED;
|
||||
}
|
||||
notFound = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (notFound) {
|
||||
log.complain("TEST FAILED: found unexpected debuggee's field:\n\t"
|
||||
+ fld.typeName() + " " + fld.name());
|
||||
tot_res = FAILED;
|
||||
return FAILED;
|
||||
}
|
||||
}
|
||||
log.display("\nCreating BreakpointRequest for the debuggee's method: breakpoint");
|
||||
try {
|
||||
Method bpMethod = debuggeeType.methodsByName("breakpoint").get(0);
|
||||
BreakpointRequest bpr = erManager.createBreakpointRequest(bpMethod.location());
|
||||
bpr.enable();
|
||||
} catch(Exception e) {
|
||||
log.complain("TEST FAILED: createBreakpointRequest: caught "
|
||||
+ e);
|
||||
tot_res = FAILED;
|
||||
return FAILED;
|
||||
}
|
||||
return PASSED;
|
||||
}
|
||||
|
||||
private int sendCommand(String cmd, boolean waitForEvent) {
|
||||
String token = null;
|
||||
|
||||
log.display("\nSending the command \""
|
||||
+ cmd + "\" to a debuggee");
|
||||
pipe.println(cmd);
|
||||
|
||||
// wait for a requested event
|
||||
if (waitForEvent) {
|
||||
try {
|
||||
gotEvent.wait(argHandler.getWaitTime() * 60 * 1000);
|
||||
} catch (InterruptedException e) {
|
||||
log.complain("TEST FAILURE: waiting for a requested Event"
|
||||
+ ": caught " + e);
|
||||
e.printStackTrace();
|
||||
tot_res = FAILED;
|
||||
return quitDebuggee();
|
||||
}
|
||||
log.display("Notification about the Event"
|
||||
+ " received,\n\tor time has elapsed");
|
||||
}
|
||||
|
||||
if ((token = pipe.readln()) == null) {
|
||||
log.complain("TEST FAILURE: debuggee's reply is empty, probably due to the VM crash");
|
||||
tot_res = FAILED;
|
||||
return quitDebuggee();
|
||||
}
|
||||
if (!token.equals(COMMAND_READY)) {
|
||||
log.complain("TEST BUG: unknown debuggee's command: " + token);
|
||||
tot_res = FAILED;
|
||||
return quitDebuggee();
|
||||
}
|
||||
else log.display("Debuggee's reply received: "
|
||||
+ token);
|
||||
return PASSED;
|
||||
}
|
||||
|
||||
private int checkEvents(boolean shouldBe) {
|
||||
for (int i=0; i<FLDS_NUM; i++) {
|
||||
accFCount[i] = 0;
|
||||
if (sendCommand(COMMAND_RUN[i], shouldBe) == FAILED)
|
||||
return FAILED;
|
||||
if (shouldBe) {
|
||||
if (accFCount[i] != 0) {
|
||||
log.display("Got expected AccessWatchpointEvent for the following debuggee's field:\n\t"
|
||||
+ DEBUGGEE_FLDS[i][0] + " " + DEBUGGEE_FLDS[i][1]);
|
||||
} else {
|
||||
log.complain("TEST FAILED: no AccessWatchpointEvent for the following debuggee's field:\n\t"
|
||||
+ DEBUGGEE_FLDS[i][0] + " " + DEBUGGEE_FLDS[i][1]);
|
||||
tot_res = FAILED;
|
||||
}
|
||||
}
|
||||
}
|
||||
return PASSED;
|
||||
}
|
||||
|
||||
private int quitDebuggee() {
|
||||
if (elThread != null) {
|
||||
elThread.isConnected = false;
|
||||
try {
|
||||
if (elThread.isAlive())
|
||||
elThread.join();
|
||||
} catch (InterruptedException e) {
|
||||
log.complain("TEST INCOMPLETE: caught InterruptedException "
|
||||
+ e);
|
||||
tot_res = FAILED;
|
||||
}
|
||||
}
|
||||
|
||||
pipe.println(COMMAND_QUIT);
|
||||
debuggee.waitFor();
|
||||
int debStat = debuggee.getStatus();
|
||||
if (debStat != (JCK_STATUS_BASE + PASSED)) {
|
||||
log.complain("TEST FAILED: debuggee's process finished with status: "
|
||||
+ debStat);
|
||||
tot_res = FAILED;
|
||||
} else
|
||||
log.display("Debuggee's process finished with status: "
|
||||
+ debStat);
|
||||
|
||||
return tot_res;
|
||||
}
|
||||
|
||||
class EventListener extends Thread {
|
||||
public volatile boolean isConnected = true;
|
||||
|
||||
public void run() {
|
||||
try {
|
||||
do {
|
||||
EventSet eventSet = vm.eventQueue().remove(10);
|
||||
if (eventSet != null) { // there is not a timeout
|
||||
EventIterator it = eventSet.eventIterator();
|
||||
while (it.hasNext()) {
|
||||
Event event = it.nextEvent();
|
||||
if (event instanceof VMDeathEvent) {
|
||||
tot_res = FAILED;
|
||||
isConnected = false;
|
||||
log.complain("TEST FAILED: caught unexpected VMDeathEvent");
|
||||
} else if (event instanceof VMDisconnectEvent) {
|
||||
tot_res = FAILED;
|
||||
isConnected = false;
|
||||
log.complain("TEST FAILED: caught unexpected VMDisconnectEvent");
|
||||
} else {
|
||||
log.display("EventListener: following JDI event occured: "
|
||||
+ event.toString());
|
||||
|
||||
if (event instanceof AccessWatchpointEvent) {
|
||||
AccessWatchpointEvent awpEvent =
|
||||
(AccessWatchpointEvent) event;
|
||||
Field fld = awpEvent.field();
|
||||
boolean notFound = true;
|
||||
for (int i=0; i<FLDS_NUM; i++) {
|
||||
if (awpRequest[i].equals(event.request())) {
|
||||
log.display("EventListener: AccessWatchpointEvent for the debuggee's field #"
|
||||
+ i + ":\n\t" + fld.typeName()
|
||||
+ " " + fld.name());
|
||||
accFCount[i] += 1;
|
||||
notFound = false;
|
||||
log.display("EventListener: notifying about the received event #"
|
||||
+ i);
|
||||
synchronized(gotEvent) {
|
||||
gotEvent.notify(); // notify the main thread
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (notFound) {
|
||||
log.complain("TEST FAILED: found in the received AccessWatchpointEvent\n\tunexpected debuggee's field "
|
||||
+ fld.typeName() + " " + fld.name());
|
||||
tot_res = FAILED;
|
||||
}
|
||||
}
|
||||
else if(event instanceof BreakpointEvent) {
|
||||
synchronized(gotEvent) {
|
||||
breakPointReceived = true;
|
||||
gotEvent.notify(); // notify the main thread
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isConnected) {
|
||||
eventSet.resume();
|
||||
}
|
||||
}
|
||||
} while (isConnected);
|
||||
} catch (InterruptedException e) {
|
||||
tot_res = FAILED;
|
||||
log.complain("FAILURE in EventListener: caught unexpected "
|
||||
+ e);
|
||||
} catch (VMDisconnectedException e) {
|
||||
tot_res = FAILED;
|
||||
log.complain("FAILURE in EventListener: caught unexpected "
|
||||
+ e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
log.display("EventListener: exiting");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,73 @@
|
||||
/*
|
||||
* Copyright (c) 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.
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* @test
|
||||
*
|
||||
* @summary converted from VM Testbase nsk/jdi/AccessWatchpointEvent/_itself_/awevent001.
|
||||
* VM Testbase keywords: [jpda, jdi]
|
||||
* VM Testbase readme:
|
||||
* DESCRIPTION
|
||||
* This test checks that the JDI method
|
||||
* com.sun.jdi.request.EventRequestManager.accessWatchpointRequests()
|
||||
* properly returns all AccessWatchpointRequest objects when:
|
||||
* - event requests are disabled;
|
||||
* - event requests are enabled.
|
||||
* COMMENTS
|
||||
* EventHandler was added as workaround for the bug 4430096.
|
||||
* This prevents the target VM from potential hangup.
|
||||
* The test was updated due to the bug 4455653.
|
||||
* --------------------------------------------
|
||||
* To fix the bug 4509034,
|
||||
* the check if
|
||||
* vm.canWatchFieldAccess() == true
|
||||
* is added to the beginning of the test.
|
||||
* -------------------------------------
|
||||
* To fix the RFE 4615225,
|
||||
* the test suite has been moved here.
|
||||
* -------------------------------------
|
||||
* Test updated to prevent possible VMDisconnectedException on VMDeathEvent:
|
||||
* - quit on VMDeathEvent added to events handling loop
|
||||
* Fixed according to 6290118 bug.
|
||||
*
|
||||
* @library /vmTestbase
|
||||
* /test/lib
|
||||
* @run driver jdk.test.lib.FileInstaller . .
|
||||
* @build nsk.jdi.AccessWatchpointEvent._itself_.awevent001
|
||||
* nsk.jdi.AccessWatchpointEvent._itself_.awevent001t
|
||||
*
|
||||
* @comment make sure awevent001t is compiled with full debug info
|
||||
* @clean nsk.jdi.AccessWatchpointEvent._itself_.awevent001t
|
||||
* @compile -g:lines,source,vars ../awevent001t.java
|
||||
*
|
||||
* @run main/othervm PropertyResolvingWrapper
|
||||
* nsk.jdi.AccessWatchpointEvent._itself_.awevent001
|
||||
* -verbose
|
||||
* -arch=${os.family}-${os.simpleArch}
|
||||
* -waittime=5
|
||||
* -debugee.vmkind=java
|
||||
* -transport.address=dynamic
|
||||
* "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}"
|
||||
*/
|
||||
|
||||
@ -0,0 +1,114 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 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 nsk.jdi.AccessWatchpointEvent._itself_;
|
||||
|
||||
import nsk.share.*;
|
||||
import nsk.share.jpda.*;
|
||||
import nsk.share.jdi.*;
|
||||
|
||||
|
||||
/**
|
||||
* This is a debuggee class containing several dummy fields.
|
||||
*/
|
||||
public class awevent001t {
|
||||
// the dummy fields are below
|
||||
static byte byteFld = 127;
|
||||
static short shortFld = -32768;
|
||||
static int intFld = 2147483647;
|
||||
static long longFld = 9223372036854775807L;
|
||||
static float floatFld = 345.1F;
|
||||
static double doubleFld = 6.2D;
|
||||
static char charFld = 'a';
|
||||
static boolean booleanFld = false;
|
||||
static String strFld = "string field";
|
||||
|
||||
public static void main(String args[]) {
|
||||
ArgumentHandler argHandler = new ArgumentHandler(args);
|
||||
IOPipe pipe = argHandler.createDebugeeIOPipe();
|
||||
Log log = argHandler.createDebugeeLog();
|
||||
|
||||
do {
|
||||
log.display("Debuggee: sending the command: "
|
||||
+ awevent001.COMMAND_READY);
|
||||
pipe.println(awevent001.COMMAND_READY);
|
||||
String cmd = pipe.readln();
|
||||
log.display("Debuggee: received the command: "
|
||||
+ cmd);
|
||||
|
||||
if (cmd.equals(awevent001.COMMAND_RUN[0])) {
|
||||
if (byteFld == 127)
|
||||
log.display("Debuggee: access to the field \"byteFld\""
|
||||
+ " is done");
|
||||
} else if (cmd.equals(awevent001.COMMAND_RUN[1])) {
|
||||
if (shortFld == -32768)
|
||||
log.display("Debuggee: access to the field \"shortFld\""
|
||||
+ " is done");
|
||||
} else if (cmd.equals(awevent001.COMMAND_RUN[2])) {
|
||||
if (intFld == 2147483647)
|
||||
log.display("Debuggee: access to the field \"intFld\""
|
||||
+ " is done");
|
||||
} else if (cmd.equals(awevent001.COMMAND_RUN[3])) {
|
||||
if (longFld == 9223372036854775807L)
|
||||
log.display("Debuggee: access to the field \"longFld\""
|
||||
+ " is done");
|
||||
} else if (cmd.equals(awevent001.COMMAND_RUN[4])) {
|
||||
if (floatFld == 345.1F)
|
||||
log.display("Debuggee: access to the field \"floatFld\""
|
||||
+ " is done");
|
||||
} else if (cmd.equals(awevent001.COMMAND_RUN[5])) {
|
||||
if (doubleFld == 6.2D)
|
||||
log.display("Debuggee: access to the field \"doubleFld\""
|
||||
+ " is done");
|
||||
} else if (cmd.equals(awevent001.COMMAND_RUN[6])) {
|
||||
if (charFld == 'a')
|
||||
log.display("Debuggee: access to the field \"charFld\""
|
||||
+ " is done");
|
||||
} else if (cmd.equals(awevent001.COMMAND_RUN[7])) {
|
||||
if (booleanFld == false)
|
||||
log.display("Debuggee: access to the field \"booleanFld\""
|
||||
+ " is done");
|
||||
} else if (cmd.equals(awevent001.COMMAND_RUN[8])) {
|
||||
if (strFld.equals("string field"))
|
||||
log.display("Debuggee: access to the field \"strFld\""
|
||||
+ " is done");
|
||||
} else if (cmd.equals(awevent001.COMMAND_BREAKPOINT)) {
|
||||
breakpoint();
|
||||
} else if (cmd.equals(awevent001.COMMAND_QUIT)) {
|
||||
break;
|
||||
} else {
|
||||
System.err.println("TEST BUG: unknown debugger command: "
|
||||
+ cmd);
|
||||
System.exit(awevent001.JCK_STATUS_BASE +
|
||||
awevent001.FAILED);
|
||||
}
|
||||
} while(true);
|
||||
log.display("Debuggee: exiting");
|
||||
System.exit(awevent001.JCK_STATUS_BASE +
|
||||
awevent001.PASSED);
|
||||
}
|
||||
|
||||
private static void breakpoint() {
|
||||
// empty method used for setting a breakpoint in
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,180 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 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 nsk.jdi.Accessible.isPackagePrivate;
|
||||
|
||||
import nsk.share.*;
|
||||
import nsk.share.jpda.*;
|
||||
import nsk.share.jdi.*;
|
||||
|
||||
import com.sun.jdi.*;
|
||||
import java.util.*;
|
||||
import java.io.*;
|
||||
|
||||
/**
|
||||
* This test checks if the method <code>isPackagePrivate()</code>
|
||||
* of the JDI interface <code>Accessible</code> works fine with
|
||||
* the <code>ArrayType</code> sub-interface.
|
||||
*/
|
||||
public class accipp001 extends Log {
|
||||
final static boolean MODE_VERBOSE = false;
|
||||
|
||||
/** The main class names of the debugger & debugee applications. */
|
||||
private final static String
|
||||
thisClassName = "nsk.jdi.Accessible.isPackagePrivate.accipp001",
|
||||
debugeeName = thisClassName + "a";
|
||||
|
||||
|
||||
static ArgumentHandler argsHandler;
|
||||
private static Log logHandler;
|
||||
|
||||
|
||||
/** Debugee's classes which status (private or public) is known. */
|
||||
private final static String knownClasses[][] = {
|
||||
{"boolean", "public"},
|
||||
{"byte" , "public"},
|
||||
{"char" , "public"},
|
||||
{"double" , "public"},
|
||||
{"float" , "public"},
|
||||
{"int" , "public"},
|
||||
{"long" , "public"},
|
||||
{"short" , "public"},
|
||||
|
||||
{"java.lang.Boolean" , "public"},
|
||||
{"java.lang.Byte" , "public"},
|
||||
{"java.lang.Character", "public"},
|
||||
{"java.lang.Double" , "public"},
|
||||
{"java.lang.Float" , "public"},
|
||||
{"java.lang.Integer" , "public"},
|
||||
{"java.lang.Long" , "public"},
|
||||
{"java.lang.Short" , "public"},
|
||||
{"java.lang.String" , "public"},
|
||||
{"java.lang.Object" , "public"},
|
||||
|
||||
{thisClassName+"a", "public" },
|
||||
{thisClassName+"e", "package private"},
|
||||
|
||||
{debugeeName+"$U", "private" },
|
||||
{debugeeName+"$V", "protected" },
|
||||
{debugeeName+"$W", "public" },
|
||||
{debugeeName+"$P", "package private"}
|
||||
};
|
||||
|
||||
/**
|
||||
* Re-call to <code>run(args,out)</code>, and exit with
|
||||
* either status 95 or 97 (JCK-like exit status).
|
||||
*/
|
||||
public static void main (String args[]) {
|
||||
int exitCode = run(args,System.out);
|
||||
System.exit(exitCode + 95);
|
||||
}
|
||||
|
||||
/**
|
||||
* JCK-like entry point to the test: perform testing, and
|
||||
* return exit code 0 (PASSED) or either 2 (FAILED).
|
||||
*/
|
||||
public static int run (String args[], PrintStream out) {
|
||||
return new accipp001().runThis(args,out); // incarnate Log
|
||||
}
|
||||
|
||||
/**
|
||||
* Non-static variant of the method <code>run(args,out)</code>
|
||||
* can use Log features.
|
||||
*/
|
||||
private int runThis (String argv[], PrintStream out) {
|
||||
|
||||
Debugee debugee;
|
||||
|
||||
argsHandler = new ArgumentHandler(argv);
|
||||
logHandler = new Log(out, argsHandler);
|
||||
Binder binder = new Binder(argsHandler, logHandler);
|
||||
|
||||
|
||||
if (argsHandler.verbose()) {
|
||||
debugee = binder.bindToDebugee(debugeeName + " -vbs");
|
||||
} else {
|
||||
debugee = binder.bindToDebugee(debugeeName);
|
||||
}
|
||||
|
||||
IOPipe pipe = new IOPipe(debugee);
|
||||
|
||||
|
||||
debugee.redirectStderr(out);
|
||||
debugee.resume();
|
||||
|
||||
String line = pipe.readln();
|
||||
if (!line.equals("ready")) {
|
||||
logHandler.complain("# Cannot recognize debugee's signal: " + line);
|
||||
return 2;
|
||||
};
|
||||
|
||||
// ReferenceType classes[] = debugee.classes();
|
||||
// for (int i=0; i<classes.length; i++) {
|
||||
// ReferenceType t = classes[i];
|
||||
// if (t.signature().startsWith("["))
|
||||
// logHandler.display(t.name() + ": " + t.isPackagePrivate());
|
||||
// };
|
||||
|
||||
int errors = 0;
|
||||
for (int i=0; i<knownClasses.length; i++) {
|
||||
String basicName = knownClasses[i][0];
|
||||
for (int indirectionLevel=1; indirectionLevel<5; indirectionLevel++) {
|
||||
String brackets[] = {"", "[]", "[][]", "[][][]", "[][][][]"};
|
||||
String className = basicName + brackets[indirectionLevel];
|
||||
ReferenceType refType = debugee.classByName(className);
|
||||
if (refType == null) {
|
||||
logHandler.complain("Could not find class: " + className);
|
||||
errors++;
|
||||
continue;
|
||||
};
|
||||
boolean isPackagePrivate =
|
||||
!knownClasses[i][1].equals("private") &&
|
||||
!knownClasses[i][1].equals("public") &&
|
||||
!knownClasses[i][1].equals("protected");
|
||||
if (refType.isPackagePrivate() != isPackagePrivate) {
|
||||
logHandler.complain("Class is not treated package private: "
|
||||
+ className);
|
||||
errors++;
|
||||
continue;
|
||||
};
|
||||
logHandler.display(className + ": " + knownClasses[i][1]);
|
||||
};
|
||||
};
|
||||
if (errors > 0) {
|
||||
logHandler.complain("Errors revealed: " + errors);
|
||||
return 2;
|
||||
};
|
||||
|
||||
pipe.println("quit");
|
||||
debugee.waitFor();
|
||||
|
||||
int status = debugee.getStatus();
|
||||
if (status != 95) {
|
||||
logHandler.complain("Debugee's exit status=" + status);
|
||||
return 2;
|
||||
};
|
||||
|
||||
logHandler.display("Passed");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,68 @@
|
||||
/*
|
||||
* Copyright (c) 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.
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* @test
|
||||
*
|
||||
* @summary converted from VM Testbase nsk/jdi/Accessible/isPackagePrivate/accipp001.
|
||||
* VM Testbase keywords: [jpda, jdi]
|
||||
* VM Testbase readme:
|
||||
* DESCRIPTION
|
||||
* nsk/jdi/Accessible/isPackagePrivate/isPackagePrivate001 test
|
||||
* checks the isPrivatePackage() method of Accessible interface
|
||||
* of the com.sun.jdi package for ArrayType, ClassType, InterfaceType.
|
||||
* COMMENTS
|
||||
* ---------
|
||||
* The test is updated to use new share classes as follows:
|
||||
* - two lines, 31 and 32, with argsHandler and logHandler are added
|
||||
* - statements with definitions, lines 87-100, are added;
|
||||
* obsolete lines are removed;
|
||||
* - all "complain" are replaced with "logHandler.complain"..
|
||||
* - all "display" are replaced with "logHandler.display"
|
||||
* --------
|
||||
* I. To fix the bug 4554254, the following is done:
|
||||
* file accipp001.java:
|
||||
* - additional check : !knownClasses[i][1].equals("private") &&
|
||||
* is added to the statement in lines 131-133
|
||||
* file accipp001a.java:
|
||||
* - initialization values are added in variable declarations in lines
|
||||
* 26-36, 47.
|
||||
* II. As the test doesn't contain checks on both short and Short (?),
|
||||
* two lines with variables of both types are added.
|
||||
*
|
||||
* @library /vmTestbase
|
||||
* /test/lib
|
||||
* @run driver jdk.test.lib.FileInstaller . .
|
||||
* @build nsk.jdi.Accessible.isPackagePrivate.accipp001
|
||||
* nsk.jdi.Accessible.isPackagePrivate.accipp001a
|
||||
* @run main/othervm PropertyResolvingWrapper
|
||||
* nsk.jdi.Accessible.isPackagePrivate.accipp001
|
||||
* -verbose
|
||||
* -arch=${os.family}-${os.simpleArch}
|
||||
* -waittime=5
|
||||
* -debugee.vmkind=java
|
||||
* -transport.address=dynamic
|
||||
* "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}"
|
||||
*/
|
||||
|
||||
@ -0,0 +1,83 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 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 nsk.jdi.Accessible.isPackagePrivate;
|
||||
|
||||
import nsk.share.*;
|
||||
import nsk.share.jpda.*;
|
||||
import nsk.share.jdi.*;
|
||||
|
||||
|
||||
/**
|
||||
* This class is used as debugee application for the JDI test.
|
||||
*/
|
||||
public class accipp001a {
|
||||
boolean z0, z1[]={z0}, z2[][]={z1}, z3[][][]={z2}, z4[][][][]={z3};
|
||||
byte b0, b1[]={b0}, b2[][]={b1}, b3[][][]={b2}, b4[][][][]={b3};
|
||||
char c0, c1[]={c0}, c2[][]={c1}, c3[][][]={c2}, c4[][][][]={c3};
|
||||
double d0, d1[]={d0}, d2[][]={d1}, d3[][][]={d2}, d4[][][][]={d3};
|
||||
float f0, f1[]={f0}, f2[][]={f1}, f3[][][]={f2}, f4[][][][]={f3};
|
||||
int i0, i1[]={i0}, i2[][]={i1}, i3[][][]={i2}, i4[][][][]={i3};
|
||||
long l0, l1[]={l0}, l2[][]={l1}, l3[][][]={l2}, l4[][][][]={l3};
|
||||
short s0, s1[]={s0}, s2[][]={s1}, s3[][][]={s2}, s4[][][][]={s3};
|
||||
|
||||
Boolean Z0 = new Boolean(true), Z1[] ={Z0}, Z2[][]={Z1}, Z3[][][]={Z2}, Z4[][][][]={Z3};
|
||||
Byte B0 = new Byte("0"), B1[] ={B0}, B2[][]={B1}, B3[][][]={B2}, B4[][][][]={B3};
|
||||
Character C0 = new Character('0'), C1[] ={C0}, C2[][]={C1}, C3[][][]={C2}, C4[][][][]={C3};
|
||||
Double D0 = new Double(0), D1[] ={D0}, D2[][]={D1}, D3[][][]={D2}, D4[][][][]={D3};
|
||||
Float F0 = new Float(0), F1[] ={F0}, F2[][]={F1}, F3[][][]={F2}, F4[][][][]={F3};
|
||||
Integer I0 = new Integer(0), I1[] ={I0}, I2[][]={I1}, I3[][][]={I2}, I4[][][][]={I3};
|
||||
Long L0 = new Long(0), L1[] ={L0}, L2[][]={L1}, L3[][][]={L2}, L4[][][][]={L3};
|
||||
Short Sh0 = new Short("1"), Sh1[]={Sh0}, Sh2[][]={Sh1}, Sh3[][][]={Sh2}, Sh4[][][][]={Sh3};
|
||||
String S0 = new String(" "), S1[] ={S0}, S2[][]={S1}, S3[][][]={S2}, S4[][][][]={S3};
|
||||
Object O0 = new Object(), O1[] ={O0}, O2[][]={O1}, O3[][][]={O2}, O4[][][][]={O3};
|
||||
|
||||
private static class U {} // private ==> package private
|
||||
protected static class V {}
|
||||
public static class W {}
|
||||
static class P {} // package private
|
||||
|
||||
U u0=new U(), u1[]={u0}, u2[][]={u1}, u3[][][]={u2}, u4[][][][]={u3};
|
||||
V v0=new V(), v1[]={v0}, v2[][]={v1}, v3[][][]={v2}, v4[][][][]={v3};
|
||||
W w0=new W(), w1[]={w0}, w2[][]={w1}, w3[][][]={w2}, w4[][][][]={w3};
|
||||
P p0=new P(), p1[]={p0}, p2[][]={p1}, p3[][][]={p2}, p4[][][][]={p3};
|
||||
|
||||
accipp001a a0, a1[]={}, a2[][]={}, a3[][][]={}, a4[][][][]={};
|
||||
|
||||
accipp001e e0=new accipp001e() , e1[]={e0}, e2[][]={e1}, e3[][][]={e2}, e4[][][][]={e3};
|
||||
|
||||
public static void main (String args[]) {
|
||||
accipp001a a = new accipp001a();
|
||||
ArgumentHandler argHandler = new ArgumentHandler(args);
|
||||
IOPipe pipe = argHandler.createDebugeeIOPipe();
|
||||
pipe.println("ready");
|
||||
String instruction = pipe.readln();
|
||||
if (instruction.equals("quit"))
|
||||
System.exit(95);
|
||||
System.err.println("# Debugee: unknown instruction: " + instruction);
|
||||
System.exit(97);
|
||||
}
|
||||
}
|
||||
|
||||
/** Sample package-private class. */
|
||||
class accipp001e {}
|
||||
@ -0,0 +1,132 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 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 nsk.jdi.Accessible.isPackagePrivate;
|
||||
|
||||
import nsk.share.*;
|
||||
import nsk.share.jpda.*;
|
||||
import nsk.share.jdi.*;
|
||||
|
||||
import com.sun.jdi.*;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* The debugger application of the test.
|
||||
*/
|
||||
public class accipp002 {
|
||||
|
||||
//------------------------------------------------------- immutable common fields
|
||||
|
||||
final static String SIGNAL_READY = "ready";
|
||||
final static String SIGNAL_GO = "go";
|
||||
final static String SIGNAL_QUIT = "quit";
|
||||
|
||||
private static int waitTime;
|
||||
private static int exitStatus;
|
||||
private static ArgumentHandler argHandler;
|
||||
private static Log log;
|
||||
private static Debugee debuggee;
|
||||
private static ReferenceType debuggeeClass;
|
||||
|
||||
//------------------------------------------------------- mutable common fields
|
||||
|
||||
private final static String prefix = "nsk.jdi.Accessible.isPackagePrivate.";
|
||||
private final static String className = "accipp002";
|
||||
private final static String debuggerName = prefix + className;
|
||||
private final static String debuggeeName = debuggerName + "a";
|
||||
|
||||
//------------------------------------------------------- test specific fields
|
||||
|
||||
private final static String[] testedFieldNames = {"f1", "f2", "f3", "f4"};
|
||||
|
||||
//------------------------------------------------------- immutable common methods
|
||||
|
||||
public static void main(String argv[]) {
|
||||
System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out));
|
||||
}
|
||||
|
||||
private static void display(String msg) {
|
||||
log.display("debugger > " + msg);
|
||||
}
|
||||
|
||||
private static void complain(String msg) {
|
||||
log.complain("debugger FAILURE > " + msg);
|
||||
}
|
||||
|
||||
public static int run(String argv[], PrintStream out) {
|
||||
|
||||
exitStatus = Consts.TEST_PASSED;
|
||||
|
||||
argHandler = new ArgumentHandler(argv);
|
||||
log = new Log(out, argHandler);
|
||||
waitTime = argHandler.getWaitTime() * 60000;
|
||||
|
||||
debuggee = Debugee.prepareDebugee(argHandler, log, debuggeeName);
|
||||
|
||||
debuggeeClass = debuggee.classByName(debuggeeName);
|
||||
if ( debuggeeClass == null ) {
|
||||
complain("Class '" + debuggeeName + "' not found.");
|
||||
exitStatus = Consts.TEST_FAILED;
|
||||
}
|
||||
|
||||
execTest();
|
||||
|
||||
debuggee.quit();
|
||||
|
||||
return exitStatus;
|
||||
}
|
||||
|
||||
//------------------------------------------------------ mutable common method
|
||||
|
||||
private static void execTest() {
|
||||
for (int i=0; i < testedFieldNames.length; i++) {
|
||||
check(testedFieldNames[i]);
|
||||
display("");
|
||||
}
|
||||
display("Checking completed!");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------- test specific methods
|
||||
|
||||
private static void check (String fieldName) {
|
||||
try {
|
||||
ClassType checkedClass = (ClassType)debuggeeClass.fieldByName(fieldName).type();
|
||||
String className = checkedClass.name();
|
||||
|
||||
if (checkedClass.isPackagePrivate()) {
|
||||
display("Accessible.isPackagePrivate() returned true for " + className);
|
||||
} else {
|
||||
complain("Accessible.isPackagePrivate() returned false for " + className);
|
||||
exitStatus = Consts.TEST_FAILED;
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
complain("Unexpected exception while checking of " + className + ": " + e);
|
||||
e.printStackTrace(System.out);
|
||||
exitStatus = Consts.TEST_FAILED;
|
||||
}
|
||||
}
|
||||
}
|
||||
//--------------------------------------------------------- test specific classes
|
||||
@ -0,0 +1,63 @@
|
||||
/*
|
||||
* Copyright (c) 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.
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* @test
|
||||
*
|
||||
* @summary converted from VM Testbase nsk/jdi/Accessible/isPackagePrivate/accipp002.
|
||||
* VM Testbase keywords: [quick, jpda, jdi]
|
||||
* VM Testbase readme:
|
||||
* DESCRIPTION:
|
||||
* A test for isPackagePrivate() method of ReferenceType interface.
|
||||
* The test checks if the method returns true any mirrored
|
||||
* enum type which has no public, private or protected modifier.
|
||||
* The test consists of a debugger program (accipp002.java)
|
||||
* and debuggee application (accipp002a.java).
|
||||
* Package name is nsk.jdi.Accessible.isPackagePrivate .
|
||||
* The test works as follows.
|
||||
* The debugger uses nsk.jdi.share framework classes to
|
||||
* establish connection with debuggee. The debugger and debuggee
|
||||
* synchronize with each other using special commands over
|
||||
* communication channel provided by framework classes.
|
||||
* Upon receiving the signal of readiness from debuggee,
|
||||
* the debugger calls isPackagePrivate() method for each field
|
||||
* of enum type declared in accipp002a class.
|
||||
* The test fails if false is returned once or more times.
|
||||
* COMMENTS:
|
||||
*
|
||||
* @library /vmTestbase
|
||||
* /test/lib
|
||||
* @run driver jdk.test.lib.FileInstaller . .
|
||||
* @build nsk.jdi.Accessible.isPackagePrivate.accipp002
|
||||
* nsk.jdi.Accessible.isPackagePrivate.accipp002a
|
||||
* @run main/othervm PropertyResolvingWrapper
|
||||
* nsk.jdi.Accessible.isPackagePrivate.accipp002
|
||||
* -verbose
|
||||
* -arch=${os.family}-${os.simpleArch}
|
||||
* -waittime=5
|
||||
* -debugee.vmkind=java
|
||||
* -transport.address=dynamic
|
||||
* "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}"
|
||||
*/
|
||||
|
||||
@ -0,0 +1,105 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 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 nsk.jdi.Accessible.isPackagePrivate;
|
||||
|
||||
import nsk.share.*;
|
||||
import nsk.share.jpda.*;
|
||||
import nsk.share.jdi.*;
|
||||
|
||||
/**
|
||||
* The debugged application of the test.
|
||||
*/
|
||||
public class accipp002a {
|
||||
|
||||
//------------------------------------------------------- immutable common fields
|
||||
|
||||
private static int exitStatus;
|
||||
private static ArgumentHandler argHandler;
|
||||
private static Log log;
|
||||
private static IOPipe pipe;
|
||||
|
||||
//------------------------------------------------------- immutable common methods
|
||||
|
||||
static void display(String msg) {
|
||||
log.display("debuggee > " + msg);
|
||||
}
|
||||
|
||||
static void complain(String msg) {
|
||||
log.complain("debuggee FAILURE > " + msg);
|
||||
}
|
||||
|
||||
public static void receiveSignal(String signal) {
|
||||
String line = pipe.readln();
|
||||
|
||||
if ( !line.equals(signal) )
|
||||
throw new Failure("UNEXPECTED debugger's signal " + line);
|
||||
|
||||
display("debugger's <" + signal + "> signal received.");
|
||||
}
|
||||
|
||||
//------------------------------------------------------ mutable common fields
|
||||
|
||||
//------------------------------------------------------ test specific fields
|
||||
|
||||
static Enum1 f1 = Enum1.e1;
|
||||
static Enum1.Enum1_ f2 = Enum1.Enum1_.e1;
|
||||
static accipp002Enum2 f3 = accipp002Enum2.e2;
|
||||
static accipp002Enum2.Enum2_ f4 = accipp002Enum2.Enum2_.e1;
|
||||
|
||||
//------------------------------------------------------ mutable common method
|
||||
|
||||
public static void main (String argv[]) {
|
||||
exitStatus = Consts.TEST_FAILED;
|
||||
argHandler = new ArgumentHandler(argv);
|
||||
log = new Log(System.err, argHandler);
|
||||
pipe = argHandler.createDebugeeIOPipe(log);
|
||||
|
||||
pipe.println(accipp002.SIGNAL_READY);
|
||||
receiveSignal(accipp002.SIGNAL_QUIT);
|
||||
|
||||
display("completed succesfully.");
|
||||
System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------- test specific inner classes
|
||||
|
||||
enum Enum1 {
|
||||
e1, e2;
|
||||
|
||||
enum Enum1_ {
|
||||
e1, e2;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------- test specific classes
|
||||
|
||||
enum accipp002Enum2 {
|
||||
e1, e2;
|
||||
|
||||
enum Enum2_ {
|
||||
e1, e2;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,233 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 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 nsk.jdi.Accessible.isPrivate;
|
||||
|
||||
import nsk.share.*;
|
||||
import nsk.share.jpda.*;
|
||||
import nsk.share.jdi.*;
|
||||
|
||||
import com.sun.jdi.*;
|
||||
import java.util.*;
|
||||
import java.io.*;
|
||||
|
||||
/**
|
||||
* This test checks the method <code>isPrivate()</code>
|
||||
* of the JDI interface <code>Accessible</code> of com.sun.jdi package
|
||||
* for ArrayType, ClassType, InterfaceType
|
||||
*/
|
||||
|
||||
public class isPrivate001 extends Log {
|
||||
static java.io.PrintStream out_stream;
|
||||
static boolean verbose_mode = false;
|
||||
|
||||
/** The main class names of the debugger & debugee applications. */
|
||||
private final static String
|
||||
package_prefix = "nsk.jdi.Accessible.isPrivate.",
|
||||
// package_prefix = "", // for DEBUG without package
|
||||
thisClassName = package_prefix + "isPrivate001",
|
||||
debugeeName = thisClassName + "a";
|
||||
|
||||
|
||||
static ArgumentHandler argsHandler;
|
||||
private static Log logHandler;
|
||||
|
||||
/** Debugee's classes for check **/
|
||||
private final static String classes_for_check[][] = {
|
||||
{"boolean", "public", "primitive_type"},
|
||||
{"byte" , "public", "primitive_type"},
|
||||
{"char" , "public", "primitive_type"},
|
||||
{"double" , "public", "primitive_type"},
|
||||
{"float" , "public", "primitive_type"},
|
||||
{"int" , "public", "primitive_type"},
|
||||
{"long" , "public", "primitive_type"},
|
||||
|
||||
{"java.lang.Boolean" , "public", "reference_type"},
|
||||
{"java.lang.Byte" , "public", "reference_type"},
|
||||
{"java.lang.Character", "public", "reference_type"},
|
||||
{"java.lang.Double" , "public", "reference_type"},
|
||||
{"java.lang.Float" , "public", "reference_type"},
|
||||
{"java.lang.Integer" , "public", "reference_type"},
|
||||
{"java.lang.Long" , "public", "reference_type"},
|
||||
{"java.lang.String" , "public", "reference_type"},
|
||||
{"java.lang.Object" , "public", "reference_type"},
|
||||
|
||||
{thisClassName, "public", "reference_type" },
|
||||
{thisClassName+"a", "public", "reference_type" },
|
||||
{package_prefix + "pack_priv_cls", "package private", "reference_type"}, // class
|
||||
{package_prefix + "pack_priv_interf", "package private", "reference_type"}, // interface
|
||||
|
||||
{debugeeName+"$s_interf", "private", "reference_type"}, // static interface
|
||||
|
||||
{debugeeName+"$U", "private", "reference_type" },
|
||||
{debugeeName+"$V", "protected", "reference_type" },
|
||||
{debugeeName+"$W", "public", "reference_type" },
|
||||
{debugeeName+"$P", "package private", "reference_type"}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Re-call to <code>run(args,out)</code>, and exit with
|
||||
* either status 95 or 97 (JCK-like exit status).
|
||||
*/
|
||||
public static void main (String argv[]) {
|
||||
int exitCode = run(argv,System.out);
|
||||
System.exit(exitCode + 95/*STATUS_TEMP*/);
|
||||
}
|
||||
|
||||
/**
|
||||
* JCK-like entry point to the test: perform testing, and
|
||||
* return exit code 0 (PASSED) or either 2 (FAILED).
|
||||
*/
|
||||
public static int run (String argv[], PrintStream out) {
|
||||
out_stream = out;
|
||||
|
||||
int v_test_result = new isPrivate001().runThis(argv,out_stream);
|
||||
if ( v_test_result == 2/*STATUS_FAILED*/ ) {
|
||||
logHandler.display("\n==> nsk/jdi/Accessible/isPrivate/isPrivate001 test FAILED");
|
||||
}
|
||||
else {
|
||||
logHandler.display("\n==> nsk/jdi/Accessible/isPrivate/isPrivate001 test PASSED");
|
||||
}
|
||||
return v_test_result;
|
||||
}
|
||||
|
||||
private void print_log_on_verbose(String message) {
|
||||
logHandler.display(message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Non-static variant of the method <code>run(args,out)</code>
|
||||
*/
|
||||
private int runThis (String argv[], PrintStream out) {
|
||||
|
||||
if ( out_stream == null ) {
|
||||
out_stream = out;
|
||||
}
|
||||
|
||||
|
||||
Debugee debugee;
|
||||
|
||||
argsHandler = new ArgumentHandler(argv);
|
||||
logHandler = new Log(out, argsHandler);
|
||||
Binder binder = new Binder(argsHandler, logHandler);
|
||||
|
||||
|
||||
if (argsHandler.verbose()) {
|
||||
debugee = binder.bindToDebugee(debugeeName + " -vbs");
|
||||
} else {
|
||||
debugee = binder.bindToDebugee(debugeeName);
|
||||
}
|
||||
|
||||
IOPipe pipe = new IOPipe(debugee);
|
||||
|
||||
logHandler.display("==> nsk/jdi/Accessible/isPrivate/isPrivate001 test LOG:");
|
||||
logHandler.display("==> test checks the isPrivate() method of Accessible interface");
|
||||
logHandler.display(" of the com.sun.jdi package for ArrayType, ClassType, InterfaceType\n");
|
||||
|
||||
debugee.redirectStderr(out);
|
||||
print_log_on_verbose("--> isPrivate001: isPrivate001a debugee launched");
|
||||
debugee.resume();
|
||||
|
||||
String line = pipe.readln();
|
||||
if (line == null) {
|
||||
logHandler.complain("##> isPrivate001: UNEXPECTED debugee's signal (not \"ready\") - " + line);
|
||||
return 2/*STATUS_FAILED*/;
|
||||
}
|
||||
if (!line.equals("ready")) {
|
||||
logHandler.display("##> isPrivate001: UNEXPECTED debugee's signal (not \"ready\") - " + line);
|
||||
return 2/*STATUS_FAILED*/;
|
||||
}
|
||||
else {
|
||||
print_log_on_verbose("--> isPrivate001: debugee's \"ready\" signal recieved!");
|
||||
}
|
||||
|
||||
logHandler.display
|
||||
("--> isPrivate001: checking debugee's classes by Accessible.isPrivate() method...");
|
||||
int all_classes_count = 0;
|
||||
int class_not_found_errors = 0;
|
||||
int isPrivate_method_errors = 0;
|
||||
|
||||
|
||||
for (int i=0; i<classes_for_check.length; i++) {
|
||||
String basicName = classes_for_check[i][0];
|
||||
for (int array_measure=0; array_measure<3; array_measure++) {
|
||||
if ( array_measure == 0 ) { // not array type
|
||||
if ( classes_for_check[i][2].equals("primitive_type") ) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
all_classes_count++;
|
||||
String brackets[] = {"", "[]", "[][]"};
|
||||
String className = basicName + brackets[array_measure];
|
||||
ReferenceType refType = debugee.classByName(className);
|
||||
if (refType == null) {
|
||||
logHandler.complain("##> isPrivate001: Could NOT FIND class: " + className);
|
||||
class_not_found_errors++;
|
||||
continue;
|
||||
}
|
||||
boolean isPrivate = classes_for_check[i][1].equals("private");
|
||||
if (refType.isPrivate() != isPrivate) {
|
||||
logHandler.complain("##> isPrivate001: UNEXPECTED isPrivate() method result ("
|
||||
+ !isPrivate + ") for class: " +
|
||||
className + "(" + classes_for_check[i][1] + ")");
|
||||
isPrivate_method_errors++;
|
||||
}
|
||||
else {
|
||||
print_log_on_verbose("--> isPrivate001: expected isPrivate() method result ("
|
||||
+ isPrivate + ") for class: "
|
||||
+ className + "(" + classes_for_check[i][1] + ")");
|
||||
}
|
||||
}
|
||||
}
|
||||
logHandler.display("--> isPrivate001: checking debugee's classes completed!");
|
||||
logHandler.display("--> isPrivate001: number of checked classes = " + all_classes_count);
|
||||
if ( class_not_found_errors > 0 ) {
|
||||
logHandler.complain("##> isPrivate001: \"class not found ERRORS\" counter = "
|
||||
+ class_not_found_errors);
|
||||
}
|
||||
if ( isPrivate_method_errors > 0 ) {
|
||||
logHandler.complain("##> isPrivate001: isPrivate() method ERRORS counter = "
|
||||
+ isPrivate_method_errors);
|
||||
}
|
||||
int v_test_result = 0/*STATUS_PASSED*/;
|
||||
if (class_not_found_errors + isPrivate_method_errors > 0) {
|
||||
v_test_result = 2/*STATUS_FAILED*/;
|
||||
}
|
||||
|
||||
print_log_on_verbose("--> isPrivate001: waiting for debugee finish...");
|
||||
pipe.println("quit");
|
||||
debugee.waitFor();
|
||||
|
||||
int status = debugee.getStatus();
|
||||
if (status != 0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/) {
|
||||
logHandler.complain("##> isPrivate001: UNEXPECTED Debugee's exit status (not 95) - " + status);
|
||||
v_test_result = 2/*STATUS_FAILED*/;
|
||||
}
|
||||
else {
|
||||
print_log_on_verbose("--> isPrivate001: expected Debugee's exit status - " + status);
|
||||
}
|
||||
|
||||
return v_test_result;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,61 @@
|
||||
/*
|
||||
* Copyright (c) 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.
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* @test
|
||||
*
|
||||
* @summary converted from VM Testbase nsk/jdi/Accessible/isPrivate/isPrivate001.
|
||||
* VM Testbase keywords: [jpda, jdi]
|
||||
* VM Testbase readme:
|
||||
* DESCRIPTION
|
||||
* nsk/jdi/Accessible/isPrivate/isPrivate001 test
|
||||
* checks the isPrivate() method of Accessible interface
|
||||
* of the com.sun.jdi package for ArrayType, ClassType, InterfaceType.
|
||||
* COMMENTS
|
||||
* Bug fixed: 4434819: TEST_BUG: wrongly believe that classes are loaded
|
||||
* ---------
|
||||
* The test is updated to use new share classes as follows:
|
||||
* - two lines, 33 and 34, with argsHandler and logHandler are added
|
||||
* - statements with definitions, lines 110-123, are added;
|
||||
* obsolete statements are removed;
|
||||
* - all calls to "println" are replaced with calls to
|
||||
* "logHandler.complain" or "logHandler.display"..
|
||||
* - all "display" are replaced with "logHandler.display"
|
||||
* --------
|
||||
*
|
||||
* @library /vmTestbase
|
||||
* /test/lib
|
||||
* @run driver jdk.test.lib.FileInstaller . .
|
||||
* @build nsk.jdi.Accessible.isPrivate.isPrivate001
|
||||
* nsk.jdi.Accessible.isPrivate.isPrivate001a
|
||||
* @run main/othervm PropertyResolvingWrapper
|
||||
* nsk.jdi.Accessible.isPrivate.isPrivate001
|
||||
* -verbose
|
||||
* -arch=${os.family}-${os.simpleArch}
|
||||
* -waittime=5
|
||||
* -debugee.vmkind=java
|
||||
* -transport.address=dynamic
|
||||
* "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}"
|
||||
*/
|
||||
|
||||
@ -0,0 +1,125 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 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 nsk.jdi.Accessible.isPrivate;
|
||||
|
||||
import nsk.share.*;
|
||||
import nsk.share.jpda.*;
|
||||
import nsk.share.jdi.*;
|
||||
|
||||
|
||||
/**
|
||||
* This class is used as debugee application for the isPrivate001 JDI test.
|
||||
*/
|
||||
|
||||
public class isPrivate001a {
|
||||
|
||||
static boolean verbose_mode = false;
|
||||
|
||||
boolean z0, z1[]={z0}, z2[][]={z1};
|
||||
byte b0, b1[]={b0}, b2[][]={b1};
|
||||
char c0, c1[]={c0}, c2[][]={c1};
|
||||
double d0, d1[]={d0}, d2[][]={d1};
|
||||
float f0, f1[]={f0}, f2[][]={f1};
|
||||
int i0, i1[]={i0}, i2[][]={i1};
|
||||
long l0, l1[]={l0}, l2[][]={l1};
|
||||
|
||||
// Classes must be loaded and linked, so all fields must be
|
||||
// initialized
|
||||
Boolean Z0 = new Boolean(true), Z1[]={Z0}, Z2[][]={Z1};
|
||||
Byte B0 = new Byte((byte)1), B1[]={B0}, B2[][]={B1};
|
||||
Character C0 = new Character('\u00ff'), C1[]={C0}, C2[][]={C1};
|
||||
Double D0 = new Double(1.0), D1[]={D0}, D2[][]={D1};
|
||||
Float F0 = new Float(1.0f), F1[]={F0}, F2[][]={F1};
|
||||
Integer I0 = new Integer(-1), I1[]={I0}, I2[][]={I1};
|
||||
Long L0 = new Long(-1l), L1[]={L0}, L2[][]={L1};
|
||||
String S0 = new String("4434819"), S1[]={S0}, S2[][]={S1};
|
||||
Object O0 = new Object(), O1[]={O0}, O2[][]={O1};
|
||||
|
||||
private static class U {}
|
||||
protected static class V {}
|
||||
public static class W {}
|
||||
static class P {} // package private
|
||||
|
||||
U u0=new U(), u1[]={u0}, u2[][]={u1};
|
||||
V v0=new V(), v1[]={v0}, v2[][]={v1};
|
||||
W w0=new W(), w1[]={w0}, w2[][]={w1};
|
||||
P p0=new P(), p1[]={p0}, p2[][]={p1};
|
||||
|
||||
// Interfaces must be loaded and linked, so classes that implement
|
||||
// interfaces must be initialized.
|
||||
private static interface s_interf {}
|
||||
private static class s_interf_impl implements s_interf {}
|
||||
s_interf_impl sii0 = new s_interf_impl();
|
||||
s_interf s_interf_0, s_interf_1[]={s_interf_0}, s_interf_2[][]={s_interf_1};
|
||||
|
||||
isPrivate001 a001_0 = new isPrivate001(), a001_1[]={a001_0},
|
||||
a001_2[][]={a001_1};
|
||||
|
||||
// Class isPrivate001a is initialized in method main()
|
||||
isPrivate001a a0, a1[]={a0}, a2[][]={a1};
|
||||
pack_priv_cls ppc0=new pack_priv_cls(), ppc1[]={ppc0}, ppc2[][]={ppc1};
|
||||
pack_priv_interf_impl ppii0 = new pack_priv_interf_impl();
|
||||
pack_priv_interf ppi0, ppi1[]={ppi0}, ppi2[][]={ppi1};
|
||||
|
||||
private static void print_log_on_verbose(String message) {
|
||||
if ( verbose_mode ) {
|
||||
System.err.println(message);
|
||||
}
|
||||
}
|
||||
|
||||
public static void main (String argv[]) {
|
||||
|
||||
for (int i=0; i<argv.length; i++) {
|
||||
if ( argv[i].equals("-vbs") || argv[i].equals("-verbose") ) {
|
||||
verbose_mode = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
print_log_on_verbose("**> isPrivate001a: debugee started!");
|
||||
isPrivate001a isPrivate001a_obj = new isPrivate001a();
|
||||
ArgumentHandler argHandler = new ArgumentHandler(argv);
|
||||
IOPipe pipe = argHandler.createDebugeeIOPipe();
|
||||
print_log_on_verbose("**> isPrivate001a: waiting for \"quit\" signal...");
|
||||
pipe.println("ready");
|
||||
String instruction = pipe.readln();
|
||||
if (instruction.equals("quit")) {
|
||||
print_log_on_verbose("**> isPrivate001a: \"quit\" signal recieved!");
|
||||
print_log_on_verbose("**> isPrivate001a: completed succesfully!");
|
||||
System.exit(0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/);
|
||||
}
|
||||
System.err.println("!!**> isPrivate001a: unexpected signal (no \"quit\") - " + instruction);
|
||||
System.err.println("!!**> isPrivate001a: FAILED!");
|
||||
System.exit(2/*STATUS_FAILED*/ + 95/*STATUS_TEMP*/);
|
||||
}
|
||||
}
|
||||
|
||||
/** Sample package-private class. */
|
||||
class pack_priv_cls {}
|
||||
|
||||
/** Sample package-private interface. */
|
||||
interface pack_priv_interf {}
|
||||
|
||||
/** Class that implements package-private interface */
|
||||
class pack_priv_interf_impl implements pack_priv_interf {}
|
||||
@ -0,0 +1,132 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 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 nsk.jdi.Accessible.isPrivate;
|
||||
|
||||
import nsk.share.*;
|
||||
import nsk.share.jpda.*;
|
||||
import nsk.share.jdi.*;
|
||||
|
||||
import com.sun.jdi.*;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* The debugger application of the test.
|
||||
*/
|
||||
public class isprivate002 {
|
||||
|
||||
//------------------------------------------------------- immutable common fields
|
||||
|
||||
final static String SIGNAL_READY = "ready";
|
||||
final static String SIGNAL_GO = "go";
|
||||
final static String SIGNAL_QUIT = "quit";
|
||||
|
||||
private static int waitTime;
|
||||
private static int exitStatus;
|
||||
private static ArgumentHandler argHandler;
|
||||
private static Log log;
|
||||
private static Debugee debuggee;
|
||||
private static ReferenceType debuggeeClass;
|
||||
|
||||
//------------------------------------------------------- mutable common fields
|
||||
|
||||
private final static String prefix = "nsk.jdi.Accessible.isPrivate.";
|
||||
private final static String className = "isprivate002";
|
||||
private final static String debuggerName = prefix + className;
|
||||
private final static String debuggeeName = debuggerName + "a";
|
||||
|
||||
//------------------------------------------------------- test specific fields
|
||||
|
||||
private final static String[] testedFieldNames = {"f1", "f2"};
|
||||
|
||||
//------------------------------------------------------- immutable common methods
|
||||
|
||||
public static void main(String argv[]) {
|
||||
System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out));
|
||||
}
|
||||
|
||||
private static void display(String msg) {
|
||||
log.display("debugger > " + msg);
|
||||
}
|
||||
|
||||
private static void complain(String msg) {
|
||||
log.complain("debugger FAILURE > " + msg);
|
||||
}
|
||||
|
||||
public static int run(String argv[], PrintStream out) {
|
||||
|
||||
exitStatus = Consts.TEST_PASSED;
|
||||
|
||||
argHandler = new ArgumentHandler(argv);
|
||||
log = new Log(out, argHandler);
|
||||
waitTime = argHandler.getWaitTime() * 60000;
|
||||
|
||||
debuggee = Debugee.prepareDebugee(argHandler, log, debuggeeName);
|
||||
|
||||
debuggeeClass = debuggee.classByName(debuggeeName);
|
||||
if ( debuggeeClass == null ) {
|
||||
complain("Class '" + debuggeeName + "' not found.");
|
||||
exitStatus = Consts.TEST_FAILED;
|
||||
}
|
||||
|
||||
execTest();
|
||||
|
||||
debuggee.quit();
|
||||
|
||||
return exitStatus;
|
||||
}
|
||||
|
||||
//------------------------------------------------------ mutable common method
|
||||
|
||||
private static void execTest() {
|
||||
for (int i=0; i < testedFieldNames.length; i++) {
|
||||
check(testedFieldNames[i]);
|
||||
display("");
|
||||
}
|
||||
display("Checking completed!");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------- test specific methods
|
||||
|
||||
private static void check (String fieldName) {
|
||||
try {
|
||||
ClassType checkedClass = (ClassType)debuggeeClass.fieldByName(fieldName).type();
|
||||
String className = checkedClass.name();
|
||||
|
||||
if (checkedClass.isPrivate()) {
|
||||
display("Accessible.isPrivate() returned true for " + className);
|
||||
} else {
|
||||
complain("Accessible.isPrivate() returned false for " + className);
|
||||
exitStatus = Consts.TEST_FAILED;
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
complain("Unexpected exception while checking of " + className + ": " + e);
|
||||
e.printStackTrace(System.out);
|
||||
exitStatus = Consts.TEST_FAILED;
|
||||
}
|
||||
}
|
||||
}
|
||||
//--------------------------------------------------------- test specific classes
|
||||
@ -0,0 +1,63 @@
|
||||
/*
|
||||
* Copyright (c) 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.
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* @test
|
||||
*
|
||||
* @summary converted from VM Testbase nsk/jdi/Accessible/isPrivate/isprivate002.
|
||||
* VM Testbase keywords: [quick, jpda, jdi]
|
||||
* VM Testbase readme:
|
||||
* DESCRIPTION:
|
||||
* A test for isPrivate() method of ReferenceType interface.
|
||||
* The test checks if the method returns true any mirrored
|
||||
* enum type which has private modifier.
|
||||
* The test consists of a debugger program (isprivate002.java)
|
||||
* and debuggee application (isprivate002a.java).
|
||||
* Package name is nsk.jdi.Accessible.isPrivate .
|
||||
* The test works as follows.
|
||||
* The debugger uses nsk.jdi.share framework classes to
|
||||
* establish connection with debuggee. The debugger and debuggee
|
||||
* synchronize with each other using special commands over
|
||||
* communication channel provided by framework classes.
|
||||
* Upon receiving the signal of readiness from debuggee,
|
||||
* the debugger calls isPrivate() method for each field
|
||||
* of enum type declared in isprivate002a class.
|
||||
* The test fails if false is returned once or more times.
|
||||
* COMMENTS:
|
||||
*
|
||||
* @library /vmTestbase
|
||||
* /test/lib
|
||||
* @run driver jdk.test.lib.FileInstaller . .
|
||||
* @build nsk.jdi.Accessible.isPrivate.isprivate002
|
||||
* nsk.jdi.Accessible.isPrivate.isprivate002a
|
||||
* @run main/othervm PropertyResolvingWrapper
|
||||
* nsk.jdi.Accessible.isPrivate.isprivate002
|
||||
* -verbose
|
||||
* -arch=${os.family}-${os.simpleArch}
|
||||
* -waittime=5
|
||||
* -debugee.vmkind=java
|
||||
* -transport.address=dynamic
|
||||
* "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}"
|
||||
*/
|
||||
|
||||
@ -0,0 +1,95 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 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 nsk.jdi.Accessible.isPrivate;
|
||||
|
||||
import nsk.share.*;
|
||||
import nsk.share.jpda.*;
|
||||
import nsk.share.jdi.*;
|
||||
|
||||
/**
|
||||
* The debugged application of the test.
|
||||
*/
|
||||
public class isprivate002a {
|
||||
|
||||
//------------------------------------------------------- immutable common fields
|
||||
|
||||
private static int exitStatus;
|
||||
private static ArgumentHandler argHandler;
|
||||
private static Log log;
|
||||
private static IOPipe pipe;
|
||||
|
||||
//------------------------------------------------------- immutable common methods
|
||||
|
||||
static void display(String msg) {
|
||||
log.display("debuggee > " + msg);
|
||||
}
|
||||
|
||||
static void complain(String msg) {
|
||||
log.complain("debuggee FAILURE > " + msg);
|
||||
}
|
||||
|
||||
public static void receiveSignal(String signal) {
|
||||
String line = pipe.readln();
|
||||
|
||||
if ( !line.equals(signal) )
|
||||
throw new Failure("UNEXPECTED debugger's signal " + line);
|
||||
|
||||
display("debugger's <" + signal + "> signal received.");
|
||||
}
|
||||
|
||||
//------------------------------------------------------ mutable common fields
|
||||
|
||||
//------------------------------------------------------ test specific fields
|
||||
|
||||
static Enum1 f1 = Enum1.e1;
|
||||
static Enum1.Enum1_ f2 = Enum1.Enum1_.e1;
|
||||
|
||||
//------------------------------------------------------ mutable common method
|
||||
|
||||
public static void main (String argv[]) {
|
||||
exitStatus = Consts.TEST_FAILED;
|
||||
argHandler = new ArgumentHandler(argv);
|
||||
log = new Log(System.err, argHandler);
|
||||
pipe = argHandler.createDebugeeIOPipe(log);
|
||||
|
||||
pipe.println(isprivate002.SIGNAL_READY);
|
||||
receiveSignal(isprivate002.SIGNAL_QUIT);
|
||||
|
||||
display("completed succesfully.");
|
||||
System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------- test specific inner classes
|
||||
|
||||
private enum Enum1 {
|
||||
e1, e2;
|
||||
|
||||
private enum Enum1_ {
|
||||
e1, e2;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------- test specific classes
|
||||
@ -0,0 +1,236 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 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 nsk.jdi.Accessible.isProtected;
|
||||
|
||||
import nsk.share.*;
|
||||
import nsk.share.jpda.*;
|
||||
import nsk.share.jdi.*;
|
||||
|
||||
import com.sun.jdi.*;
|
||||
import java.util.*;
|
||||
import java.io.*;
|
||||
|
||||
/**
|
||||
* This test checks the method <code>isProtected()</code>
|
||||
* of the JDI interface <code>Accessible</code> of com.sun.jdi package
|
||||
* for ArrayType, ClassType, InterfaceType
|
||||
*/
|
||||
|
||||
public class isProtected001 extends Log {
|
||||
static java.io.PrintStream out_stream;
|
||||
static boolean verbose_mode = false;
|
||||
|
||||
/** The main class names of the debugger & debugee applications. */
|
||||
private final static String
|
||||
package_prefix = "nsk.jdi.Accessible.isProtected.",
|
||||
// package_prefix = "", // for DEBUG without package
|
||||
thisClassName = package_prefix + "isProtected001",
|
||||
debugeeName = thisClassName + "a";
|
||||
|
||||
|
||||
static ArgumentHandler argsHandler;
|
||||
private static Log logHandler;
|
||||
|
||||
|
||||
/** Debugee's classes for check **/
|
||||
private final static String classes_for_check[][] = {
|
||||
{"boolean", "public", "primitive_type"},
|
||||
{"byte" , "public", "primitive_type"},
|
||||
{"char" , "public", "primitive_type"},
|
||||
{"double" , "public", "primitive_type"},
|
||||
{"float" , "public", "primitive_type"},
|
||||
{"int" , "public", "primitive_type"},
|
||||
{"long" , "public", "primitive_type"},
|
||||
|
||||
{"java.lang.Boolean" , "public", "reference_type"},
|
||||
{"java.lang.Byte" , "public", "reference_type"},
|
||||
{"java.lang.Character", "public", "reference_type"},
|
||||
{"java.lang.Double" , "public", "reference_type"},
|
||||
{"java.lang.Float" , "public", "reference_type"},
|
||||
{"java.lang.Integer" , "public", "reference_type"},
|
||||
{"java.lang.Long" , "public", "reference_type"},
|
||||
{"java.lang.String" , "public", "reference_type"},
|
||||
{"java.lang.Object" , "public", "reference_type"},
|
||||
|
||||
{thisClassName, "public", "reference_type" },
|
||||
{thisClassName+"a", "public", "reference_type" },
|
||||
{package_prefix + "pack_priv_cls", "package private", "reference_type"}, // class
|
||||
{package_prefix + "pack_priv_interf", "package private", "reference_type"}, // interface
|
||||
|
||||
{debugeeName+"$s_interf", "protected", "reference_type"}, // static interface
|
||||
|
||||
{debugeeName+"$U", "private", "reference_type" },
|
||||
{debugeeName+"$V", "protected", "reference_type" },
|
||||
{debugeeName+"$W", "public", "reference_type" },
|
||||
{debugeeName+"$P", "package private", "reference_type"}
|
||||
};
|
||||
|
||||
/**
|
||||
* Re-call to <code>run(args,out)</code>, and exit with
|
||||
* either status 95 or 97 (JCK-like exit status).
|
||||
*/
|
||||
public static void main (String argv[]) {
|
||||
int exitCode = run(argv,System.out);
|
||||
System.exit(exitCode + 95/*STATUS_TEMP*/);
|
||||
}
|
||||
|
||||
/**
|
||||
* JCK-like entry point to the test: perform testing, and
|
||||
* return exit code 0 (PASSED) or either 2 (FAILED).
|
||||
*/
|
||||
public static int run (String argv[], PrintStream out) {
|
||||
out_stream = out;
|
||||
|
||||
int v_test_result = new isProtected001().runThis(argv,out_stream);
|
||||
if ( v_test_result == 2/*STATUS_FAILED*/ ) {
|
||||
logHandler.complain("\n==> nsk/jdi/Accessible/isProtected/isProtected001 test FAILED");
|
||||
}
|
||||
else {
|
||||
logHandler.display("\n==> nsk/jdi/Accessible/isProtected/isProtected001 test PASSED");
|
||||
}
|
||||
return v_test_result;
|
||||
}
|
||||
|
||||
private void print_log_on_verbose(String message) {
|
||||
logHandler.display(message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Non-static variant of the method <code>run(args,out)</code>
|
||||
*/
|
||||
private int runThis (String argv[], PrintStream out) {
|
||||
|
||||
if ( out_stream == null ) {
|
||||
out_stream = out;
|
||||
}
|
||||
|
||||
|
||||
Debugee debugee;
|
||||
|
||||
argsHandler = new ArgumentHandler(argv);
|
||||
logHandler = new Log(out, argsHandler);
|
||||
Binder binder = new Binder(argsHandler, logHandler);
|
||||
|
||||
|
||||
if (argsHandler.verbose()) {
|
||||
debugee = binder.bindToDebugee(debugeeName + " -vbs");
|
||||
} else {
|
||||
debugee = binder.bindToDebugee(debugeeName);
|
||||
}
|
||||
|
||||
IOPipe pipe = new IOPipe(debugee);
|
||||
|
||||
|
||||
logHandler.display("==> nsk/jdi/Accessible/isProtected/isProtected001 test LOG:");
|
||||
logHandler.display("==> test checks the isProtected() method of Accessible interface");
|
||||
logHandler.display(" of the com.sun.jdi package for ArrayType, ClassType, InterfaceType\n");
|
||||
|
||||
|
||||
debugee.redirectStderr(out);
|
||||
print_log_on_verbose("--> isProtected001: isProtected001a debugee launched");
|
||||
debugee.resume();
|
||||
|
||||
String line = pipe.readln();
|
||||
if (line == null) {
|
||||
logHandler.complain("##> isProtected001: UNEXPECTED debugee's signal (not \"ready\") - " + line);
|
||||
return 2/*STATUS_FAILED*/;
|
||||
}
|
||||
if (!line.equals("ready")) {
|
||||
logHandler.complain
|
||||
("##> isProtected001: UNEXPECTED debugee's signal (not \"ready\") - " + line);
|
||||
return 2/*STATUS_FAILED*/;
|
||||
}
|
||||
else {
|
||||
print_log_on_verbose("--> isProtected001: debugee's \"ready\" signal recieved!");
|
||||
}
|
||||
|
||||
logHandler.display
|
||||
("--> isProtected001: checking debugee's classes by Accessible.isProtected() method...");
|
||||
int all_classes_count = 0;
|
||||
int class_not_found_errors = 0;
|
||||
int isProtected_method_errors = 0;
|
||||
for (int i=0; i<classes_for_check.length; i++) {
|
||||
String basicName = classes_for_check[i][0];
|
||||
for (int array_measure=0; array_measure<3; array_measure++) {
|
||||
if ( array_measure == 0 ) { // not array type
|
||||
if ( classes_for_check[i][2].equals("primitive_type") ) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
all_classes_count++;
|
||||
String brackets[] = {"", "[]", "[][]"};
|
||||
String className = basicName + brackets[array_measure];
|
||||
ReferenceType refType = debugee.classByName(className);
|
||||
if (refType == null) {
|
||||
logHandler.complain("##> isProtected001: Could NOT FIND class: " + className);
|
||||
class_not_found_errors++;
|
||||
continue;
|
||||
}
|
||||
boolean isProtected = classes_for_check[i][1].equals("protected");
|
||||
if (refType.isProtected() != isProtected) {
|
||||
logHandler.complain("##> isProtected001: UNEXPECTED isProtected() method result ("
|
||||
+ !isProtected + ") for class: "
|
||||
+ className + "(" + classes_for_check[i][1] + ")");
|
||||
isProtected_method_errors++;
|
||||
}
|
||||
else {
|
||||
print_log_on_verbose("--> isProtected001: expected isProtected() method result ("
|
||||
+ isProtected + ") for class: "
|
||||
+ className + "(" + classes_for_check[i][1] + ")");
|
||||
}
|
||||
}
|
||||
}
|
||||
logHandler.display("--> isProtected001: checking debugee's classes completed!");
|
||||
logHandler.display("--> isProtected001: number of checked classes = " + all_classes_count);
|
||||
if ( class_not_found_errors > 0 ) {
|
||||
logHandler.complain("##> isProtected001: \"class not found ERRORS\" counter = "
|
||||
+ class_not_found_errors);
|
||||
}
|
||||
if ( isProtected_method_errors > 0 ) {
|
||||
logHandler.complain("##> isProtected001: isProtected() method ERRORS counter = "
|
||||
+ isProtected_method_errors);
|
||||
}
|
||||
int v_test_result = 0/*STATUS_PASSED*/;
|
||||
if (class_not_found_errors + isProtected_method_errors > 0) {
|
||||
v_test_result = 2/*STATUS_FAILED*/;
|
||||
}
|
||||
|
||||
print_log_on_verbose("--> isProtected001: waiting for debugee finish...");
|
||||
pipe.println("quit");
|
||||
debugee.waitFor();
|
||||
|
||||
int status = debugee.getStatus();
|
||||
if (status != 0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/) {
|
||||
logHandler.complain
|
||||
("##> isProtected001: UNEXPECTED Debugee's exit status (not 95) - " + status);
|
||||
v_test_result = 2/*STATUS_FAILED*/;
|
||||
}
|
||||
else {
|
||||
print_log_on_verbose
|
||||
("--> isProtected001: expected Debugee's exit status - " + status);
|
||||
}
|
||||
|
||||
return v_test_result;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,60 @@
|
||||
/*
|
||||
* Copyright (c) 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.
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* @test
|
||||
*
|
||||
* @summary converted from VM Testbase nsk/jdi/Accessible/isProtected/isProtected001.
|
||||
* VM Testbase keywords: [jpda, jdi]
|
||||
* VM Testbase readme:
|
||||
* DESCRIPTION
|
||||
* nsk/jdi/Accessible/isProtected/isProtected001 test
|
||||
* checks the isProtected() method of Accessible interface
|
||||
* of the com.sun.jdi package for ArrayType, ClassType, InterfaceType.
|
||||
* COMMENTS
|
||||
* Bug fixed: 4434819: TEST_BUG: wrongly believe that classes are loaded
|
||||
* ---------
|
||||
* The test is updated to use new share classes as follows:
|
||||
* - two lines, 33 and 34, with argsHandler and logHandler are added befo
|
||||
* - statements with definitions, lines 112-123, are added;
|
||||
* - all calls to "println" are replaced with calls to
|
||||
* "logHandler.complain" or "logHandler.display"..
|
||||
* - all "display" are replaced with "logHandler.display"
|
||||
* --------
|
||||
*
|
||||
* @library /vmTestbase
|
||||
* /test/lib
|
||||
* @run driver jdk.test.lib.FileInstaller . .
|
||||
* @build nsk.jdi.Accessible.isProtected.isProtected001
|
||||
* nsk.jdi.Accessible.isProtected.isProtected001a
|
||||
* @run main/othervm PropertyResolvingWrapper
|
||||
* nsk.jdi.Accessible.isProtected.isProtected001
|
||||
* -verbose
|
||||
* -arch=${os.family}-${os.simpleArch}
|
||||
* -waittime=5
|
||||
* -debugee.vmkind=java
|
||||
* -transport.address=dynamic
|
||||
* "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}"
|
||||
*/
|
||||
|
||||
@ -0,0 +1,125 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 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 nsk.jdi.Accessible.isProtected;
|
||||
|
||||
import nsk.share.*;
|
||||
import nsk.share.jpda.*;
|
||||
import nsk.share.jdi.*;
|
||||
|
||||
|
||||
/**
|
||||
* This class is used as debugee application for the isProtected001 JDI test.
|
||||
*/
|
||||
|
||||
public class isProtected001a {
|
||||
|
||||
static boolean verbose_mode = false;
|
||||
|
||||
boolean z0, z1[]={z0}, z2[][]={z1};
|
||||
byte b0, b1[]={b0}, b2[][]={b1};
|
||||
char c0, c1[]={c0}, c2[][]={c1};
|
||||
double d0, d1[]={d0}, d2[][]={d1};
|
||||
float f0, f1[]={f0}, f2[][]={f1};
|
||||
int i0, i1[]={i0}, i2[][]={i1};
|
||||
long l0, l1[]={l0}, l2[][]={l1};
|
||||
|
||||
// Classes must be loaded and linked, so all fields must be
|
||||
// initialized
|
||||
Boolean Z0 = new Boolean(true), Z1[]={Z0}, Z2[][]={Z1};
|
||||
Byte B0 = new Byte((byte)1), B1[]={B0}, B2[][]={B1};
|
||||
Character C0 = new Character('\u00ff'), C1[]={C0}, C2[][]={C1};
|
||||
Double D0 = new Double(1.0), D1[]={D0}, D2[][]={D1};
|
||||
Float F0 = new Float(1.0f), F1[]={F0}, F2[][]={F1};
|
||||
Integer I0 = new Integer(-1), I1[]={I0}, I2[][]={I1};
|
||||
Long L0 = new Long(-1l), L1[]={L0}, L2[][]={L1};
|
||||
String S0 = new String("4434819"), S1[]={S0}, S2[][]={S1};
|
||||
Object O0 = new Object(), O1[]={O0}, O2[][]={O1};
|
||||
|
||||
private static class U {}
|
||||
protected static class V {}
|
||||
public static class W {}
|
||||
static class P {} // package private
|
||||
|
||||
U u0=new U(), u1[]={u0}, u2[][]={u1};
|
||||
V v0=new V(), v1[]={v0}, v2[][]={v1};
|
||||
W w0=new W(), w1[]={w0}, w2[][]={w1};
|
||||
P p0=new P(), p1[]={p0}, p2[][]={p1};
|
||||
|
||||
// Interfaces must be loaded and linked, so classes that implement
|
||||
// interfaces must be initialized.
|
||||
protected static interface s_interf {}
|
||||
protected static class s_interf_impl implements s_interf {}
|
||||
s_interf_impl sii0 = new s_interf_impl();
|
||||
s_interf s_interf_0, s_interf_1[]={s_interf_0}, s_interf_2[][]={s_interf_1};
|
||||
|
||||
isProtected001 a001_0=new isProtected001(), a001_1[]={a001_0},
|
||||
a001_2[][]={a001_1};
|
||||
|
||||
// Class isPrivate001a is initialized in method main()
|
||||
isProtected001a a0, a1[]={a0}, a2[][]={a1};
|
||||
pack_priv_cls ppc0=new pack_priv_cls(), ppc1[]={ppc0}, ppc2[][]={ppc1};
|
||||
pack_priv_interf_impl ppii0 = new pack_priv_interf_impl();
|
||||
pack_priv_interf ppi0, ppi1[]={ppi0}, ppi2[][]={ppi1};
|
||||
|
||||
private static void print_log_on_verbose(String message) {
|
||||
if ( verbose_mode ) {
|
||||
System.err.println(message);
|
||||
}
|
||||
}
|
||||
|
||||
public static void main (String argv[]) {
|
||||
|
||||
for (int i=0; i<argv.length; i++) {
|
||||
if ( argv[i].equals("-vbs") || argv[i].equals("-verbose") ) {
|
||||
verbose_mode = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
print_log_on_verbose("**> isProtected001a: debugee started!");
|
||||
isProtected001a isProtected001a_obj = new isProtected001a();
|
||||
ArgumentHandler argHandler = new ArgumentHandler(argv);
|
||||
IOPipe pipe = argHandler.createDebugeeIOPipe();
|
||||
print_log_on_verbose("**> isProtected001a: waiting for \"quit\" signal...");
|
||||
pipe.println("ready");
|
||||
String instruction = pipe.readln();
|
||||
if (instruction.equals("quit")) {
|
||||
print_log_on_verbose("**> isProtected001a: \"quit\" signal recieved!");
|
||||
print_log_on_verbose("**> isProtected001a: completed succesfully!");
|
||||
System.exit(0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/);
|
||||
}
|
||||
System.err.println("!!**> isProtected001a: unexpected signal (no \"quit\") - " + instruction);
|
||||
System.err.println("!!**> isProtected001a: FAILED!");
|
||||
System.exit(2/*STATUS_FAILED*/ + 95/*STATUS_TEMP*/);
|
||||
}
|
||||
}
|
||||
|
||||
/** Sample package-private class. */
|
||||
class pack_priv_cls {}
|
||||
|
||||
/** Sample package-private interface. */
|
||||
interface pack_priv_interf {}
|
||||
|
||||
/** Class that implements package-private interface */
|
||||
class pack_priv_interf_impl implements pack_priv_interf {}
|
||||
@ -0,0 +1,132 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 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 nsk.jdi.Accessible.isProtected;
|
||||
|
||||
import nsk.share.*;
|
||||
import nsk.share.jpda.*;
|
||||
import nsk.share.jdi.*;
|
||||
|
||||
import com.sun.jdi.*;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* The debugger application of the test.
|
||||
*/
|
||||
public class isprotected002 {
|
||||
|
||||
//------------------------------------------------------- immutable common fields
|
||||
|
||||
final static String SIGNAL_READY = "ready";
|
||||
final static String SIGNAL_GO = "go";
|
||||
final static String SIGNAL_QUIT = "quit";
|
||||
|
||||
private static int waitTime;
|
||||
private static int exitStatus;
|
||||
private static ArgumentHandler argHandler;
|
||||
private static Log log;
|
||||
private static Debugee debuggee;
|
||||
private static ReferenceType debuggeeClass;
|
||||
|
||||
//------------------------------------------------------- mutable common fields
|
||||
|
||||
private final static String prefix = "nsk.jdi.Accessible.isProtected.";
|
||||
private final static String className = "isprotected002";
|
||||
private final static String debuggerName = prefix + className;
|
||||
private final static String debuggeeName = debuggerName + "a";
|
||||
|
||||
//------------------------------------------------------- test specific fields
|
||||
|
||||
private final static String[] testedFieldNames = {"f1", "f2", "f4"};
|
||||
|
||||
//------------------------------------------------------- immutable common methods
|
||||
|
||||
public static void main(String argv[]) {
|
||||
System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out));
|
||||
}
|
||||
|
||||
private static void display(String msg) {
|
||||
log.display("debugger > " + msg);
|
||||
}
|
||||
|
||||
private static void complain(String msg) {
|
||||
log.complain("debugger FAILURE > " + msg);
|
||||
}
|
||||
|
||||
public static int run(String argv[], PrintStream out) {
|
||||
|
||||
exitStatus = Consts.TEST_PASSED;
|
||||
|
||||
argHandler = new ArgumentHandler(argv);
|
||||
log = new Log(out, argHandler);
|
||||
waitTime = argHandler.getWaitTime() * 60000;
|
||||
|
||||
debuggee = Debugee.prepareDebugee(argHandler, log, debuggeeName);
|
||||
|
||||
debuggeeClass = debuggee.classByName(debuggeeName);
|
||||
if ( debuggeeClass == null ) {
|
||||
complain("Class '" + debuggeeName + "' not found.");
|
||||
exitStatus = Consts.TEST_FAILED;
|
||||
}
|
||||
|
||||
execTest();
|
||||
|
||||
debuggee.quit();
|
||||
|
||||
return exitStatus;
|
||||
}
|
||||
|
||||
//------------------------------------------------------ mutable common method
|
||||
|
||||
private static void execTest() {
|
||||
for (int i=0; i < testedFieldNames.length; i++) {
|
||||
check(testedFieldNames[i]);
|
||||
display("");
|
||||
}
|
||||
display("Checking completed!");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------- test specific methods
|
||||
|
||||
private static void check (String fieldName) {
|
||||
try {
|
||||
ClassType checkedClass = (ClassType)debuggeeClass.fieldByName(fieldName).type();
|
||||
String className = checkedClass.name();
|
||||
|
||||
if (checkedClass.isProtected()) {
|
||||
display("Accessible.isProtected() returned true for " + className);
|
||||
} else {
|
||||
complain("Accessible.isProtected() returned false for " + className);
|
||||
exitStatus = Consts.TEST_FAILED;
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
complain("Unexpected exception while checking of " + className + ": " + e);
|
||||
e.printStackTrace(System.out);
|
||||
exitStatus = Consts.TEST_FAILED;
|
||||
}
|
||||
}
|
||||
}
|
||||
//--------------------------------------------------------- test specific classes
|
||||
@ -0,0 +1,63 @@
|
||||
/*
|
||||
* Copyright (c) 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.
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* @test
|
||||
*
|
||||
* @summary converted from VM Testbase nsk/jdi/Accessible/isProtected/isprotected002.
|
||||
* VM Testbase keywords: [quick, jpda, jdi]
|
||||
* VM Testbase readme:
|
||||
* DESCRIPTION:
|
||||
* A test for isProtected() method of ReferenceType interface.
|
||||
* The test checks if the method returns true any mirrored
|
||||
* enum type which has protected modifier.
|
||||
* The test consists of a debugger program (isprotected002.java)
|
||||
* and debuggee application (isprotected002a.java).
|
||||
* Package name is nsk.jdi.Accessible.isProtected .
|
||||
* The test works as follows.
|
||||
* The debugger uses nsk.jdi.share framework classes to
|
||||
* establish connection with debuggee. The debugger and debuggee
|
||||
* synchronize with each other using special commands over
|
||||
* communication channel provided by framework classes.
|
||||
* Upon receiving the signal of readiness from debuggee,
|
||||
* the debugger calls isProtected() method for each field
|
||||
* of enum type declared in isprotected002a class.
|
||||
* The test fails if false is returned once or more times.
|
||||
* COMMENTS:
|
||||
*
|
||||
* @library /vmTestbase
|
||||
* /test/lib
|
||||
* @run driver jdk.test.lib.FileInstaller . .
|
||||
* @build nsk.jdi.Accessible.isProtected.isprotected002
|
||||
* nsk.jdi.Accessible.isProtected.isprotected002a
|
||||
* @run main/othervm PropertyResolvingWrapper
|
||||
* nsk.jdi.Accessible.isProtected.isprotected002
|
||||
* -verbose
|
||||
* -arch=${os.family}-${os.simpleArch}
|
||||
* -waittime=5
|
||||
* -debugee.vmkind=java
|
||||
* -transport.address=dynamic
|
||||
* "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}"
|
||||
*/
|
||||
|
||||
@ -0,0 +1,104 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 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 nsk.jdi.Accessible.isProtected;
|
||||
|
||||
import nsk.share.*;
|
||||
import nsk.share.jpda.*;
|
||||
import nsk.share.jdi.*;
|
||||
|
||||
/**
|
||||
* The debugged application of the test.
|
||||
*/
|
||||
public class isprotected002a {
|
||||
|
||||
//------------------------------------------------------- immutable common fields
|
||||
|
||||
private static int exitStatus;
|
||||
private static ArgumentHandler argHandler;
|
||||
private static Log log;
|
||||
private static IOPipe pipe;
|
||||
|
||||
//------------------------------------------------------- immutable common methods
|
||||
|
||||
static void display(String msg) {
|
||||
log.display("debuggee > " + msg);
|
||||
}
|
||||
|
||||
static void complain(String msg) {
|
||||
log.complain("debuggee FAILURE > " + msg);
|
||||
}
|
||||
|
||||
public static void receiveSignal(String signal) {
|
||||
String line = pipe.readln();
|
||||
|
||||
if ( !line.equals(signal) )
|
||||
throw new Failure("UNEXPECTED debugger's signal " + line);
|
||||
|
||||
display("debugger's <" + signal + "> signal received.");
|
||||
}
|
||||
|
||||
//------------------------------------------------------ mutable common fields
|
||||
|
||||
//------------------------------------------------------ test specific fields
|
||||
|
||||
static Enum1 f1 = Enum1.e1;
|
||||
static Enum1.Enum1_ f2 = Enum1.Enum1_.e1;
|
||||
static isprotected002Enum2.Enum2_ f4 = isprotected002Enum2.Enum2_.e1;
|
||||
|
||||
//------------------------------------------------------ mutable common method
|
||||
|
||||
public static void main (String argv[]) {
|
||||
exitStatus = Consts.TEST_FAILED;
|
||||
argHandler = new ArgumentHandler(argv);
|
||||
log = new Log(System.err, argHandler);
|
||||
pipe = argHandler.createDebugeeIOPipe(log);
|
||||
|
||||
pipe.println(isprotected002.SIGNAL_READY);
|
||||
receiveSignal(isprotected002.SIGNAL_QUIT);
|
||||
|
||||
display("completed succesfully.");
|
||||
System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------- test specific inner classes
|
||||
|
||||
protected enum Enum1 {
|
||||
e1, e2;
|
||||
|
||||
protected enum Enum1_ {
|
||||
e1, e2;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------- test specific classes
|
||||
|
||||
enum isprotected002Enum2 {
|
||||
e1, e2;
|
||||
|
||||
protected enum Enum2_ {
|
||||
e1, e2;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,236 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 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 nsk.jdi.Accessible.isPublic;
|
||||
|
||||
import nsk.share.*;
|
||||
import nsk.share.jpda.*;
|
||||
import nsk.share.jdi.*;
|
||||
|
||||
import com.sun.jdi.*;
|
||||
import java.util.*;
|
||||
import java.io.*;
|
||||
|
||||
/**
|
||||
* This test checks the method <code>isPublic()</code>
|
||||
* of the JDI interface <code>Accessible</code> of com.sun.jdi package
|
||||
* for ArrayType, ClassType, InterfaceType
|
||||
*/
|
||||
|
||||
public class isPublic001 extends Log {
|
||||
static java.io.PrintStream out_stream;
|
||||
static boolean verbose_mode = false;
|
||||
|
||||
/** The main class names of the debugger & debugee applications. */
|
||||
private final static String
|
||||
package_prefix = "nsk.jdi.Accessible.isPublic.",
|
||||
// package_prefix = "", // for DEBUG without package
|
||||
thisClassName = package_prefix + "isPublic001",
|
||||
debugeeName = thisClassName + "a";
|
||||
|
||||
|
||||
static ArgumentHandler argsHandler;
|
||||
private static Log logHandler;
|
||||
|
||||
|
||||
/** Debugee's classes for check **/
|
||||
private final static String classes_for_check[][] = {
|
||||
{"boolean", "public", "primitive_type"},
|
||||
{"byte" , "public", "primitive_type"},
|
||||
{"char" , "public", "primitive_type"},
|
||||
{"double" , "public", "primitive_type"},
|
||||
{"float" , "public", "primitive_type"},
|
||||
{"int" , "public", "primitive_type"},
|
||||
{"long" , "public", "primitive_type"},
|
||||
|
||||
{"java.lang.Boolean" , "public", "reference_type"},
|
||||
{"java.lang.Byte" , "public", "reference_type"},
|
||||
{"java.lang.Character", "public", "reference_type"},
|
||||
{"java.lang.Double" , "public", "reference_type"},
|
||||
{"java.lang.Float" , "public", "reference_type"},
|
||||
{"java.lang.Integer" , "public", "reference_type"},
|
||||
{"java.lang.Long" , "public", "reference_type"},
|
||||
{"java.lang.String" , "public", "reference_type"},
|
||||
{"java.lang.Object" , "public", "reference_type"},
|
||||
|
||||
{thisClassName, "public", "reference_type" },
|
||||
{thisClassName+"a", "public", "reference_type" },
|
||||
{package_prefix + "pack_priv_cls", "package private", "reference_type"}, // class
|
||||
{package_prefix + "pack_priv_interf", "package private", "reference_type"}, // interface
|
||||
|
||||
{debugeeName+"$s_interf", "public", "reference_type"}, // interface
|
||||
|
||||
{debugeeName+"$U", "private", "reference_type" },
|
||||
{debugeeName+"$V", "protected", "reference_type" },
|
||||
{debugeeName+"$W", "public", "reference_type" },
|
||||
{debugeeName+"$P", "package private", "reference_type"}
|
||||
};
|
||||
|
||||
/**
|
||||
* Re-call to <code>run(args,out)</code>, and exit with
|
||||
* either status 95 or 97 (JCK-like exit status).
|
||||
*/
|
||||
public static void main (String argv[]) {
|
||||
int exitCode = run(argv,System.out);
|
||||
System.exit(exitCode + 95/*STATUS_TEMP*/);
|
||||
}
|
||||
|
||||
/**
|
||||
* JCK-like entry point to the test: perform testing, and
|
||||
* return exit code 0 (PASSED) or either 2 (FAILED).
|
||||
*/
|
||||
public static int run (String argv[], PrintStream out) {
|
||||
out_stream = out;
|
||||
|
||||
int v_test_result = new isPublic001().runThis(argv,out_stream);
|
||||
if ( v_test_result == 2/*STATUS_FAILED*/ ) {
|
||||
logHandler.complain("\n==> nsk/jdi/Accessible/isPublic/isPublic001 test FAILED");
|
||||
}
|
||||
else {
|
||||
logHandler.display("\n==> nsk/jdi/Accessible/isPublic/isPublic001 test PASSED");
|
||||
}
|
||||
return v_test_result;
|
||||
}
|
||||
|
||||
private void print_log_on_verbose(String message) {
|
||||
logHandler.display(message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Non-static variant of the method <code>run(args,out)</code>
|
||||
*/
|
||||
private int runThis (String argv[], PrintStream out) {
|
||||
if ( out_stream == null ) {
|
||||
out_stream = out;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Debugee debugee;
|
||||
|
||||
argsHandler = new ArgumentHandler(argv);
|
||||
logHandler = new Log(out, argsHandler);
|
||||
Binder binder = new Binder(argsHandler, logHandler);
|
||||
|
||||
|
||||
if (argsHandler.verbose()) {
|
||||
debugee = binder.bindToDebugee(debugeeName + " -vbs");
|
||||
} else {
|
||||
debugee = binder.bindToDebugee(debugeeName);
|
||||
}
|
||||
|
||||
IOPipe pipe = new IOPipe(debugee);
|
||||
|
||||
logHandler.display("==> nsk/jdi/Accessible/isPublic/isPublic001 test LOG:");
|
||||
logHandler.display("==> test checks the isPublic() method of Accessible interface");
|
||||
logHandler.display(" of the com.sun.jdi package for ArrayType, ClassType, InterfaceType\n");
|
||||
|
||||
|
||||
debugee.redirectStderr(out);
|
||||
print_log_on_verbose("--> isPublic001: isPublic001a debugee launched");
|
||||
debugee.resume();
|
||||
|
||||
String line = pipe.readln();
|
||||
if (line == null) {
|
||||
logHandler.complain
|
||||
("##> isPublic001: UNEXPECTED debugee's signal (not \"ready\") - " + line);
|
||||
return 2/*STATUS_FAILED*/;
|
||||
}
|
||||
if (!line.equals("ready")) {
|
||||
logHandler.complain
|
||||
("##> isPublic001: UNEXPECTED debugee's signal (not \"ready\") - " + line);
|
||||
return 2/*STATUS_FAILED*/;
|
||||
}
|
||||
else {
|
||||
print_log_on_verbose("--> isPublic001: debugee's \"ready\" signal recieved!");
|
||||
}
|
||||
|
||||
logHandler.display
|
||||
("--> isPublic001: checking debugee's classes by Accessible.isPublic() method...");
|
||||
int all_classes_count = 0;
|
||||
int class_not_found_errors = 0;
|
||||
int isPublic_method_errors = 0;
|
||||
for (int i=0; i<classes_for_check.length; i++) {
|
||||
String basicName = classes_for_check[i][0];
|
||||
for (int array_measure=0; array_measure<3; array_measure++) {
|
||||
if ( array_measure == 0 ) { // not array type
|
||||
if ( classes_for_check[i][2].equals("primitive_type") ) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
all_classes_count++;
|
||||
String brackets[] = {"", "[]", "[][]"};
|
||||
String className = basicName + brackets[array_measure];
|
||||
ReferenceType refType = debugee.classByName(className);
|
||||
if (refType == null) {
|
||||
logHandler.complain("##> isPublic001: Could NOT FIND class: " + className);
|
||||
class_not_found_errors++;
|
||||
continue;
|
||||
}
|
||||
boolean isPublic = classes_for_check[i][1].equals("public");
|
||||
if (refType.isPublic() != isPublic) {
|
||||
logHandler.complain
|
||||
("##> isPublic001: UNEXPECTED isPublic() method result (" + !isPublic +
|
||||
") for class: " + className + "(" + classes_for_check[i][1] + ")");
|
||||
isPublic_method_errors++;
|
||||
}
|
||||
else {
|
||||
print_log_on_verbose
|
||||
("--> isPublic001: expected isPublic() method result (" + isPublic +
|
||||
") for class: " + className + "(" + classes_for_check[i][1] + ")");
|
||||
}
|
||||
}
|
||||
}
|
||||
logHandler.display("--> isPublic001: checking debugee's classes completed!");
|
||||
logHandler.display("--> isPublic001: number of checked classes = " + all_classes_count);
|
||||
if ( class_not_found_errors > 0 ) {
|
||||
logHandler.complain("##> isPublic001: \"class not found ERRORS\" counter = "
|
||||
+ class_not_found_errors);
|
||||
}
|
||||
if ( isPublic_method_errors > 0 ) {
|
||||
logHandler.complain("##> isPublic001: isPublic() method ERRORS counter = "
|
||||
+ isPublic_method_errors);
|
||||
}
|
||||
int v_test_result = 0/*STATUS_PASSED*/;
|
||||
if (class_not_found_errors + isPublic_method_errors > 0) {
|
||||
v_test_result = 2/*STATUS_FAILED*/;
|
||||
}
|
||||
|
||||
print_log_on_verbose("--> isPublic001: waiting for debugee finish...");
|
||||
pipe.println("quit");
|
||||
debugee.waitFor();
|
||||
|
||||
int status = debugee.getStatus();
|
||||
if (status != 0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/) {
|
||||
logHandler.complain
|
||||
("##> isPublic001: UNEXPECTED Debugee's exit status (not 95) - " + status);
|
||||
v_test_result = 2/*STATUS_FAILED*/;
|
||||
}
|
||||
else {
|
||||
print_log_on_verbose
|
||||
("--> isPublic001: expected Debugee's exit status - " + status);
|
||||
}
|
||||
|
||||
return v_test_result;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,60 @@
|
||||
/*
|
||||
* Copyright (c) 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.
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* @test
|
||||
*
|
||||
* @summary converted from VM Testbase nsk/jdi/Accessible/isPublic/isPublic001.
|
||||
* VM Testbase keywords: [jpda, jdi]
|
||||
* VM Testbase readme:
|
||||
* DESCRIPTION
|
||||
* nsk/jdi/Accessible/isPublic/isPublic001 test
|
||||
* checks the isPublic() method of Accessible interface
|
||||
* of the com.sun.jdi package for ArrayType, ClassType, InterfaceType.
|
||||
* COMMENTS
|
||||
* Bug fixed: 4434819: TEST_BUG: wrongly believe that classes are loaded
|
||||
* ---------
|
||||
* The test is updated to use new share classes as follows:
|
||||
* - two lines, 33 and 34, with argsHandler and logHandler are added
|
||||
* - statements with definitions, lines 110-123, are added;
|
||||
* - all calls to "println" are replaced with calls to
|
||||
* "logHandler.complain" or "logHandler.display"..
|
||||
* - all "display" are replaced with "logHandler.display"
|
||||
* --------
|
||||
*
|
||||
* @library /vmTestbase
|
||||
* /test/lib
|
||||
* @run driver jdk.test.lib.FileInstaller . .
|
||||
* @build nsk.jdi.Accessible.isPublic.isPublic001
|
||||
* nsk.jdi.Accessible.isPublic.isPublic001a
|
||||
* @run main/othervm PropertyResolvingWrapper
|
||||
* nsk.jdi.Accessible.isPublic.isPublic001
|
||||
* -verbose
|
||||
* -arch=${os.family}-${os.simpleArch}
|
||||
* -waittime=5
|
||||
* -debugee.vmkind=java
|
||||
* -transport.address=dynamic
|
||||
* "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}"
|
||||
*/
|
||||
|
||||
@ -0,0 +1,124 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 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 nsk.jdi.Accessible.isPublic;
|
||||
|
||||
import nsk.share.*;
|
||||
import nsk.share.jpda.*;
|
||||
import nsk.share.jdi.*;
|
||||
|
||||
|
||||
/**
|
||||
* This class is used as debugee application for the isPublic001 JDI test.
|
||||
*/
|
||||
|
||||
public class isPublic001a {
|
||||
|
||||
static boolean verbose_mode = false;
|
||||
|
||||
boolean z0, z1[]={z0}, z2[][]={z1};
|
||||
byte b0, b1[]={b0}, b2[][]={b1};
|
||||
char c0, c1[]={c0}, c2[][]={c1};
|
||||
double d0, d1[]={d0}, d2[][]={d1};
|
||||
float f0, f1[]={f0}, f2[][]={f1};
|
||||
int i0, i1[]={i0}, i2[][]={i1};
|
||||
long l0, l1[]={l0}, l2[][]={l1};
|
||||
|
||||
// Classes must be loaded and linked, so all fields must be
|
||||
// initialized
|
||||
Boolean Z0 = new Boolean(true), Z1[]={Z0}, Z2[][]={Z1};
|
||||
Byte B0 = new Byte((byte)1), B1[]={B0}, B2[][]={B1};
|
||||
Character C0 = new Character('\u00ff'), C1[]={C0}, C2[][]={C1};
|
||||
Double D0 = new Double(1.0), D1[]={D0}, D2[][]={D1};
|
||||
Float F0 = new Float(1.0f), F1[]={F0}, F2[][]={F1};
|
||||
Integer I0 = new Integer(-1), I1[]={I0}, I2[][]={I1};
|
||||
Long L0 = new Long(-1l), L1[]={L0}, L2[][]={L1};
|
||||
String S0 = new String("4434819"), S1[]={S0}, S2[][]={S1};
|
||||
Object O0 = new Object(), O1[]={O0}, O2[][]={O1};
|
||||
|
||||
private static class U {}
|
||||
protected static class V {}
|
||||
public static class W {}
|
||||
static class P {} // package private
|
||||
|
||||
U u0=new U(), u1[]={u0}, u2[][]={u1};
|
||||
V v0=new V(), v1[]={v0}, v2[][]={v1};
|
||||
W w0=new W(), w1[]={w0}, w2[][]={w1};
|
||||
P p0=new P(), p1[]={p0}, p2[][]={p1};
|
||||
|
||||
// Interfaces must be loaded and linked, so classes that implement
|
||||
// interfaces must be initialized.
|
||||
public static interface s_interf {}
|
||||
protected static class s_interf_impl implements s_interf {}
|
||||
s_interf_impl sii0 = new s_interf_impl();
|
||||
s_interf s_interf_0, s_interf_1[]={s_interf_0}, s_interf_2[][]={s_interf_1};
|
||||
|
||||
isPublic001 a001_0=new isPublic001(), a001_1[]={a001_0}, a001_2[][]={a001_1};
|
||||
|
||||
// Class isPrivate001a is initialized in method main()
|
||||
isPublic001a a0, a1[]={a0}, a2[][]={a1};
|
||||
pack_priv_cls ppc0=new pack_priv_cls(), ppc1[]={ppc0}, ppc2[][]={ppc1};
|
||||
pack_priv_interf_impl ppii0 = new pack_priv_interf_impl();
|
||||
pack_priv_interf ppi0, ppi1[]={ppi0}, ppi2[][]={ppi1};
|
||||
|
||||
private static void print_log_on_verbose(String message) {
|
||||
if ( verbose_mode ) {
|
||||
System.err.println(message);
|
||||
}
|
||||
}
|
||||
|
||||
public static void main (String argv[]) {
|
||||
|
||||
for (int i=0; i<argv.length; i++) {
|
||||
if ( argv[i].equals("-vbs") || argv[i].equals("-verbose") ) {
|
||||
verbose_mode = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
print_log_on_verbose("**> isPublic001a: debugee started!");
|
||||
isPublic001a isPublic001a_obj = new isPublic001a();
|
||||
ArgumentHandler argHandler = new ArgumentHandler(argv);
|
||||
IOPipe pipe = argHandler.createDebugeeIOPipe();
|
||||
print_log_on_verbose("**> isPublic001a: waiting for \"quit\" signal...");
|
||||
pipe.println("ready");
|
||||
String instruction = pipe.readln();
|
||||
if (instruction.equals("quit")) {
|
||||
print_log_on_verbose("**> isPublic001a: \"quit\" signal recieved!");
|
||||
print_log_on_verbose("**> isPublic001a: completed succesfully!");
|
||||
System.exit(0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/);
|
||||
}
|
||||
System.err.println("!!**> isPublic001a: unexpected signal (no \"quit\") - " + instruction);
|
||||
System.err.println("!!**> isPublic001a: FAILED!");
|
||||
System.exit(2/*STATUS_FAILED*/ + 95/*STATUS_TEMP*/);
|
||||
}
|
||||
}
|
||||
|
||||
/** Sample package-private class. */
|
||||
class pack_priv_cls {}
|
||||
|
||||
/** Sample package-private interface. */
|
||||
interface pack_priv_interf {}
|
||||
|
||||
/** Class that implements package-private interface */
|
||||
class pack_priv_interf_impl implements pack_priv_interf {}
|
||||
@ -0,0 +1,146 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 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 nsk.jdi.Accessible.isPublic;
|
||||
|
||||
import nsk.share.*;
|
||||
import nsk.share.jpda.*;
|
||||
import nsk.share.jdi.*;
|
||||
|
||||
import com.sun.jdi.*;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* The debugger application of the test.
|
||||
*/
|
||||
public class ispublic002 {
|
||||
|
||||
//------------------------------------------------------- immutable common fields
|
||||
|
||||
final static String SIGNAL_READY = "ready";
|
||||
final static String SIGNAL_GO = "go";
|
||||
final static String SIGNAL_QUIT = "quit";
|
||||
|
||||
private static int waitTime;
|
||||
private static int exitStatus;
|
||||
private static ArgumentHandler argHandler;
|
||||
private static Log log;
|
||||
private static Debugee debuggee;
|
||||
private static ReferenceType debuggeeClass;
|
||||
|
||||
//------------------------------------------------------- mutable common fields
|
||||
|
||||
private final static String prefix = "nsk.jdi.Accessible.isPublic.";
|
||||
private final static String className = "ispublic002";
|
||||
private final static String debuggerName = prefix + className;
|
||||
private final static String debuggeeName = debuggerName + "a";
|
||||
|
||||
//------------------------------------------------------- test specific fields
|
||||
|
||||
private final static String[] expectedFieldNames = {"f1", "f2", "f3"};
|
||||
private final static String[] expectedEnumFieldsNames = { "e1", "e2" };
|
||||
|
||||
//------------------------------------------------------- immutable common methods
|
||||
|
||||
public static void main(String argv[]) {
|
||||
System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out));
|
||||
}
|
||||
|
||||
private static void display(String msg) {
|
||||
log.display("debugger > " + msg);
|
||||
}
|
||||
|
||||
private static void complain(String msg) {
|
||||
log.complain("debugger FAILURE > " + msg);
|
||||
}
|
||||
|
||||
public static int run(String argv[], PrintStream out) {
|
||||
|
||||
exitStatus = Consts.TEST_PASSED;
|
||||
|
||||
argHandler = new ArgumentHandler(argv);
|
||||
log = new Log(out, argHandler);
|
||||
waitTime = argHandler.getWaitTime() * 60000;
|
||||
|
||||
debuggee = Debugee.prepareDebugee(argHandler, log, debuggeeName);
|
||||
|
||||
debuggeeClass = debuggee.classByName(debuggeeName);
|
||||
if ( debuggeeClass == null ) {
|
||||
complain("Class '" + debuggeeName + "' not found.");
|
||||
exitStatus = Consts.TEST_FAILED;
|
||||
}
|
||||
|
||||
execTest();
|
||||
|
||||
debuggee.quit();
|
||||
|
||||
return exitStatus;
|
||||
}
|
||||
|
||||
//------------------------------------------------------ mutable common method
|
||||
|
||||
private static void execTest() {
|
||||
//debuggee.receiveExpectedSignal(SIGNAL_GO);
|
||||
|
||||
for (int i=0; i < expectedFieldNames.length; i++) {
|
||||
check(expectedFieldNames[i]);
|
||||
display("");
|
||||
}
|
||||
|
||||
display("Checking completed!");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------- test specific methods
|
||||
|
||||
private static void check (String fieldName) {
|
||||
try {
|
||||
ClassType checkedClass = (ClassType)debuggeeClass.fieldByName(fieldName).type();
|
||||
String className = checkedClass.name();
|
||||
|
||||
for (int i = 0; i < expectedEnumFieldsNames.length; i++) {
|
||||
Field foundField = checkedClass.fieldByName(expectedEnumFieldsNames[i]);
|
||||
if (foundField != null) {
|
||||
if (foundField.isPublic()) {
|
||||
display("enum " + className + " has public field " + expectedEnumFieldsNames[i]);
|
||||
display("\t of type " + className);
|
||||
} else {
|
||||
complain("enum " + className + " has not-public field " + expectedEnumFieldsNames[i]);
|
||||
complain("\t of type " + className);
|
||||
exitStatus = Consts.TEST_FAILED;
|
||||
}
|
||||
} else {
|
||||
complain("enum " + className + " does not have field " + expectedEnumFieldsNames[i]);
|
||||
complain("\t of type " + className);
|
||||
exitStatus = Consts.TEST_FAILED;
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
complain("Unexpected exception while checking of " + className + ": " + e);
|
||||
e.printStackTrace(System.out);
|
||||
exitStatus = Consts.TEST_FAILED;
|
||||
}
|
||||
}
|
||||
}
|
||||
//--------------------------------------------------------- test specific classes
|
||||
@ -0,0 +1,66 @@
|
||||
/*
|
||||
* Copyright (c) 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.
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* @test
|
||||
*
|
||||
* @summary converted from VM Testbase nsk/jdi/Accessible/isPublic/ispublic002.
|
||||
* VM Testbase keywords: [quick, jpda, jdi]
|
||||
* VM Testbase readme:
|
||||
* DESCRIPTION:
|
||||
* A test for isPublic() method of TypeComponent interface.
|
||||
* The test checks if the method returns true for each enum
|
||||
* constant declared in mirrored enum type. All enum constants
|
||||
* are implicitly public according to enum spec.
|
||||
* The test consists of a debugger program (ispublic002.java)
|
||||
* and debuggee application (ispublic002a.java).
|
||||
* Package name is nsk.jdi.Accessible.isPublic .
|
||||
* The test works as follows.
|
||||
* The debugger uses nsk.jdi.share framework classes to
|
||||
* establish connection with debuggee. The debugger and debuggee
|
||||
* synchronize with each other using special commands over
|
||||
* communication channel provided by framework classes.
|
||||
* Upon receiving the signal of readiness from debuggee,
|
||||
* the debugger checks result of isPublic() method for each field
|
||||
* of enum type declared in ispublic002a class. Every of these
|
||||
* enum types has the same enum constants, i.e fields: e1 and e2.
|
||||
* COMMENTS:
|
||||
* 5029502 TEST_BUG: jdi tests against enum should not use abstract
|
||||
* modifier
|
||||
*
|
||||
* @library /vmTestbase
|
||||
* /test/lib
|
||||
* @run driver jdk.test.lib.FileInstaller . .
|
||||
* @build nsk.jdi.Accessible.isPublic.ispublic002
|
||||
* nsk.jdi.Accessible.isPublic.ispublic002a
|
||||
* @run main/othervm PropertyResolvingWrapper
|
||||
* nsk.jdi.Accessible.isPublic.ispublic002
|
||||
* -verbose
|
||||
* -arch=${os.family}-${os.simpleArch}
|
||||
* -waittime=5
|
||||
* -debugee.vmkind=java
|
||||
* -transport.address=dynamic
|
||||
* "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}"
|
||||
*/
|
||||
|
||||
@ -0,0 +1,110 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 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 nsk.jdi.Accessible.isPublic;
|
||||
|
||||
import nsk.share.*;
|
||||
import nsk.share.jpda.*;
|
||||
import nsk.share.jdi.*;
|
||||
|
||||
/**
|
||||
* The debugged application of the test.
|
||||
*/
|
||||
public class ispublic002a {
|
||||
|
||||
//------------------------------------------------------- immutable common fields
|
||||
|
||||
private static int exitStatus;
|
||||
private static ArgumentHandler argHandler;
|
||||
private static Log log;
|
||||
private static IOPipe pipe;
|
||||
|
||||
//------------------------------------------------------- immutable common methods
|
||||
|
||||
static void display(String msg) {
|
||||
log.display("debuggee > " + msg);
|
||||
}
|
||||
|
||||
static void complain(String msg) {
|
||||
log.complain("debuggee FAILURE > " + msg);
|
||||
}
|
||||
|
||||
public static void receiveSignal(String signal) {
|
||||
String line = pipe.readln();
|
||||
|
||||
if ( !line.equals(signal) )
|
||||
throw new Failure("UNEXPECTED debugger's signal " + line);
|
||||
|
||||
display("debugger's <" + signal + "> signal received.");
|
||||
}
|
||||
|
||||
//------------------------------------------------------ mutable common fields
|
||||
|
||||
//------------------------------------------------------ test specific fields
|
||||
|
||||
static ispublic002Enum1 f1 = ispublic002Enum1.e2;
|
||||
static ispublic002Enum2 f2 = ispublic002Enum2.e1;
|
||||
static ispublic002Enum1.Enum1_ f3 = ispublic002Enum1.Enum1_.e1;
|
||||
|
||||
//------------------------------------------------------ mutable common method
|
||||
|
||||
public static void main (String argv[]) {
|
||||
exitStatus = Consts.TEST_FAILED;
|
||||
argHandler = new ArgumentHandler(argv);
|
||||
log = new Log(System.err, argHandler);
|
||||
pipe = argHandler.createDebugeeIOPipe(log);
|
||||
|
||||
pipe.println(ispublic002.SIGNAL_READY);
|
||||
|
||||
|
||||
//pipe.println(ispublic002.SIGNAL_GO);
|
||||
receiveSignal(ispublic002.SIGNAL_QUIT);
|
||||
|
||||
display("completed succesfully.");
|
||||
System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------- test specific inner classes
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------- test specific classes
|
||||
|
||||
enum ispublic002Enum1 {
|
||||
e1, e2;
|
||||
|
||||
enum Enum1_ {
|
||||
e1, e2;
|
||||
}
|
||||
}
|
||||
|
||||
enum ispublic002Enum2 {
|
||||
e1 {
|
||||
int val() {return 1;}
|
||||
},
|
||||
|
||||
e2 {
|
||||
int val() {return 2;}
|
||||
};
|
||||
abstract int val();
|
||||
}
|
||||
@ -0,0 +1,132 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 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 nsk.jdi.Accessible.isPublic;
|
||||
|
||||
import nsk.share.*;
|
||||
import nsk.share.jpda.*;
|
||||
import nsk.share.jdi.*;
|
||||
|
||||
import com.sun.jdi.*;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* The debugger application of the test.
|
||||
*/
|
||||
public class ispublic003 {
|
||||
|
||||
//------------------------------------------------------- immutable common fields
|
||||
|
||||
final static String SIGNAL_READY = "ready";
|
||||
final static String SIGNAL_GO = "go";
|
||||
final static String SIGNAL_QUIT = "quit";
|
||||
|
||||
private static int waitTime;
|
||||
private static int exitStatus;
|
||||
private static ArgumentHandler argHandler;
|
||||
private static Log log;
|
||||
private static Debugee debuggee;
|
||||
private static ReferenceType debuggeeClass;
|
||||
|
||||
//------------------------------------------------------- mutable common fields
|
||||
|
||||
private final static String prefix = "nsk.jdi.Accessible.isPublic.";
|
||||
private final static String className = "ispublic003";
|
||||
private final static String debuggerName = prefix + className;
|
||||
private final static String debuggeeName = debuggerName + "a";
|
||||
|
||||
//------------------------------------------------------- test specific fields
|
||||
|
||||
private final static String[] testedFieldNames = {"f1", "f2", "f4"};
|
||||
|
||||
//------------------------------------------------------- immutable common methods
|
||||
|
||||
public static void main(String argv[]) {
|
||||
System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out));
|
||||
}
|
||||
|
||||
private static void display(String msg) {
|
||||
log.display("debugger > " + msg);
|
||||
}
|
||||
|
||||
private static void complain(String msg) {
|
||||
log.complain("debugger FAILURE > " + msg);
|
||||
}
|
||||
|
||||
public static int run(String argv[], PrintStream out) {
|
||||
|
||||
exitStatus = Consts.TEST_PASSED;
|
||||
|
||||
argHandler = new ArgumentHandler(argv);
|
||||
log = new Log(out, argHandler);
|
||||
waitTime = argHandler.getWaitTime() * 60000;
|
||||
|
||||
debuggee = Debugee.prepareDebugee(argHandler, log, debuggeeName);
|
||||
|
||||
debuggeeClass = debuggee.classByName(debuggeeName);
|
||||
if ( debuggeeClass == null ) {
|
||||
complain("Class '" + debuggeeName + "' not found.");
|
||||
exitStatus = Consts.TEST_FAILED;
|
||||
}
|
||||
|
||||
execTest();
|
||||
|
||||
debuggee.quit();
|
||||
|
||||
return exitStatus;
|
||||
}
|
||||
|
||||
//------------------------------------------------------ mutable common method
|
||||
|
||||
private static void execTest() {
|
||||
for (int i=0; i < testedFieldNames.length; i++) {
|
||||
check(testedFieldNames[i]);
|
||||
display("");
|
||||
}
|
||||
display("Checking completed!");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------- test specific methods
|
||||
|
||||
private static void check (String fieldName) {
|
||||
try {
|
||||
ClassType checkedClass = (ClassType)debuggeeClass.fieldByName(fieldName).type();
|
||||
String className = checkedClass.name();
|
||||
|
||||
if (checkedClass.isPublic()) {
|
||||
display("Accessible.isPublic() returned true for " + className);
|
||||
} else {
|
||||
complain("Accessible.isPublic() returned false for " + className);
|
||||
exitStatus = Consts.TEST_FAILED;
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
complain("Unexpected exception while checking of " + className + ": " + e);
|
||||
e.printStackTrace(System.out);
|
||||
exitStatus = Consts.TEST_FAILED;
|
||||
}
|
||||
}
|
||||
}
|
||||
//--------------------------------------------------------- test specific classes
|
||||
@ -0,0 +1,63 @@
|
||||
/*
|
||||
* Copyright (c) 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.
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* @test
|
||||
*
|
||||
* @summary converted from VM Testbase nsk/jdi/Accessible/isPublic/ispublic003.
|
||||
* VM Testbase keywords: [quick, jpda, jdi]
|
||||
* VM Testbase readme:
|
||||
* DESCRIPTION:
|
||||
* A test for isPublic() method of ReferenceType interface.
|
||||
* The test checks if the method returns true any mirrored
|
||||
* enum type which has public modifier.
|
||||
* The test consists of a debugger program (ispublic003.java)
|
||||
* and debuggee application (ispublic003a.java).
|
||||
* Package name is nsk.jdi.Accessible.isPublic .
|
||||
* The test works as follows.
|
||||
* The debugger uses nsk.jdi.share framework classes to
|
||||
* establish connection with debuggee. The debugger and debuggee
|
||||
* synchronize with each other using special commands over
|
||||
* communication channel provided by framework classes.
|
||||
* Upon receiving the signal of readiness from debuggee,
|
||||
* the debugger calls isPublic() method for each field
|
||||
* of enum type declared in ispublic003a class.
|
||||
* The test fails if false is returned once or more times.
|
||||
* COMMENTS:
|
||||
*
|
||||
* @library /vmTestbase
|
||||
* /test/lib
|
||||
* @run driver jdk.test.lib.FileInstaller . .
|
||||
* @build nsk.jdi.Accessible.isPublic.ispublic003
|
||||
* nsk.jdi.Accessible.isPublic.ispublic003a
|
||||
* @run main/othervm PropertyResolvingWrapper
|
||||
* nsk.jdi.Accessible.isPublic.ispublic003
|
||||
* -verbose
|
||||
* -arch=${os.family}-${os.simpleArch}
|
||||
* -waittime=5
|
||||
* -debugee.vmkind=java
|
||||
* -transport.address=dynamic
|
||||
* "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}"
|
||||
*/
|
||||
|
||||
@ -0,0 +1,105 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 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 nsk.jdi.Accessible.isPublic;
|
||||
|
||||
import nsk.share.*;
|
||||
import nsk.share.jpda.*;
|
||||
import nsk.share.jdi.*;
|
||||
|
||||
/**
|
||||
* The debugged application of the test.
|
||||
*/
|
||||
public class ispublic003a {
|
||||
|
||||
//------------------------------------------------------- immutable common fields
|
||||
|
||||
private static int exitStatus;
|
||||
private static ArgumentHandler argHandler;
|
||||
private static Log log;
|
||||
private static IOPipe pipe;
|
||||
|
||||
//------------------------------------------------------- immutable common methods
|
||||
|
||||
static void display(String msg) {
|
||||
log.display("debuggee > " + msg);
|
||||
}
|
||||
|
||||
static void complain(String msg) {
|
||||
log.complain("debuggee FAILURE > " + msg);
|
||||
}
|
||||
|
||||
public static void receiveSignal(String signal) {
|
||||
String line = pipe.readln();
|
||||
|
||||
if ( !line.equals(signal) )
|
||||
throw new Failure("UNEXPECTED debugger's signal " + line);
|
||||
|
||||
display("debugger's <" + signal + "> signal received.");
|
||||
}
|
||||
|
||||
//------------------------------------------------------ mutable common fields
|
||||
|
||||
//------------------------------------------------------ test specific fields
|
||||
|
||||
static Enum1 f1 = Enum1.e1;
|
||||
static Enum1.Enum1_ f2 = Enum1.Enum1_.e1;
|
||||
static ispublic003Enum2 f3 = ispublic003Enum2.e2;
|
||||
static ispublic003Enum2.Enum2_ f4 = ispublic003Enum2.Enum2_.e1;
|
||||
|
||||
//------------------------------------------------------ mutable common method
|
||||
|
||||
public static void main (String argv[]) {
|
||||
exitStatus = Consts.TEST_FAILED;
|
||||
argHandler = new ArgumentHandler(argv);
|
||||
log = new Log(System.err, argHandler);
|
||||
pipe = argHandler.createDebugeeIOPipe(log);
|
||||
|
||||
pipe.println(ispublic003.SIGNAL_READY);
|
||||
receiveSignal(ispublic003.SIGNAL_QUIT);
|
||||
|
||||
display("completed succesfully.");
|
||||
System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------- test specific inner classes
|
||||
|
||||
public enum Enum1 {
|
||||
e1, e2;
|
||||
|
||||
public enum Enum1_ {
|
||||
e1, e2;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------- test specific classes
|
||||
|
||||
enum ispublic003Enum2 {
|
||||
e1, e2;
|
||||
|
||||
public enum Enum2_ {
|
||||
e1, e2;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,245 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 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 nsk.jdi.Accessible.modifiers;
|
||||
|
||||
import nsk.share.*;
|
||||
import nsk.share.jpda.*;
|
||||
import nsk.share.jdi.*;
|
||||
|
||||
import com.sun.jdi.*;
|
||||
import java.util.*;
|
||||
import java.io.*;
|
||||
|
||||
/**
|
||||
* The modifiers001 test checks the method <code>modifiers()</code>
|
||||
* of the JDI interface <code>Accessible</code> of com.sun.jdi package
|
||||
* for ClassType, InterfaceType
|
||||
*/
|
||||
|
||||
public class modifiers001 extends Log {
|
||||
static java.io.PrintStream out_stream;
|
||||
static boolean verbose_mode = false;
|
||||
|
||||
/** The main class names of the debugger & debugee applications. */
|
||||
private final static String
|
||||
package_prefix = "nsk.jdi.Accessible.modifiers.",
|
||||
// package_prefix = "", // for DEBUG without package
|
||||
thisClassName = package_prefix + "modifiers001",
|
||||
debugeeName = thisClassName + "a";
|
||||
|
||||
|
||||
static ArgumentHandler argsHandler;
|
||||
private static Log logHandler;
|
||||
|
||||
|
||||
/** Debugee's classes for check **/
|
||||
private final static String classes_for_check[][] = {
|
||||
|
||||
{"java.lang.Boolean" , "public, final", "class"},
|
||||
{"java.lang.Byte" , "public, final", "class"},
|
||||
{"java.lang.Character", "public, final", "class"},
|
||||
{"java.lang.Double" , "public, final", "class"},
|
||||
{"java.lang.Float" , "public, final", "class"},
|
||||
{"java.lang.Integer" , "public, final", "class"},
|
||||
{"java.lang.Long" , "public, final", "class"},
|
||||
{"java.lang.String" , "public, final", "class"},
|
||||
{"java.lang.Object" , "public ", "class"},
|
||||
|
||||
{thisClassName, "public", "class"},
|
||||
{thisClassName+"a", "public", "class"},
|
||||
|
||||
{debugeeName+"$fin_s_cls", "final, static", "class"},
|
||||
{debugeeName+"$abs_s_cls", "abstract, static", "class"},
|
||||
{debugeeName+"$s_interf", "abstract, static, interface", "interface"},
|
||||
|
||||
{package_prefix + "simple_class", "<no modifiers>", "class"},
|
||||
{package_prefix + "abstract_class", "abstract", "class"},
|
||||
{package_prefix + "final_class", "final", "class"},
|
||||
{package_prefix + "interf", "abstract, interface", "interface"}
|
||||
};
|
||||
|
||||
/**
|
||||
* Re-call to <code>run(args,out)</code>, and exit with
|
||||
* either status 95 or 97 (JCK-like exit status).
|
||||
*/
|
||||
public static void main (String argv[]) {
|
||||
int exitCode = run(argv,System.out);
|
||||
System.exit(exitCode + 95/*STATUS_TEMP*/);
|
||||
}
|
||||
|
||||
/**
|
||||
* JCK-like entry point to the test: perform testing, and
|
||||
* return exit code 0 (PASSED) or either 2 (FAILED).
|
||||
*/
|
||||
public static int run (String argv[], PrintStream out) {
|
||||
out_stream = out;
|
||||
|
||||
int v_test_result = new modifiers001().runThis(argv,out_stream);
|
||||
if ( v_test_result == 2/*STATUS_FAILED*/ ) {
|
||||
logHandler.complain("\n==> nsk/jdi/Accessible/modifiers/modifiers001 test FAILED");
|
||||
}
|
||||
else {
|
||||
logHandler.display("\n==> nsk/jdi/Accessible/modifiers/modifiers001 test PASSED");
|
||||
}
|
||||
return v_test_result;
|
||||
}
|
||||
|
||||
private void print_log_on_verbose(String message) {
|
||||
logHandler.display(message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Non-static variant of the method <code>run(args,out)</code>
|
||||
*/
|
||||
private int runThis (String argv[], PrintStream out) {
|
||||
if ( out_stream == null ) {
|
||||
out_stream = out;
|
||||
}
|
||||
|
||||
|
||||
Debugee debugee;
|
||||
|
||||
argsHandler = new ArgumentHandler(argv);
|
||||
logHandler = new Log(out, argsHandler);
|
||||
Binder binder = new Binder(argsHandler, logHandler);
|
||||
|
||||
|
||||
if (argsHandler.verbose()) {
|
||||
debugee = binder.bindToDebugee(debugeeName + " -vbs");
|
||||
} else {
|
||||
debugee = binder.bindToDebugee(debugeeName);
|
||||
}
|
||||
|
||||
IOPipe pipe = new IOPipe(debugee);
|
||||
|
||||
|
||||
logHandler.display("==> nsk/jdi/Accessible/modifiers/modifiers001 test LOG:");
|
||||
logHandler.display("==> test checks the modifiers() method of Accessible interface");
|
||||
logHandler.display(" of the com.sun.jdi package for ClassType, InterfaceType\n");
|
||||
|
||||
|
||||
debugee.redirectStderr(out);
|
||||
print_log_on_verbose("--> modifiers001: modifiers001a debugee launched");
|
||||
debugee.resume();
|
||||
|
||||
String line = pipe.readln();
|
||||
if (line == null) {
|
||||
logHandler.complain
|
||||
("##> modifiers001: UNEXPECTED debugee's signal (not \"ready\") - " + line);
|
||||
return 2/*STATUS_FAILED*/;
|
||||
}
|
||||
if (!line.equals("ready")) {
|
||||
logHandler.complain
|
||||
("##> modifiers001: UNEXPECTED debugee's signal (not \"ready\") - " + line);
|
||||
return 2/*STATUS_FAILED*/;
|
||||
}
|
||||
else {
|
||||
print_log_on_verbose("--> modifiers001: debugee's \"ready\" signal recieved!");
|
||||
}
|
||||
|
||||
logHandler.display
|
||||
("--> modifiers001: checking debugee's classes by Accessible.modifiers() method...\n");
|
||||
int all_classes_count = 0;
|
||||
int class_not_found_errors = 0;
|
||||
int class_not_found_exceptions = 0;
|
||||
int modifiers_method_errors = 0;
|
||||
// modifiers001a obj = new modifiers001a();
|
||||
for (int i=0; i<classes_for_check.length; i++) {
|
||||
String className = classes_for_check[i][0];
|
||||
all_classes_count++;
|
||||
ReferenceType refType = debugee.classByName(className);
|
||||
if (refType == null) {
|
||||
logHandler.complain("##> isPublic001: Could NOT FIND class: " + className);
|
||||
class_not_found_errors++;
|
||||
continue;
|
||||
}
|
||||
Class class_obj;
|
||||
try {
|
||||
class_obj = Class.forName(className);
|
||||
}
|
||||
catch (ClassNotFoundException e) {
|
||||
logHandler.complain
|
||||
("##> modifiers001: Class.forName("+className+") - "+e.toString());
|
||||
class_not_found_exceptions++;
|
||||
continue;
|
||||
}
|
||||
int expected_modifiers = class_obj.getModifiers();
|
||||
String s_type = classes_for_check[i][2];
|
||||
String s_modifiers = classes_for_check[i][1];
|
||||
int got_modifiers = refType.modifiers();
|
||||
// Class.getModifiers() will never return ACC_SUPER
|
||||
// but Accessible.modifers() can, so ignore this bit
|
||||
got_modifiers &= ~0x20; // 0x20 == ACC_SUPER
|
||||
logHandler.display("");
|
||||
if ( got_modifiers != expected_modifiers ) {
|
||||
logHandler.complain("##> modifiers001: UNEXPECTED modifiers() method result ("
|
||||
+ "0x" + Integer.toHexString(got_modifiers) + ") for " + s_type + ": " + className
|
||||
+ "(" + s_modifiers + ")");
|
||||
logHandler.complain("##> expected modifiers() method result = "
|
||||
+ "0x" + Integer.toHexString(expected_modifiers));
|
||||
modifiers_method_errors++;
|
||||
}
|
||||
else {
|
||||
print_log_on_verbose("--> modifiers001: expected modifiers() method result ("
|
||||
+ "0x" + Integer.toHexString(got_modifiers) + ") for " + s_type + ": " + className
|
||||
+ "(" + s_modifiers + ")");
|
||||
}
|
||||
}
|
||||
logHandler.display
|
||||
("--> modifiers001: checking debugee's classes completed!");
|
||||
logHandler.display
|
||||
("--> modifiers001: number of checked classes = " + all_classes_count);
|
||||
if ( class_not_found_errors > 0 ) {
|
||||
logHandler.complain("##> modifiers001: \"class not found ERRORS\" counter = "
|
||||
+ class_not_found_errors);
|
||||
}
|
||||
if ( class_not_found_exceptions > 0 ) {
|
||||
logHandler.complain("##> modifiers001: \"class not found EXCEPTIONS\" counter = "
|
||||
+ class_not_found_exceptions);
|
||||
}
|
||||
logHandler.display("##> modifiers001: modifiers() method ERRORS counter = "
|
||||
+ modifiers_method_errors);
|
||||
int v_test_result = 0/*STATUS_PASSED*/;
|
||||
if (class_not_found_errors + class_not_found_exceptions + modifiers_method_errors > 0) {
|
||||
v_test_result = 2/*STATUS_FAILED*/;
|
||||
}
|
||||
|
||||
print_log_on_verbose("--> modifiers001: waiting for debugee finish...");
|
||||
pipe.println("quit");
|
||||
debugee.waitFor();
|
||||
|
||||
int status = debugee.getStatus();
|
||||
if (status != 0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/) {
|
||||
logHandler.complain
|
||||
("##> modifiers001: UNEXPECTED Debugee's exit status (not 95) - " + status);
|
||||
v_test_result = 2/*STATUS_FAILED*/;
|
||||
}
|
||||
else {
|
||||
print_log_on_verbose
|
||||
("--> modifiers001: expected Debugee's exit status - " + status);
|
||||
}
|
||||
|
||||
return v_test_result;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,61 @@
|
||||
/*
|
||||
* Copyright (c) 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.
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* @test
|
||||
*
|
||||
* @summary converted from VM Testbase nsk/jdi/Accessible/modifiers/modifiers001.
|
||||
* VM Testbase keywords: [jpda, jdi]
|
||||
* VM Testbase readme:
|
||||
* DESCRIPTION
|
||||
* nsk/jdi/Accessible/modifiers/modifiers001 test
|
||||
* checks the modifiers() method of Accessible interface
|
||||
* of the com.sun.jdi package for ClassType, InterfaceType.
|
||||
* COMMENTS
|
||||
* Bug fixed: 4434819: TEST_BUG: wrongly believe that classes are loaded
|
||||
* ---------
|
||||
* The test is updated to use new share classes as follows:
|
||||
* - two lines, 33 and 34, with argsHandler and logHandler are added befo
|
||||
* - statements with definitions, lines 102-115, are added;
|
||||
* - all calls to "println" are replaced with calls to
|
||||
* "logHandler.complain" or "logHandler.display"..
|
||||
* - all "display" are replaced with "logHandler.display"
|
||||
* - one non-used statement, line 148, is commented away.
|
||||
* --------
|
||||
*
|
||||
* @library /vmTestbase
|
||||
* /test/lib
|
||||
* @run driver jdk.test.lib.FileInstaller . .
|
||||
* @build nsk.jdi.Accessible.modifiers.modifiers001
|
||||
* nsk.jdi.Accessible.modifiers.modifiers001a
|
||||
* @run main/othervm PropertyResolvingWrapper
|
||||
* nsk.jdi.Accessible.modifiers.modifiers001
|
||||
* -verbose
|
||||
* -arch=${os.family}-${os.simpleArch}
|
||||
* -waittime=5
|
||||
* -debugee.vmkind=java
|
||||
* -transport.address=dynamic
|
||||
* "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}"
|
||||
*/
|
||||
|
||||
@ -0,0 +1,125 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 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 nsk.jdi.Accessible.modifiers;
|
||||
|
||||
import nsk.share.*;
|
||||
import nsk.share.jpda.*;
|
||||
import nsk.share.jdi.*;
|
||||
|
||||
|
||||
/**
|
||||
* This class is used as debugee application for the modifiers001 JDI test.
|
||||
*/
|
||||
|
||||
public class modifiers001a {
|
||||
|
||||
static boolean verbose_mode = false;
|
||||
|
||||
// Classes must be loaded and linked, so all fields must be
|
||||
// initialized
|
||||
Boolean Z0 = new Boolean(false);
|
||||
Byte B0 = new Byte((byte)1);
|
||||
Character C0 = new Character('c');
|
||||
Double D0 = new Double(1);
|
||||
Float F0 = new Float(1);
|
||||
Integer I0 = new Integer(1);
|
||||
Long L0 = new Long(1);
|
||||
String S0 = new String("s");
|
||||
Object O0 = new Object();
|
||||
|
||||
modifiers001 m001_0=new modifiers001();
|
||||
modifiers001a m001a_0, m001a_1[] = {m001a_0};
|
||||
|
||||
final static class fin_s_cls {}
|
||||
abstract static class abs_s_cls {}
|
||||
static class abs_s_cls_ext extends abs_s_cls {}
|
||||
static interface s_interf {}
|
||||
static class s_interf_impl implements s_interf {}
|
||||
|
||||
// Interfaces and abstract classes must be loaded and linked, so classes
|
||||
// that implement interfaces and extend abstract classes must be
|
||||
// initialized
|
||||
fin_s_cls fin_s_cls_0 = new fin_s_cls();
|
||||
abs_s_cls_ext abs_s_cls_ext_0 = new abs_s_cls_ext();
|
||||
abs_s_cls abs_s_cls_0, abs_s_cls_1[] = {abs_s_cls_0};
|
||||
s_interf_impl s_interf_impl_0 = new s_interf_impl();
|
||||
s_interf s_interf_0, s_interf_1[] = {s_interf_0};
|
||||
|
||||
simple_class m_simpleclass_0 = new simple_class();
|
||||
abstract_class_ext m_absclass_ext_0 = new abstract_class_ext();
|
||||
abstract_class m_absclass_0, m_absclass_1[] = {m_absclass_0};
|
||||
final_class m_finclass_0 = new final_class();
|
||||
interf_impl m_interf_impl_0 = new interf_impl();
|
||||
interf m_interf_0, m_interf_1[] = {m_interf_0};
|
||||
|
||||
private static void print_log_on_verbose(String message) {
|
||||
if ( verbose_mode ) {
|
||||
System.err.println(message);
|
||||
}
|
||||
}
|
||||
|
||||
public static void main (String argv[]) {
|
||||
|
||||
for (int i=0; i<argv.length; i++) {
|
||||
if ( argv[i].equals("-vbs") || argv[i].equals("-verbose") ) {
|
||||
verbose_mode = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
print_log_on_verbose("**> modifiers001a: debugee started!");
|
||||
modifiers001a obj = new modifiers001a();
|
||||
ArgumentHandler argHandler = new ArgumentHandler(argv);
|
||||
IOPipe pipe = argHandler.createDebugeeIOPipe();
|
||||
print_log_on_verbose("**> modifiers001a: waiting for \"quit\" signal...");
|
||||
pipe.println("ready");
|
||||
String instruction = pipe.readln();
|
||||
if (instruction.equals("quit")) {
|
||||
print_log_on_verbose("**> modifiers001a: \"quit\" signal recieved!");
|
||||
print_log_on_verbose("**> modifiers001a: completed succesfully!");
|
||||
System.exit(0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/);
|
||||
}
|
||||
System.err.println("!!**> modifiers001a: unexpected signal (no \"quit\") - " + instruction);
|
||||
System.err.println("!!**> modifiers001a: FAILED!");
|
||||
System.exit(2/*STATUS_FAILED*/ + 95/*STATUS_TEMP*/);
|
||||
}
|
||||
}
|
||||
|
||||
/** simple class */
|
||||
class simple_class {}
|
||||
|
||||
/** abstract class */
|
||||
abstract class abstract_class {}
|
||||
|
||||
/** Class that extends abstract class */
|
||||
class abstract_class_ext extends abstract_class {}
|
||||
|
||||
/** final class */
|
||||
final class final_class {}
|
||||
|
||||
/** simple interface */
|
||||
interface interf {}
|
||||
|
||||
/** Class that implements interface */
|
||||
class interf_impl implements interf {}
|
||||
@ -0,0 +1,160 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 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 nsk.jdi.Accessible.modifiers;
|
||||
|
||||
import nsk.share.*;
|
||||
import nsk.share.jpda.*;
|
||||
import nsk.share.jdi.*;
|
||||
|
||||
import com.sun.jdi.*;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* The debugger application of the test.
|
||||
*/
|
||||
public class modifiers002 {
|
||||
|
||||
//------------------------------------------------------- immutable common fields
|
||||
|
||||
final static String SIGNAL_READY = "ready";
|
||||
final static String SIGNAL_GO = "go";
|
||||
final static String SIGNAL_QUIT = "quit";
|
||||
|
||||
private static int waitTime;
|
||||
private static int exitStatus;
|
||||
private static ArgumentHandler argHandler;
|
||||
private static Log log;
|
||||
private static Debugee debuggee;
|
||||
private static ReferenceType debuggeeClass;
|
||||
|
||||
//------------------------------------------------------- mutable common fields
|
||||
|
||||
private final static String prefix = "nsk.jdi.Accessible.modifiers.";
|
||||
private final static String className = "modifiers002";
|
||||
private final static String debuggerName = prefix + className;
|
||||
private final static String debuggeeName = debuggerName + "a";
|
||||
|
||||
//------------------------------------------------------- test specific fields
|
||||
|
||||
private final static String[] testedFieldNames = {"f1", "f2", "f3"};
|
||||
|
||||
//------------------------------------------------------- immutable common methods
|
||||
|
||||
public static void main(String argv[]) {
|
||||
System.exit(Consts.JCK_STATUS_BASE + run(argv, System.out));
|
||||
}
|
||||
|
||||
private static void display(String msg) {
|
||||
log.display("debugger > " + msg);
|
||||
}
|
||||
|
||||
private static void complain(String msg) {
|
||||
log.complain("debugger FAILURE > " + msg);
|
||||
}
|
||||
|
||||
public static int run(String argv[], PrintStream out) {
|
||||
|
||||
exitStatus = Consts.TEST_PASSED;
|
||||
|
||||
argHandler = new ArgumentHandler(argv);
|
||||
log = new Log(out, argHandler);
|
||||
waitTime = argHandler.getWaitTime() * 60000;
|
||||
|
||||
debuggee = Debugee.prepareDebugee(argHandler, log, debuggeeName);
|
||||
|
||||
debuggeeClass = debuggee.classByName(debuggeeName);
|
||||
if ( debuggeeClass == null ) {
|
||||
complain("Class '" + debuggeeName + "' not found.");
|
||||
exitStatus = Consts.TEST_FAILED;
|
||||
}
|
||||
|
||||
execTest();
|
||||
|
||||
debuggee.quit();
|
||||
|
||||
return exitStatus;
|
||||
}
|
||||
|
||||
//------------------------------------------------------ mutable common method
|
||||
|
||||
private static void execTest() {
|
||||
for (int i=0; i < testedFieldNames.length; i++) {
|
||||
check(testedFieldNames[i]);
|
||||
display("");
|
||||
}
|
||||
display("Checking completed!");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------- test specific methods
|
||||
|
||||
private static void check (String fieldName) {
|
||||
try {
|
||||
ClassType checkedClass = (ClassType)debuggeeClass.fieldByName(fieldName).type();
|
||||
String className = checkedClass.name();
|
||||
|
||||
int modifiers = checkedClass.modifiers();
|
||||
if (fieldName.equals("f1") || fieldName.equals("f2")) {
|
||||
if ((0x0010 & modifiers) == 0x0010 /* ACC_FINAL */) {
|
||||
display("Accessible.modifiers() returned expected ACC_FINAL flag for type: " + className);
|
||||
} else {
|
||||
complain("Accessible.modifiers() did not return ACC_FINAL flag for type: " + className);
|
||||
exitStatus = Consts.TEST_FAILED;
|
||||
}
|
||||
}
|
||||
|
||||
if ((0x0020 & modifiers) == 0x0020 /* ACC_SUPER */) {
|
||||
display("Accessible.modifiers() returned expected ACC_SUPER flag for type: " + className);
|
||||
} else {
|
||||
complain("Accessible.modifiers() did not return ACC_SUPER flag for type: " + className);
|
||||
exitStatus = Consts.TEST_FAILED;
|
||||
}
|
||||
|
||||
if (fieldName.equals("f2")) {
|
||||
if ((0x0001 & modifiers) == 0x0001 /* ACC_PUBLIC */) {
|
||||
display("Accessible.modifiers() returned expected ACC_PUBLIC flag for type: " + className);
|
||||
} else {
|
||||
complain("Accessible.modifiers() did not return ACC_PUBLIC flag for type: " + className);
|
||||
exitStatus = Consts.TEST_FAILED;
|
||||
}
|
||||
}
|
||||
|
||||
if (fieldName.equals("f3")) {
|
||||
if ((0x0400 & modifiers) == 0x0400 /* ACC_ABSTRACT */) {
|
||||
display("Accessible.modifiers() returned expected ACC_ABSTRACT flag for type: " + className);
|
||||
} else {
|
||||
complain("Accessible.modifiers() did not return ACC_ABSTRACT flag for type: " + className);
|
||||
exitStatus = Consts.TEST_FAILED;
|
||||
}
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
complain("Unexpected exception while checking of " + className + ": " + e);
|
||||
e.printStackTrace(System.out);
|
||||
exitStatus = Consts.TEST_FAILED;
|
||||
}
|
||||
}
|
||||
}
|
||||
//--------------------------------------------------------- test specific classes
|
||||
@ -0,0 +1,71 @@
|
||||
/*
|
||||
* Copyright (c) 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.
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* @test
|
||||
*
|
||||
* @summary converted from VM Testbase nsk/jdi/Accessible/modifiers/modifiers002.
|
||||
* VM Testbase keywords: [quick, jpda, jdi]
|
||||
* VM Testbase readme:
|
||||
* DESCRIPTION:
|
||||
* A test for isEnum() method of Accessible interface.
|
||||
* The test checks if the method returns int status combined
|
||||
* as from following flags for any mirrored enum type:
|
||||
* - ACC_FINAL (0x0010) for any enum type because each enum types
|
||||
* is final,
|
||||
* - ACC_SUPER (0x0020 for any enum type due to
|
||||
* JVMS 4.1 The ClassFile Structure
|
||||
* - ACC_PUBLIC (0x0001) if public modifier is declared,
|
||||
* - ACC_ABSTRACT (0x0400) if abstract modifier is declared.
|
||||
* The test consists of a debugger program (modifiers002.java)
|
||||
* and debuggee application (modifiers002a.java).
|
||||
* Package name is nsk.jdi.Accessible.modifiers .
|
||||
* The test works as follows.
|
||||
* The debugger uses nsk.jdi.share framework classes to
|
||||
* establish connection with debuggee. The debugger and debuggee
|
||||
* synchronize with each other using special commands over
|
||||
* communication channel provided by framework classes.
|
||||
* Upon receiving the signal of readiness from debuggee,
|
||||
* the debugger calls modifiers() method for each field
|
||||
* of enum type declared in modifiers002a class.
|
||||
* The result is bitwise compared with expected flags.
|
||||
* COMMENTS:
|
||||
* 5029502 TEST_BUG: jdi tests against enum should not use abstract
|
||||
* modifier
|
||||
*
|
||||
* @library /vmTestbase
|
||||
* /test/lib
|
||||
* @run driver jdk.test.lib.FileInstaller . .
|
||||
* @build nsk.jdi.Accessible.modifiers.modifiers002
|
||||
* nsk.jdi.Accessible.modifiers.modifiers002a
|
||||
* @run main/othervm PropertyResolvingWrapper
|
||||
* nsk.jdi.Accessible.modifiers.modifiers002
|
||||
* -verbose
|
||||
* -arch=${os.family}-${os.simpleArch}
|
||||
* -waittime=5
|
||||
* -debugee.vmkind=java
|
||||
* -transport.address=dynamic
|
||||
* "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}"
|
||||
*/
|
||||
|
||||
@ -0,0 +1,106 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 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 nsk.jdi.Accessible.modifiers;
|
||||
|
||||
import nsk.share.*;
|
||||
import nsk.share.jpda.*;
|
||||
import nsk.share.jdi.*;
|
||||
|
||||
/**
|
||||
* The debugged application of the test.
|
||||
*/
|
||||
public class modifiers002a {
|
||||
|
||||
//------------------------------------------------------- immutable common fields
|
||||
|
||||
private static int exitStatus;
|
||||
private static ArgumentHandler argHandler;
|
||||
private static Log log;
|
||||
private static IOPipe pipe;
|
||||
|
||||
//------------------------------------------------------- immutable common methods
|
||||
|
||||
static void display(String msg) {
|
||||
log.display("debuggee > " + msg);
|
||||
}
|
||||
|
||||
static void complain(String msg) {
|
||||
log.complain("debuggee FAILURE > " + msg);
|
||||
}
|
||||
|
||||
public static void receiveSignal(String signal) {
|
||||
String line = pipe.readln();
|
||||
|
||||
if ( !line.equals(signal) )
|
||||
throw new Failure("UNEXPECTED debugger's signal " + line);
|
||||
|
||||
display("debugger's <" + signal + "> signal received.");
|
||||
}
|
||||
|
||||
//------------------------------------------------------ mutable common fields
|
||||
|
||||
//------------------------------------------------------ test specific fields
|
||||
|
||||
static Enum1 f1 = Enum1.e1;
|
||||
static Enum2 f2 = Enum2.e2;
|
||||
static Enum3 f3 = Enum3.e1;
|
||||
|
||||
//------------------------------------------------------ mutable common method
|
||||
|
||||
public static void main (String argv[]) {
|
||||
exitStatus = Consts.TEST_FAILED;
|
||||
argHandler = new ArgumentHandler(argv);
|
||||
log = new Log(System.err, argHandler);
|
||||
pipe = argHandler.createDebugeeIOPipe(log);
|
||||
|
||||
pipe.println(modifiers002.SIGNAL_READY);
|
||||
receiveSignal(modifiers002.SIGNAL_QUIT);
|
||||
|
||||
display("completed succesfully.");
|
||||
System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------- test specific inner classes
|
||||
|
||||
enum Enum1 {
|
||||
e1, e2;
|
||||
}
|
||||
|
||||
public enum Enum2 {
|
||||
e1, e2;
|
||||
}
|
||||
|
||||
enum Enum3 {
|
||||
e1 {
|
||||
int val() {return 1;}
|
||||
},
|
||||
|
||||
e2 {
|
||||
int val() {return 2;}
|
||||
};
|
||||
abstract int val();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------- test specific classes
|
||||
@ -0,0 +1,105 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 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 nsk.jdi.Argument.description;
|
||||
|
||||
import nsk.share.*;
|
||||
import nsk.share.jpda.*;
|
||||
import nsk.share.jdi.*;
|
||||
|
||||
import com.sun.jdi.*;
|
||||
import com.sun.jdi.connect.Connector;
|
||||
import java.io.*;
|
||||
import javax.naming.directory.Attribute;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* Test for the control of
|
||||
*
|
||||
* Interface: com.sun.jdi.connect.Connector.Argument
|
||||
* Method: public java.lang.String description()
|
||||
* Assertion: "Returns a human-readable description of this
|
||||
* argument and its purpose."
|
||||
*/
|
||||
|
||||
public class description001 {
|
||||
private static Log log;
|
||||
|
||||
public static void main( String argv[] ) {
|
||||
System.exit(run(argv, System.out)+95); // JCK-compatible exit status
|
||||
}
|
||||
|
||||
public static int run(String argv[], PrintStream out) {
|
||||
ArgumentHandler argHandler = new ArgumentHandler(argv);
|
||||
log = new Log(out, argHandler);
|
||||
VirtualMachineManager vmm = Bootstrap.virtualMachineManager();
|
||||
List acl = vmm.allConnectors();
|
||||
|
||||
if (acl.size() > 0) {
|
||||
log.display("Number of all known JDI connectors: " + acl.size());
|
||||
} else {
|
||||
log.complain("FAILURE: no JDI connectors found!");
|
||||
return 2;
|
||||
}
|
||||
|
||||
Iterator aci = acl.iterator();
|
||||
for (int i = 1; aci.hasNext(); i++) {
|
||||
Connector c = (Connector) aci.next();
|
||||
Map cdfltArgmnts = c.defaultArguments();
|
||||
Set ks = cdfltArgmnts.keySet();
|
||||
|
||||
if (ks.isEmpty()) {
|
||||
log.complain("FAILURE: empty default arguments set is found "
|
||||
+ "for " + c.name() + " connector!");
|
||||
return 2;
|
||||
}
|
||||
log.display("Looking over " + c.name() + " connector arguments: ");
|
||||
|
||||
Iterator argi = ks.iterator();
|
||||
for (int j = 1; argi.hasNext(); j++) {
|
||||
String argkey = (String) argi.next();
|
||||
Connector.Argument argval =
|
||||
(Connector.Argument)cdfltArgmnts.get((Object) argkey);
|
||||
String dscrptn = argval.description();
|
||||
|
||||
if (dscrptn == null) {
|
||||
log.complain("FAILURE: argument description is null "
|
||||
+ "for " + argkey + " argument of " + c.name()
|
||||
+ " connector!");
|
||||
return 2;
|
||||
}
|
||||
|
||||
if (dscrptn.length() < 1) {
|
||||
log.complain("FAILURE: empty argument description is found "
|
||||
+ "for " + argkey + " argument of " + c.name()
|
||||
+ " connector!");
|
||||
return 2;
|
||||
}
|
||||
|
||||
log.display(j + "," + argval.name() + ": " + dscrptn);
|
||||
};
|
||||
};
|
||||
log.display("Test PASSED!");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,55 @@
|
||||
/*
|
||||
* Copyright (c) 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.
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* @test
|
||||
*
|
||||
* @summary converted from VM Testbase nsk/jdi/Argument/description/description001.
|
||||
* VM Testbase keywords: [quick, jpda, jdi]
|
||||
* VM Testbase readme:
|
||||
* ================================================
|
||||
* DESCRIPTION:
|
||||
* The test is aimed on the control of:
|
||||
* Interface: com.sun.jdi.connect.Connector.Argument
|
||||
* Method: public java.lang.String description()
|
||||
* Assertion: "Returns a human-readable description of this
|
||||
* argument and its purpose."
|
||||
* ================================================
|
||||
* COMMENTS:
|
||||
* ================================================
|
||||
*
|
||||
* @library /vmTestbase
|
||||
* /test/lib
|
||||
* @run driver jdk.test.lib.FileInstaller . .
|
||||
* @build nsk.jdi.Argument.description.description001
|
||||
* @run main/othervm PropertyResolvingWrapper
|
||||
* nsk.jdi.Argument.description.description001
|
||||
* -verbose
|
||||
* -arch=${os.family}-${os.simpleArch}
|
||||
* -waittime=5
|
||||
* -debugee.vmkind=java
|
||||
* -transport.address=dynamic
|
||||
* "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}"
|
||||
*/
|
||||
|
||||
@ -0,0 +1,160 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 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 nsk.jdi.Argument.isValid;
|
||||
|
||||
import java.io.PrintStream;
|
||||
import java.io.Serializable;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.List;
|
||||
import java.util.Iterator;
|
||||
import java.util.NoSuchElementException;
|
||||
|
||||
import com.sun.jdi.VirtualMachineManager;
|
||||
import com.sun.jdi.Bootstrap;
|
||||
import com.sun.jdi.connect.Connector;
|
||||
import com.sun.jdi.connect.Connector.Argument;
|
||||
import com.sun.jdi.connect.Connector.BooleanArgument;
|
||||
|
||||
/**
|
||||
* The test for the implementation of an object of the type <BR>
|
||||
* Connector.Argument. <BR>
|
||||
* <BR>
|
||||
* The test checks up that results of the method <BR>
|
||||
* <code>com.sun.jdi.connect.Connector.Argument.isValid()</code> <BR>
|
||||
* complies with its specification, that is, <BR>
|
||||
* "Returns: true if the value is valid to be used in setValue(String)" <BR>
|
||||
* in case when Argument implements BooleanArgument . <BR>
|
||||
* <BR>
|
||||
* In case of a wrong boolean value returned, <BR>
|
||||
* the test produces the return value 97 and <BR>
|
||||
* a corresponding error message. <BR>
|
||||
* Otherwise, the test is passed and produces <BR>
|
||||
* the return value 95 and no message. <BR>
|
||||
*/
|
||||
|
||||
|
||||
public class isvalid001 {
|
||||
|
||||
public static void main(String argv[]) {
|
||||
System.exit(run(argv, System.out) + 95); // JCK-compatible exit status
|
||||
}
|
||||
|
||||
public static int run(String argv[], PrintStream out) {
|
||||
|
||||
int exitCode = 0;
|
||||
int exitCode0 = 0;
|
||||
int exitCode2 = 2;
|
||||
//
|
||||
String sErr1 = "WARNING\n" +
|
||||
"Method tested: " +
|
||||
"jdi.Connector.Argument.isValid\n" ;
|
||||
//
|
||||
String sErr2 = "ERROR\n" +
|
||||
"Method tested: " +
|
||||
"jdi.Connector.Argument.isValid\n" ;
|
||||
|
||||
VirtualMachineManager vmm = Bootstrap.virtualMachineManager();
|
||||
|
||||
List connectorsList = vmm.allConnectors();
|
||||
Iterator connectorsListIterator = connectorsList.iterator();
|
||||
//
|
||||
Connector.Argument argument = null;
|
||||
Connector.BooleanArgument booleanArg = null;
|
||||
|
||||
for ( ; ; ) {
|
||||
try {
|
||||
Connector connector =
|
||||
(Connector) connectorsListIterator.next();
|
||||
|
||||
Map defaultArguments = connector.defaultArguments();
|
||||
Set keyset = defaultArguments.keySet();
|
||||
int keysetSize = defaultArguments.size();
|
||||
Iterator keysetIterator = keyset.iterator();
|
||||
|
||||
for ( ; ; ) {
|
||||
try {
|
||||
String argName = (String) keysetIterator.next();
|
||||
|
||||
try {
|
||||
argument = (Connector.Argument)
|
||||
defaultArguments.get(argName);
|
||||
try {
|
||||
booleanArg = (Connector.BooleanArgument)
|
||||
defaultArguments.get(argName);
|
||||
break ;
|
||||
} catch ( ClassCastException e) {
|
||||
}
|
||||
} catch ( ClassCastException e) {
|
||||
}
|
||||
} catch ( NoSuchElementException e) {
|
||||
break ;
|
||||
}
|
||||
}
|
||||
if (booleanArg != null) {
|
||||
break ;
|
||||
}
|
||||
} catch ( NoSuchElementException e) {
|
||||
out.println(sErr1 +
|
||||
"no Connector with BooleanArgument found\n");
|
||||
return exitCode0;
|
||||
}
|
||||
}
|
||||
|
||||
if (!argument.isValid("true")) {
|
||||
exitCode = exitCode2;
|
||||
out.println(sErr2 +
|
||||
"check: isValid('true')\n" +
|
||||
"error: returned value != true\n");
|
||||
}
|
||||
|
||||
if (!argument.isValid("false")) {
|
||||
exitCode = exitCode2;
|
||||
out.println(sErr2 +
|
||||
"check: isValid('false')\n" +
|
||||
"error: returned value != true\n");
|
||||
}
|
||||
|
||||
if (argument.isValid("fals")) {
|
||||
exitCode = exitCode2;
|
||||
out.println(sErr2 +
|
||||
"check: isValid('fals')\n" +
|
||||
"error: returned value == true\n");
|
||||
}
|
||||
|
||||
if (argument.isValid("")) {
|
||||
exitCode = exitCode2;
|
||||
out.println(sErr2 +
|
||||
"check: isValid(<empty_string>)\n" +
|
||||
"error: returned value == true\n");
|
||||
}
|
||||
|
||||
|
||||
if (exitCode != exitCode0)
|
||||
out.println("TEST FAILED");
|
||||
|
||||
return exitCode;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,78 @@
|
||||
/*
|
||||
* Copyright (c) 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.
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* @test
|
||||
*
|
||||
* @summary converted from VM Testbase nsk/jdi/Argument/isValid/isvalid001.
|
||||
* VM Testbase keywords: [quick, jpda, jdi]
|
||||
* VM Testbase readme:
|
||||
* DESCRIPTION:
|
||||
* The test for the implementation of an object of the type
|
||||
* Connector.Argument.
|
||||
* The test checks up that a result of the method
|
||||
* com.sun.jdi.connect.Connector.Argument.isValid()
|
||||
* complies with its specification, that is,
|
||||
* "Returns: true if the value is valid to be used in setValue(String)"
|
||||
* in case when Argument implements BooleanArgument .
|
||||
* The test works as follows:
|
||||
* - Virtual Machine Manager is invoked.
|
||||
* - First Connector.BooleanArgument object is searched among
|
||||
* Arguments of Connectors.
|
||||
* If no the object is found out the test exits
|
||||
* with the return value = 95 and a warning message.
|
||||
* - To a Connector.Argument argument object
|
||||
* the following checks are applied:
|
||||
* IF !argument.isValid("true")
|
||||
* THEN an error detected
|
||||
* ELSE the check passed
|
||||
* IF !argument.isValid("false")
|
||||
* THEN an error detected
|
||||
* ELSE the check passed
|
||||
* IF argument.isValid("fals")
|
||||
* THEN an error detected
|
||||
* ELSE the check passed
|
||||
* IF argument.isValid("")
|
||||
* THEN an error detected
|
||||
* ELSE the check passed
|
||||
* In case of error the test produces the return value 97 and
|
||||
* a corresponding error message(s).
|
||||
* Otherwise, the test is passed and produces
|
||||
* the return value 95 and no message.
|
||||
* COMMENTS:
|
||||
*
|
||||
* @library /vmTestbase
|
||||
* /test/lib
|
||||
* @run driver jdk.test.lib.FileInstaller . .
|
||||
* @build nsk.jdi.Argument.isValid.isvalid001
|
||||
* @run main/othervm PropertyResolvingWrapper
|
||||
* nsk.jdi.Argument.isValid.isvalid001
|
||||
* -verbose
|
||||
* -arch=${os.family}-${os.simpleArch}
|
||||
* -waittime=5
|
||||
* -debugee.vmkind=java
|
||||
* -transport.address=dynamic
|
||||
* "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}"
|
||||
*/
|
||||
|
||||
@ -0,0 +1,136 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 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 nsk.jdi.Argument.isValid;
|
||||
|
||||
import java.io.PrintStream;
|
||||
import java.io.Serializable;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.List;
|
||||
import java.util.Iterator;
|
||||
import java.util.NoSuchElementException;
|
||||
|
||||
import com.sun.jdi.VirtualMachineManager;
|
||||
import com.sun.jdi.Bootstrap;
|
||||
import com.sun.jdi.connect.Connector;
|
||||
import com.sun.jdi.connect.Connector.Argument;
|
||||
import com.sun.jdi.connect.Connector.BooleanArgument;
|
||||
|
||||
/**
|
||||
* The test for the implementation of an object of the type <BR>
|
||||
* Connector.Argument. <BR>
|
||||
* <BR>
|
||||
* The test checks up that results of the method <BR>
|
||||
* <code>com.sun.jdi.connect.Connector.Argument.isValid()</code> <BR>
|
||||
* complies with its specification. <BR>
|
||||
* The case for testing includes throwing NullPointerException <BR>
|
||||
* if a parameter is a null-string. <BR>
|
||||
* <BR>
|
||||
*/
|
||||
|
||||
|
||||
public class isvalid002 {
|
||||
|
||||
public static void main(String argv[]) {
|
||||
System.exit(run(argv, System.out) + 95); // JCK-compatible exit status
|
||||
}
|
||||
|
||||
public static int run(String argv[], PrintStream out) {
|
||||
|
||||
int exitCode = 0;
|
||||
int exitCode0 = 0;
|
||||
int exitCode2 = 2;
|
||||
//
|
||||
String sErr1 = "WARNING\n" +
|
||||
"Method tested: " +
|
||||
"jdi.Connector.Argument.isValid\n" ;
|
||||
//
|
||||
String sErr2 = "ERROR\n" +
|
||||
"Method tested: " +
|
||||
"jdi.Connector.Argument.isValid\n" ;
|
||||
|
||||
VirtualMachineManager vmm = Bootstrap.virtualMachineManager();
|
||||
|
||||
List connectorsList = vmm.allConnectors();
|
||||
Iterator connectorsListIterator = connectorsList.iterator();
|
||||
//
|
||||
Connector.Argument argument = null;
|
||||
Connector.BooleanArgument booleanArg = null;
|
||||
|
||||
for ( ; ; ) {
|
||||
try {
|
||||
Connector connector =
|
||||
(Connector) connectorsListIterator.next();
|
||||
|
||||
Map defaultArguments = connector.defaultArguments();
|
||||
Set keyset = defaultArguments.keySet();
|
||||
int keysetSize = defaultArguments.size();
|
||||
Iterator keysetIterator = keyset.iterator();
|
||||
|
||||
for ( ; ; ) {
|
||||
try {
|
||||
String argName = (String) keysetIterator.next();
|
||||
|
||||
try {
|
||||
argument = (Connector.Argument)
|
||||
defaultArguments.get(argName);
|
||||
try {
|
||||
booleanArg = (Connector.BooleanArgument)
|
||||
defaultArguments.get(argName);
|
||||
break ;
|
||||
} catch ( ClassCastException e) {
|
||||
}
|
||||
} catch ( ClassCastException e) {
|
||||
}
|
||||
} catch ( NoSuchElementException e) {
|
||||
break ;
|
||||
}
|
||||
}
|
||||
if (booleanArg != null) {
|
||||
break ;
|
||||
}
|
||||
} catch ( NoSuchElementException e) {
|
||||
out.println(sErr1 +
|
||||
"no Connector with BooleanArgument found\n");
|
||||
return exitCode0;
|
||||
}
|
||||
}
|
||||
|
||||
String sNull = null;
|
||||
try {
|
||||
argument.isValid(sNull);
|
||||
exitCode = exitCode2;
|
||||
out.println(sErr2 +
|
||||
"check: isValid(sNull)\n" +
|
||||
"ERROR: no NullPointerException thrown");
|
||||
} catch ( NullPointerException e ) {
|
||||
}
|
||||
|
||||
if (exitCode != exitCode0)
|
||||
out.println("TEST FAILED");
|
||||
|
||||
return exitCode;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,80 @@
|
||||
/*
|
||||
* Copyright (c) 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.
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* @test
|
||||
*
|
||||
* @summary converted from VM Testbase nsk/jdi/Argument/isValid/isvalid002.
|
||||
* VM Testbase keywords: [quick, jpda, jdi]
|
||||
* VM Testbase readme:
|
||||
* DESCRIPTION:
|
||||
* The test for the implementation of an object of the type
|
||||
* Connector.Argument.
|
||||
* The test checks up that a result of the method
|
||||
* com.sun.jdi.connect.Connector.Argument.isValid()
|
||||
* complies with its specification, that is,
|
||||
* "Returns: true if the value is valid to be used in setValue(String)"
|
||||
* in case when Argument implements BooleanArgument
|
||||
* and its parameter is a null-string .
|
||||
* The test works as follows:
|
||||
* - Virtual Machine Manager is invoked.
|
||||
* - First Connector.BooleanArgument object is searched among
|
||||
* Arguments of Connectors.
|
||||
* If no the object is found out the test exits
|
||||
* with the return value = 95 and a warning message.
|
||||
* - To a Connector.Argument argument object
|
||||
* the following check is applied:
|
||||
* String sNull = null;
|
||||
* IF argument.isValid(sNull)
|
||||
* THEN an error detected
|
||||
* ELSE the check passed
|
||||
* In case of error the test produces the return value 97 and
|
||||
* a corresponding error message(s).
|
||||
* Otherwise, the test is passed and produces
|
||||
* the return value 95 and no message.
|
||||
* COMMENTS:
|
||||
* To fix the bug 4491137,
|
||||
* the test is corrected to comply with
|
||||
* the updated specification in jdi-overview.html:
|
||||
* Any method which takes a Object as an parameter
|
||||
* will throw NullPointerException if
|
||||
* null is passed directly or indirectly --
|
||||
* unless null is explicitly mentioned as a valid parameter.
|
||||
* From now, the test regards throwing NullPointerException
|
||||
* as the correct reaction to the null-parameter.
|
||||
*
|
||||
* @library /vmTestbase
|
||||
* /test/lib
|
||||
* @run driver jdk.test.lib.FileInstaller . .
|
||||
* @build nsk.jdi.Argument.isValid.isvalid002
|
||||
* @run main/othervm PropertyResolvingWrapper
|
||||
* nsk.jdi.Argument.isValid.isvalid002
|
||||
* -verbose
|
||||
* -arch=${os.family}-${os.simpleArch}
|
||||
* -waittime=5
|
||||
* -debugee.vmkind=java
|
||||
* -transport.address=dynamic
|
||||
* "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}"
|
||||
*/
|
||||
|
||||
@ -0,0 +1,150 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 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 nsk.jdi.Argument.isValid;
|
||||
|
||||
import java.io.PrintStream;
|
||||
import java.io.Serializable;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.List;
|
||||
import java.util.Iterator;
|
||||
import java.util.NoSuchElementException;
|
||||
|
||||
import com.sun.jdi.VirtualMachineManager;
|
||||
import com.sun.jdi.Bootstrap;
|
||||
import com.sun.jdi.connect.Connector;
|
||||
import com.sun.jdi.connect.Connector.Argument;
|
||||
import com.sun.jdi.connect.Connector.BooleanArgument;
|
||||
|
||||
/**
|
||||
* The test for the implementation of an object of the type <BR>
|
||||
* Connector.Argument. <BR>
|
||||
* <BR>
|
||||
* The test checks up that results of the method <BR>
|
||||
* <code>com.sun.jdi.connect.Connector.Argument.isValid()</code> <BR>
|
||||
* complies with its specification, that is, <BR>
|
||||
* "Returns: true if the value is valid to be used in setValue(String)" <BR>
|
||||
* in case when Argument implements StringArgument <BR>
|
||||
* and its parameter is a null-string. <BR>
|
||||
* <BR>
|
||||
* In case of a wrong boolean value returned, <BR>
|
||||
* the test produces the return value 97 and <BR>
|
||||
* a corresponding error message. <BR>
|
||||
* Otherwise, the test is passed and produces <BR>
|
||||
* the return value 95 and no message. <BR>
|
||||
*/
|
||||
|
||||
|
||||
public class isvalid003 {
|
||||
|
||||
public static void main(String argv[]) {
|
||||
System.exit(run(argv, System.out) + 95); // JCK-compatible exit status
|
||||
}
|
||||
|
||||
public static int run(String argv[], PrintStream out) {
|
||||
|
||||
int exitCode = 0;
|
||||
int exitCode0 = 0;
|
||||
int exitCode2 = 2;
|
||||
//
|
||||
String sErr1 = "WARNING\n" +
|
||||
"Method tested: " +
|
||||
"jdi.Connector.Argument.isValid\n" ;
|
||||
//
|
||||
String sErr2 = "ERROR\n" +
|
||||
"Method tested: " +
|
||||
"jdi.Connector.Argument.isValid\n" ;
|
||||
|
||||
VirtualMachineManager vmm = Bootstrap.virtualMachineManager();
|
||||
|
||||
List connectorsList = vmm.allConnectors();
|
||||
Iterator connectorsListIterator = connectorsList.iterator();
|
||||
//
|
||||
Connector.Argument argument = null;
|
||||
Connector.StringArgument stringArg = null;
|
||||
|
||||
for ( ; ; ) {
|
||||
try {
|
||||
Connector connector =
|
||||
(Connector) connectorsListIterator.next();
|
||||
|
||||
Map defaultArguments = connector.defaultArguments();
|
||||
Set keyset = defaultArguments.keySet();
|
||||
int keysetSize = defaultArguments.size();
|
||||
Iterator keysetIterator = keyset.iterator();
|
||||
|
||||
for ( ; ; ) {
|
||||
try {
|
||||
String argName = (String) keysetIterator.next();
|
||||
|
||||
try {
|
||||
argument = (Connector.Argument)
|
||||
defaultArguments.get(argName);
|
||||
//
|
||||
try {
|
||||
stringArg = (Connector.StringArgument)
|
||||
defaultArguments.get(argName);
|
||||
break ;
|
||||
} catch ( ClassCastException e) {
|
||||
}
|
||||
} catch ( ClassCastException e) {
|
||||
}
|
||||
} catch ( NoSuchElementException e) {
|
||||
break ;
|
||||
}
|
||||
}
|
||||
//
|
||||
if (stringArg != null) {
|
||||
break ;
|
||||
}
|
||||
} catch ( NoSuchElementException e) {
|
||||
out.println(sErr1 +
|
||||
"no Connector with StringArgument found\n");
|
||||
return exitCode0;
|
||||
}
|
||||
}
|
||||
|
||||
String sNull = null;
|
||||
try {
|
||||
if (!argument.isValid(sNull)) {
|
||||
exitCode = exitCode2;
|
||||
out.println(sErr2 +
|
||||
"check: isValid(sNull)\n" +
|
||||
//
|
||||
"error: returned value != true\n");
|
||||
}
|
||||
} catch ( NullPointerException e ) {
|
||||
exitCode = exitCode2;
|
||||
out.println(sErr2 +
|
||||
"check: isValid(sNull)\n" +
|
||||
"error: NullPointerException\n");
|
||||
}
|
||||
|
||||
if (exitCode != exitCode0)
|
||||
out.println("TEST FAILED");
|
||||
|
||||
return exitCode;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,71 @@
|
||||
/*
|
||||
* Copyright (c) 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.
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* @test
|
||||
*
|
||||
* @summary converted from VM Testbase nsk/jdi/Argument/isValid/isvalid003.
|
||||
* VM Testbase keywords: [quick, jpda, jdi]
|
||||
* VM Testbase readme:
|
||||
* DESCRIPTION:
|
||||
* The test for the implementation of an object of the type
|
||||
* Connector.Argument.
|
||||
* The test checks up that a result of the method
|
||||
* com.sun.jdi.connect.Connector.Argument.isValid()
|
||||
* complies with its specification, that is,
|
||||
* "Returns: true if the value is valid to be used in setValue(String)"
|
||||
* in case when Argument implements StringArgument
|
||||
* and its parameter is a null-string .
|
||||
* The test works as follows:
|
||||
* - Virtual Machine Manager is invoked.
|
||||
* - First Connector.StringArgument object is searched among
|
||||
* Arguments of Connectors.
|
||||
* If no the object is found out the test exits
|
||||
* with the return value = 95 and a warning message.
|
||||
* - To a Connector.Argument (!!!) argument
|
||||
* the following check is applied:
|
||||
* String sNull = null;
|
||||
* IF !argument.isValid(sNull)
|
||||
* THEN an error detected
|
||||
* ELSE the check passed
|
||||
* In case of error the test produces the return value 97 and
|
||||
* a corresponding error message(s).
|
||||
* Otherwise, the test is passed and produces
|
||||
* the return value 95 and no message.
|
||||
* COMMENTS:
|
||||
*
|
||||
* @library /vmTestbase
|
||||
* /test/lib
|
||||
* @run driver jdk.test.lib.FileInstaller . .
|
||||
* @build nsk.jdi.Argument.isValid.isvalid003
|
||||
* @run main/othervm PropertyResolvingWrapper
|
||||
* nsk.jdi.Argument.isValid.isvalid003
|
||||
* -verbose
|
||||
* -arch=${os.family}-${os.simpleArch}
|
||||
* -waittime=5
|
||||
* -debugee.vmkind=java
|
||||
* -transport.address=dynamic
|
||||
* "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}"
|
||||
*/
|
||||
|
||||
@ -0,0 +1,187 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 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 nsk.jdi.Argument.isValid;
|
||||
|
||||
import java.io.PrintStream;
|
||||
import java.io.Serializable;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.List;
|
||||
import java.util.Iterator;
|
||||
import java.util.NoSuchElementException;
|
||||
|
||||
import com.sun.jdi.VirtualMachineManager;
|
||||
import com.sun.jdi.Bootstrap;
|
||||
import com.sun.jdi.connect.Connector;
|
||||
import com.sun.jdi.connect.Connector.IntegerArgument;
|
||||
|
||||
|
||||
/**
|
||||
* The test for the implementation of an object of the type <BR>
|
||||
* Connector_IntegerArgument. <BR>
|
||||
* <BR>
|
||||
* The test checks up that results of the method <BR>
|
||||
* <code>com.sun.jdi.connect.Connector.Argument.isValid()</code> <BR>
|
||||
* complies with its specification, that is, <BR>
|
||||
* "Returns: true if the value is valid to be used in setValue(String)" <BR>
|
||||
* in case when Argument implements IntegerArgument <BR>
|
||||
* and its parameter is a string representing one of min(), max(), <BR>
|
||||
* min()-1, min()+1, max()+1. <BR>
|
||||
* <BR>
|
||||
* In case of a wrong result returned, <BR>
|
||||
* the test produces the return value 97 and <BR>
|
||||
* a corresponding error message. <BR>
|
||||
* Otherwise, the test is passed and produces <BR>
|
||||
* the return value 95 and no message. <BR>
|
||||
*/
|
||||
|
||||
//
|
||||
public class isvalid004 {
|
||||
|
||||
public static void main(String argv[]) {
|
||||
System.exit(run(argv, System.out) + 95); // JCK-compatible exit status
|
||||
}
|
||||
|
||||
public static int run(String argv[], PrintStream out) {
|
||||
|
||||
int exitCode = 0;
|
||||
int exitCode0 = 0;
|
||||
int exitCode2 = 2;
|
||||
//
|
||||
String sErr1 = "WARNING\n" +
|
||||
"Method tested: " +
|
||||
"jdi.Connector.Argument.isValid\n" ;
|
||||
//
|
||||
String sErr2 = "ERROR\n" +
|
||||
"Method tested: " +
|
||||
"jdi.Connector.Argument.isValid\n" ;
|
||||
|
||||
VirtualMachineManager vmm = Bootstrap.virtualMachineManager();
|
||||
|
||||
List connectorsList = vmm.allConnectors();
|
||||
Iterator connectorsListIterator = connectorsList.iterator();
|
||||
//
|
||||
Connector.Argument argument = null;
|
||||
Connector.IntegerArgument intArgument = null;
|
||||
|
||||
for ( ; ; ) {
|
||||
try {
|
||||
Connector connector =
|
||||
(Connector) connectorsListIterator.next();
|
||||
|
||||
Map defaultArguments = connector.defaultArguments();
|
||||
Set keyset = defaultArguments.keySet();
|
||||
int keysetSize = defaultArguments.size();
|
||||
Iterator keysetIterator = keyset.iterator();
|
||||
|
||||
for ( ; ; ) {
|
||||
try {
|
||||
String argName = (String) keysetIterator.next();
|
||||
|
||||
try {
|
||||
//
|
||||
argument = (Connector.IntegerArgument)
|
||||
defaultArguments.get(argName);
|
||||
try {
|
||||
intArgument = (Connector.IntegerArgument)
|
||||
defaultArguments.get(argName);
|
||||
break ;
|
||||
} catch ( ClassCastException e) {
|
||||
}
|
||||
} catch ( ClassCastException e) {
|
||||
}
|
||||
} catch ( NoSuchElementException e) {
|
||||
break ;
|
||||
}
|
||||
}
|
||||
if (intArgument != null) {
|
||||
break ;
|
||||
}
|
||||
} catch ( NoSuchElementException e) {
|
||||
out.println(sErr1 +
|
||||
//
|
||||
"no Connector with IntegerArgument found\n");
|
||||
return exitCode0;
|
||||
}
|
||||
}
|
||||
|
||||
Integer intI = null;
|
||||
|
||||
if (argument.isValid(intArgument.stringValueOf(intArgument.min()))) {
|
||||
} else {
|
||||
exitCode = exitCode2;
|
||||
out.println(sErr2 +
|
||||
"check: super.isValid(stringValueOf(min()))\n" +
|
||||
"result: false\n");
|
||||
}
|
||||
|
||||
if (argument.isValid(intArgument.stringValueOf(intArgument.max()))) {
|
||||
} else {
|
||||
exitCode = exitCode2;
|
||||
out.println(sErr2 +
|
||||
"check: super.isValid(stringValueOf(max()))\n" +
|
||||
"result: false\n");
|
||||
}
|
||||
|
||||
if (intArgument.min() < intArgument.max()) {
|
||||
if (argument.isValid(
|
||||
intArgument.stringValueOf(intArgument.min() + 1))) {
|
||||
} else {
|
||||
exitCode = exitCode2;
|
||||
out.println(sErr2 +
|
||||
"check: super.isValid(stringValueOf(min()+1))\n" +
|
||||
"result: false\n");
|
||||
}
|
||||
}
|
||||
|
||||
if (intArgument.min() > intI.MIN_VALUE) {
|
||||
if (!argument.isValid(
|
||||
intArgument.stringValueOf(intArgument.min() - 1))) {
|
||||
} else {
|
||||
exitCode = exitCode2;
|
||||
out.println(sErr2 +
|
||||
"check: super.isValid(stringValueOf(min()-1))\n" +
|
||||
"result: true\n");
|
||||
}
|
||||
}
|
||||
|
||||
if (intArgument.max() < intI.MAX_VALUE) {
|
||||
if (!argument.isValid(
|
||||
intArgument.stringValueOf(intArgument.max() + 1))) {
|
||||
} else {
|
||||
exitCode = exitCode2;
|
||||
out.println(sErr2 +
|
||||
"check: super.isValid(stringValueOf(max()+1))\n" +
|
||||
"result: true\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (exitCode != exitCode0) {
|
||||
out.println("TEST FAILED");
|
||||
}
|
||||
return exitCode;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,91 @@
|
||||
/*
|
||||
* Copyright (c) 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.
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* @test
|
||||
*
|
||||
* @summary converted from VM Testbase nsk/jdi/Argument/isValid/isvalid004.
|
||||
* VM Testbase keywords: [quick, jpda, jdi]
|
||||
* VM Testbase readme:
|
||||
* DESCRIPTION:
|
||||
* The test for the implementation of an object of the type
|
||||
* Connector.Argument.
|
||||
* The test checks up that results of the method
|
||||
* Connector.Argument.isValid()
|
||||
* complies with its specification, that is,
|
||||
* "Returns: true if the value is valid to be used in setValue(String)"
|
||||
* in case when Argument implements IntegerArgument
|
||||
* and parameters are strings representing values min(), max(),
|
||||
* min()-1, min()+1 and max()+1.
|
||||
* The test works as follows:
|
||||
* - Virtual Machine Manager is invoked.
|
||||
* - First Connector.Argument which implement Connector.IntegerArgument
|
||||
* object is searched among Arguments of Connectors.
|
||||
* If no intArgument is found out
|
||||
* the test exits with the return value = 95 and a warning message.
|
||||
* - The follwing checks are made:
|
||||
* argument.isValid(
|
||||
* intArgurmnt.stringValueOf(
|
||||
* int.Argument.min()))
|
||||
* expexted result - true
|
||||
* if (intArgument.min() < intArgument.max())
|
||||
* argument.isValid(
|
||||
* intArgurmnt.stringValueOf(
|
||||
* int.Argument.min() + 1))
|
||||
* expected result - true
|
||||
* argument.isValid(
|
||||
* intArgurmnt.stringValueOf(
|
||||
* int.Argument.max())
|
||||
* expexted result - true
|
||||
* if (intArgument.min() > INTEGER.MIN_VALUE)
|
||||
* argument.isValid(
|
||||
* intArgurmnt.stringValueOf(
|
||||
* int.Argument.min() - 1)
|
||||
* expected result - false
|
||||
* if (intArgument.max() < INTEGER.MAX_VALUE)
|
||||
* argument.isValid(
|
||||
* intArgurmnt.stringValueOf(
|
||||
* int.Argument.max() + 1)
|
||||
* expected result - false
|
||||
* In case of unexpected result
|
||||
* the test produces the return value 97 and
|
||||
* a corresponding error message(s).
|
||||
* Otherwise, the test is passed and produces
|
||||
* the return value 95 and no message.
|
||||
* COMMENTS:
|
||||
*
|
||||
* @library /vmTestbase
|
||||
* /test/lib
|
||||
* @run driver jdk.test.lib.FileInstaller . .
|
||||
* @build nsk.jdi.Argument.isValid.isvalid004
|
||||
* @run main/othervm PropertyResolvingWrapper
|
||||
* nsk.jdi.Argument.isValid.isvalid004
|
||||
* -verbose
|
||||
* -arch=${os.family}-${os.simpleArch}
|
||||
* -waittime=5
|
||||
* -debugee.vmkind=java
|
||||
* -transport.address=dynamic
|
||||
* "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}"
|
||||
*/
|
||||
|
||||
@ -0,0 +1,168 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 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 nsk.jdi.Argument.isValid;
|
||||
|
||||
import java.io.PrintStream;
|
||||
import java.io.Serializable;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.List;
|
||||
import java.util.Iterator;
|
||||
import java.util.NoSuchElementException;
|
||||
|
||||
import com.sun.jdi.VirtualMachineManager;
|
||||
import com.sun.jdi.Bootstrap;
|
||||
import com.sun.jdi.connect.Connector;
|
||||
import com.sun.jdi.connect.Connector.IntegerArgument;
|
||||
|
||||
|
||||
/**
|
||||
* The test for the implementation of an object of the type <BR>
|
||||
* Connector_IntegerArgument. <BR>
|
||||
* <BR>
|
||||
* The test checks up that results of the method <BR>
|
||||
* <code>com.sun.jdi.connect.Connector.Argument.isValid()</code> <BR>
|
||||
* complies with its specification, that is, <BR>
|
||||
* "Returns: true if the value is valid to be used in setValue(String)" <BR>
|
||||
* in case when Argument implements IntegerArgument <BR>
|
||||
* and its parameter is one of the following: "a", "", null, null-string. <BR> <BR>
|
||||
* <BR>
|
||||
* In case of a wrong result returned, <BR>
|
||||
* the test produces the return value 97 and <BR>
|
||||
* a corresponding error message. <BR>
|
||||
* Otherwise, the test is passed and produces <BR>
|
||||
* the return value 95 and no message. <BR>
|
||||
*/
|
||||
|
||||
//
|
||||
public class isvalid005 {
|
||||
|
||||
public static void main(String argv[]) {
|
||||
System.exit(run(argv, System.out) + 95); // JCK-compatible exit status
|
||||
}
|
||||
|
||||
public static int run(String argv[], PrintStream out) {
|
||||
|
||||
int exitCode = 0;
|
||||
int exitCode0 = 0;
|
||||
int exitCode2 = 2;
|
||||
//
|
||||
String sErr1 = "WARNING\n" +
|
||||
"Method tested: " +
|
||||
"jdi.Connector.Argument.isValid\n" ;
|
||||
//
|
||||
String sErr2 = "ERROR\n" +
|
||||
"Method tested: " +
|
||||
"jdi.Connector.Argument.isValid\n" ;
|
||||
|
||||
VirtualMachineManager vmm = Bootstrap.virtualMachineManager();
|
||||
|
||||
List connectorsList = vmm.allConnectors();
|
||||
Iterator connectorsListIterator = connectorsList.iterator();
|
||||
//
|
||||
Connector.Argument argument = null;
|
||||
Connector.IntegerArgument intArgument = null;
|
||||
|
||||
for ( ; ; ) {
|
||||
try {
|
||||
Connector connector =
|
||||
(Connector) connectorsListIterator.next();
|
||||
|
||||
Map defaultArguments = connector.defaultArguments();
|
||||
Set keyset = defaultArguments.keySet();
|
||||
int keysetSize = defaultArguments.size();
|
||||
Iterator keysetIterator = keyset.iterator();
|
||||
|
||||
for ( ; ; ) {
|
||||
try {
|
||||
String argName = (String) keysetIterator.next();
|
||||
|
||||
try {
|
||||
//
|
||||
argument = (Connector.IntegerArgument)
|
||||
defaultArguments.get(argName);
|
||||
try {
|
||||
intArgument = (Connector.IntegerArgument)
|
||||
defaultArguments.get(argName);
|
||||
break ;
|
||||
} catch ( ClassCastException e) {
|
||||
}
|
||||
} catch ( ClassCastException e) {
|
||||
}
|
||||
} catch ( NoSuchElementException e) {
|
||||
break ;
|
||||
}
|
||||
}
|
||||
if (intArgument != null) {
|
||||
break ;
|
||||
}
|
||||
} catch ( NoSuchElementException e) {
|
||||
out.println(sErr1 +
|
||||
//
|
||||
"no Connector with IntegerArgument found\n");
|
||||
return exitCode0;
|
||||
}
|
||||
}
|
||||
|
||||
if (!argument.isValid("")) {
|
||||
} else {
|
||||
exitCode = exitCode2;
|
||||
out.println(sErr2 +
|
||||
"check: super.isValid('')\n" +
|
||||
"result: true\n");
|
||||
}
|
||||
|
||||
if (!argument.isValid("a")) {
|
||||
} else {
|
||||
exitCode = exitCode2;
|
||||
out.println(sErr2 +
|
||||
"check: super.isValid('a')\n" +
|
||||
"result: true\n");
|
||||
}
|
||||
|
||||
if (!argument.isValid((String) null)) {
|
||||
} else {
|
||||
exitCode = exitCode2;
|
||||
out.println(sErr2 +
|
||||
"check: super.isValid((String) null))\n" +
|
||||
"result: true\n");
|
||||
}
|
||||
|
||||
String s = null;
|
||||
if (!argument.isValid(s)) {
|
||||
} else {
|
||||
exitCode = exitCode2;
|
||||
out.println(sErr2 +
|
||||
"check: super.isValid(String s = null)\n" +
|
||||
"result: true\n");
|
||||
}
|
||||
|
||||
|
||||
if (exitCode != exitCode0) {
|
||||
out.println("TEST FAILED");
|
||||
}
|
||||
return exitCode;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,76 @@
|
||||
/*
|
||||
* Copyright (c) 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.
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* @test
|
||||
*
|
||||
* @summary converted from VM Testbase nsk/jdi/Argument/isValid/isvalid005.
|
||||
* VM Testbase keywords: [quick, jpda, jdi]
|
||||
* VM Testbase readme:
|
||||
* DESCRIPTION:
|
||||
* The test for the implementation of an object of the type
|
||||
* Connector.Argument.
|
||||
* The test checks up that results of the method
|
||||
* Connector.Argument.isValid()
|
||||
* complies with its specification, that is,
|
||||
* "Returns: true if the value is valid to be used in setValue(String)"
|
||||
* in case when Argument implements IntegerArgument
|
||||
* and parameters are strings "", "a", null, null-string.
|
||||
* The test works as follows:
|
||||
* - Virtual Machine Manager is invoked.
|
||||
* - First Connector.Argument which implement Connector.IntegerArgument
|
||||
* object is searched among Arguments of Connectors.
|
||||
* If no intArgument is found out
|
||||
* the test exits with the return value = 95 and a warning message.
|
||||
* - The follwing checks are made:
|
||||
* !argument.isValid("")
|
||||
* expexted result - true
|
||||
* !argument.isValid("a")
|
||||
* expected result - true
|
||||
* !argument.isValid((String) null)
|
||||
* expexted result - true
|
||||
* String s = null;
|
||||
* !argument.isValid(s)
|
||||
* expected result - true
|
||||
* In case of unexpected result
|
||||
* the test produces the return value 97 and
|
||||
* a corresponding error message(s).
|
||||
* Otherwise, the test is passed and produces
|
||||
* the return value 95 and no message.
|
||||
* COMMENTS:
|
||||
*
|
||||
* @library /vmTestbase
|
||||
* /test/lib
|
||||
* @run driver jdk.test.lib.FileInstaller . .
|
||||
* @build nsk.jdi.Argument.isValid.isvalid005
|
||||
* @run main/othervm PropertyResolvingWrapper
|
||||
* nsk.jdi.Argument.isValid.isvalid005
|
||||
* -verbose
|
||||
* -arch=${os.family}-${os.simpleArch}
|
||||
* -waittime=5
|
||||
* -debugee.vmkind=java
|
||||
* -transport.address=dynamic
|
||||
* "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}"
|
||||
*/
|
||||
|
||||
@ -0,0 +1,106 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 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 nsk.jdi.Argument.label;
|
||||
|
||||
import nsk.share.*;
|
||||
import nsk.share.jpda.*;
|
||||
import nsk.share.jdi.*;
|
||||
|
||||
import com.sun.jdi.*;
|
||||
import com.sun.jdi.connect.Connector;
|
||||
import java.io.*;
|
||||
import javax.naming.directory.Attribute;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* Test for the control of
|
||||
*
|
||||
* Interface: com.sun.jdi.connect.Connector.Argument
|
||||
* Method: public java.lang.String label()
|
||||
* Assertion: "Returns a short human-readable label for
|
||||
* this argument."
|
||||
*/
|
||||
|
||||
public class label001 {
|
||||
private static Log log;
|
||||
|
||||
public static void main( String argv[] ) {
|
||||
System.exit(run(argv, System.out)+95); // JCK-compatible exit status
|
||||
}
|
||||
|
||||
public static int run(String argv[], PrintStream out) {
|
||||
ArgumentHandler argHandler = new ArgumentHandler(argv);
|
||||
log = new Log(out, argHandler);
|
||||
VirtualMachineManager vmm = Bootstrap.virtualMachineManager();
|
||||
|
||||
List acl = vmm.allConnectors();
|
||||
if (acl.size() > 0) {
|
||||
log.display("Number of all known JDI connectors: " + acl.size());
|
||||
} else {
|
||||
log.complain("FAILURE: no JDI connectors found!");
|
||||
return 2;
|
||||
}
|
||||
|
||||
Iterator aci = acl.iterator();
|
||||
for (int i = 1; aci.hasNext(); i++) {
|
||||
Connector c = (Connector) aci.next();
|
||||
Map cdfltArgmnts = c.defaultArguments();
|
||||
Set ks = cdfltArgmnts.keySet();
|
||||
|
||||
if (ks.isEmpty()) {
|
||||
log.complain("FAILURE: empty default arguments set is found "
|
||||
+ "for " + c.name() + " connector!");
|
||||
return 2;
|
||||
}
|
||||
|
||||
log.display("Looking over " + c.name() + " connector arguments: ");
|
||||
|
||||
Iterator argi = ks.iterator();
|
||||
for (int j = 1; argi.hasNext(); j++) {
|
||||
String argkey = (String) argi.next();
|
||||
Connector.Argument argval =
|
||||
(Connector.Argument)cdfltArgmnts.get((Object) argkey);
|
||||
String lbl = argval.label();
|
||||
|
||||
if (lbl == null) {
|
||||
log.complain("FAILURE: argument label is null "
|
||||
+ "for " + argkey + " argument of "
|
||||
+ c.name() + " connector!");
|
||||
return 2;
|
||||
}
|
||||
|
||||
if (lbl.length() < 1) {
|
||||
log.complain("FAILURE: empty argument label is found "
|
||||
+ "for " + argkey + " argument of "
|
||||
+ c.name() + " connector!");
|
||||
return 2;
|
||||
}
|
||||
|
||||
log.display("Next (" + j + ") argument's label is: " + lbl);
|
||||
};
|
||||
};
|
||||
log.display("Test PASSED!");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,55 @@
|
||||
/*
|
||||
* Copyright (c) 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.
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* @test
|
||||
*
|
||||
* @summary converted from VM Testbase nsk/jdi/Argument/label/label001.
|
||||
* VM Testbase keywords: [jpda, jdi]
|
||||
* VM Testbase readme:
|
||||
* ================================================
|
||||
* DESCRIPTION:
|
||||
* The test is aimed on the control of:
|
||||
* Interface: com.sun.jdi.connect.Connector.Argument
|
||||
* Method: public java.lang.String label()
|
||||
* Assertion: "Returns a short human-readable label for
|
||||
* this argument."
|
||||
* ================================================
|
||||
* COMMENTS:
|
||||
* ================================================
|
||||
*
|
||||
* @library /vmTestbase
|
||||
* /test/lib
|
||||
* @run driver jdk.test.lib.FileInstaller . .
|
||||
* @build nsk.jdi.Argument.label.label001
|
||||
* @run main/othervm PropertyResolvingWrapper
|
||||
* nsk.jdi.Argument.label.label001
|
||||
* -verbose
|
||||
* -arch=${os.family}-${os.simpleArch}
|
||||
* -waittime=5
|
||||
* -debugee.vmkind=java
|
||||
* -transport.address=dynamic
|
||||
* "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}"
|
||||
*/
|
||||
|
||||
@ -0,0 +1,132 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 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 nsk.jdi.Argument.mustSpecify;
|
||||
|
||||
import java.io.PrintStream;
|
||||
import java.io.Serializable;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.List;
|
||||
import java.util.Iterator;
|
||||
import java.util.NoSuchElementException;
|
||||
|
||||
import com.sun.jdi.VirtualMachineManager;
|
||||
import com.sun.jdi.Bootstrap;
|
||||
import com.sun.jdi.connect.Connector;
|
||||
import com.sun.jdi.connect.Connector.IntegerArgument;
|
||||
|
||||
|
||||
/**
|
||||
* The test for the implementation of an object of the type <BR>
|
||||
* Connector_Argument. <BR>
|
||||
* <BR>
|
||||
* The test checks up that the method <BR>
|
||||
* <code>com.sun.jdi.connect.Connector.Argument.mustSpecify()</code> <BR>
|
||||
* complies with its specification. <BR>
|
||||
* <BR>
|
||||
* In case of Connector has no Argument needed to be specified, <BR>
|
||||
* the test prints warning message. <BR>
|
||||
* The test is always passed and produces <BR>
|
||||
* the return value 95. <BR>
|
||||
*/
|
||||
|
||||
//
|
||||
public class mustspecify001 {
|
||||
|
||||
public static void main(String argv[]) {
|
||||
System.exit(run(argv, System.out) + 95); // JCK-compatible exit status
|
||||
}
|
||||
|
||||
public static int run(String argv[], PrintStream out) {
|
||||
|
||||
int exitCode = 0;
|
||||
int exitCode0 = 0;
|
||||
int exitCode2 = 2;
|
||||
//
|
||||
String sErr1 = "WARNING\n" +
|
||||
"Method tested: " +
|
||||
"jdi.Connector.IntegerArgument.intValue\n" ;
|
||||
//
|
||||
String sErr2 = "ERROR\n" +
|
||||
"Method tested: " +
|
||||
"jdi.Connector.IntegerArgument.intValue()\n" ;
|
||||
|
||||
VirtualMachineManager vmm = Bootstrap.virtualMachineManager();
|
||||
|
||||
List connectorsList = vmm.allConnectors();
|
||||
Iterator connectorsListIterator = connectorsList.iterator();
|
||||
//
|
||||
Connector.Argument argument = null;
|
||||
|
||||
for ( ; ; ) {
|
||||
try {
|
||||
Connector connector =
|
||||
(Connector) connectorsListIterator.next();
|
||||
|
||||
Map defaultArguments = connector.defaultArguments();
|
||||
Set keyset = defaultArguments.keySet();
|
||||
int keysetSize = defaultArguments.size();
|
||||
Iterator keysetIterator = keyset.iterator();
|
||||
|
||||
for ( ; ; ) {
|
||||
try {
|
||||
String argName = (String) keysetIterator.next();
|
||||
|
||||
try {
|
||||
//
|
||||
argument = (Connector.Argument)
|
||||
defaultArguments.get(argName);
|
||||
break ;
|
||||
} catch ( ClassCastException e) {
|
||||
}
|
||||
} catch ( NoSuchElementException e) {
|
||||
break ;
|
||||
}
|
||||
}
|
||||
if ((argument != null) && argument.mustSpecify()) {
|
||||
break ;
|
||||
}
|
||||
} catch ( NoSuchElementException e) {
|
||||
out.println(sErr1 +
|
||||
//
|
||||
"no Connector with Argument must be specified, found\n");
|
||||
return exitCode0;
|
||||
}
|
||||
}
|
||||
/*
|
||||
argument.setValue("0");
|
||||
if (argument.mustSpecify()) {
|
||||
out.println("mustSpecify is the same\n");
|
||||
} else {
|
||||
out.println("mustSpecify is changed\n");
|
||||
}
|
||||
|
||||
if (exitCode != exitCode0) {
|
||||
out.println("TEST FAILED");
|
||||
}
|
||||
*/
|
||||
return exitCode0;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,55 @@
|
||||
/*
|
||||
* Copyright (c) 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.
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* @test
|
||||
*
|
||||
* @summary converted from VM Testbase nsk/jdi/Argument/mustSpecify/mustspecify001.
|
||||
* VM Testbase keywords: [quick, jpda, jdi]
|
||||
* VM Testbase readme:
|
||||
* DESCRIPTION:
|
||||
* The test for the implementation of an object of the type
|
||||
* Connector.Argument.
|
||||
* The test checks whether Connector has Argument
|
||||
* needed to be specified.
|
||||
* If no such Argument, the test prints warning message;
|
||||
* otherwise no message.
|
||||
* The test is always passed and produces
|
||||
* the return value 95.
|
||||
* COMMENTS:
|
||||
*
|
||||
* @library /vmTestbase
|
||||
* /test/lib
|
||||
* @run driver jdk.test.lib.FileInstaller . .
|
||||
* @build nsk.jdi.Argument.mustSpecify.mustspecify001
|
||||
* @run main/othervm PropertyResolvingWrapper
|
||||
* nsk.jdi.Argument.mustSpecify.mustspecify001
|
||||
* -verbose
|
||||
* -arch=${os.family}-${os.simpleArch}
|
||||
* -waittime=5
|
||||
* -debugee.vmkind=java
|
||||
* -transport.address=dynamic
|
||||
* "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}"
|
||||
*/
|
||||
|
||||
115
test/hotspot/jtreg/vmTestbase/nsk/jdi/Argument/name/name001.java
Normal file
115
test/hotspot/jtreg/vmTestbase/nsk/jdi/Argument/name/name001.java
Normal file
@ -0,0 +1,115 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 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 nsk.jdi.Argument.name;
|
||||
|
||||
import nsk.share.*;
|
||||
import nsk.share.jpda.*;
|
||||
import nsk.share.jdi.*;
|
||||
|
||||
import com.sun.jdi.*;
|
||||
import com.sun.jdi.connect.Connector;
|
||||
import java.io.*;
|
||||
import javax.naming.directory.Attribute;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* Test for the control of
|
||||
*
|
||||
* Interface: com.sun.jdi.connect.Connector.Argument
|
||||
* Method: public java.lang.String name()
|
||||
* Assertion: "Returns a short, unique identifier for the argument."
|
||||
*/
|
||||
|
||||
public class name001 {
|
||||
private static Log log;
|
||||
|
||||
public static void main( String argv[] ) {
|
||||
System.exit(run(argv, System.out)+95); // JCK-compatible exit status
|
||||
}
|
||||
|
||||
public static int run(String argv[],PrintStream out) {
|
||||
ArgumentHandler argHandler = new ArgumentHandler(argv);
|
||||
log = new Log(out, argHandler);
|
||||
VirtualMachineManager vmm = Bootstrap.virtualMachineManager();
|
||||
|
||||
List acl = vmm.allConnectors();
|
||||
if (acl.size() > 0) {
|
||||
log.display("Number of all known JDI connectors: " + acl.size());
|
||||
} else {
|
||||
log.complain("FAILURE: no JDI connectors found!");
|
||||
return 2;
|
||||
}
|
||||
|
||||
Iterator aci = acl.iterator();
|
||||
for (int i = 1; aci.hasNext(); i++) {
|
||||
Connector c = (Connector) aci.next();
|
||||
Map cdfltArgmnts = c.defaultArguments();
|
||||
int ksz = cdfltArgmnts.size();
|
||||
String ids[] = new String[ksz + 1];
|
||||
Set ks = cdfltArgmnts.keySet();
|
||||
if (ks.isEmpty()) {
|
||||
log.complain("FAILURE: empty default arguments set is found "
|
||||
+ "for " + c.name() + " connector!");
|
||||
return 2;
|
||||
}
|
||||
|
||||
log.display("Looking over " + c.name() + " connector arguments: ");
|
||||
|
||||
Iterator argi = ks.iterator();
|
||||
for (int j = 1; argi.hasNext(); j++) {
|
||||
String argkey = (String) argi.next();
|
||||
Connector.Argument argval =
|
||||
(Connector.Argument)cdfltArgmnts.get((Object) argkey);
|
||||
String idntfr = argval.name();
|
||||
|
||||
if (idntfr == null) {
|
||||
log.complain("FAILURE: argument identifier is null "
|
||||
+ "for " + argkey + " argument of " + c.name()
|
||||
+ " connector!");
|
||||
return 2;
|
||||
}
|
||||
if (idntfr.length() < 1) {
|
||||
log.complain("FAILURE: empty argument identifier is found "
|
||||
+ "for " + argkey + " argument of " + c.name()
|
||||
+ " connector!");
|
||||
return 2;
|
||||
}
|
||||
|
||||
for (int k = 1; k < j && j > 1; k++) {
|
||||
log.display("ids[" + k + "] = " + ids[k]);
|
||||
if (ids[k].equals(idntfr)) {
|
||||
log.complain("FAILURE: identifier of argument "
|
||||
+ "value isn't unique ( " + idntfr + ")!");
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
ids[j] = idntfr;
|
||||
log.display("Next (" + j + ") argument's identifier is: "
|
||||
+ argval.name());
|
||||
};
|
||||
};
|
||||
log.display("Test PASSED!");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,54 @@
|
||||
/*
|
||||
* Copyright (c) 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.
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* @test
|
||||
*
|
||||
* @summary converted from VM Testbase nsk/jdi/Argument/name/name001.
|
||||
* VM Testbase keywords: [quick, jpda, jdi]
|
||||
* VM Testbase readme:
|
||||
* ================================================
|
||||
* DESCRIPTION:
|
||||
* The test is aimed on the control of:
|
||||
* Interface: com.sun.jdi.connect.Connector.Argument
|
||||
* Method: public java.lang.String name()
|
||||
* Assertion: "Returns a short, unique identifier for the argument."
|
||||
* ================================================
|
||||
* COMMENTS:
|
||||
* ================================================
|
||||
*
|
||||
* @library /vmTestbase
|
||||
* /test/lib
|
||||
* @run driver jdk.test.lib.FileInstaller . .
|
||||
* @build nsk.jdi.Argument.name.name001
|
||||
* @run main/othervm PropertyResolvingWrapper
|
||||
* nsk.jdi.Argument.name.name001
|
||||
* -verbose
|
||||
* -arch=${os.family}-${os.simpleArch}
|
||||
* -waittime=5
|
||||
* -debugee.vmkind=java
|
||||
* -transport.address=dynamic
|
||||
* "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}"
|
||||
*/
|
||||
|
||||
@ -0,0 +1,132 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 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 nsk.jdi.Argument.setValue;
|
||||
|
||||
import java.io.PrintStream;
|
||||
import java.io.Serializable;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.List;
|
||||
import java.util.Iterator;
|
||||
import java.util.NoSuchElementException;
|
||||
|
||||
import java.lang.NullPointerException;
|
||||
|
||||
import com.sun.jdi.VirtualMachineManager;
|
||||
import com.sun.jdi.Bootstrap;
|
||||
import com.sun.jdi.connect.Connector;
|
||||
import com.sun.jdi.connect.Connector.Argument;
|
||||
|
||||
|
||||
/**
|
||||
* The test for the implementation of an object of the type <BR>
|
||||
* Connector.Argument. <BR>
|
||||
*
|
||||
* The test checks up that results of the method <BR>
|
||||
* <code>com.sun.jdi.connect.Connector.Argument.setValue()</code> <BR>
|
||||
* complies with its specification. <BR>
|
||||
* The case for testing includes throwing NullPointerException <BR>
|
||||
* if a parameter is null-string. <BR>
|
||||
* <BR>
|
||||
*/
|
||||
|
||||
|
||||
public class setvalue001 {
|
||||
|
||||
public static void main(String argv[]) {
|
||||
System.exit(run(argv, System.out) + 95); // JCK-compatible exit status
|
||||
}
|
||||
|
||||
public static int run(String argv[], PrintStream out) {
|
||||
|
||||
int exitCode = 0;
|
||||
int exitCode0 = 0;
|
||||
int exitCode2 = 2;
|
||||
//
|
||||
String sErr1 = "WARNING\n" +
|
||||
"Method tested: " +
|
||||
"jdi.Connector.Argument.setValue()\n" ;
|
||||
//
|
||||
String sErr2 = "ERROR\n" +
|
||||
"Method tested: " +
|
||||
"jdi.Connector.Argument.setValue()\n" ;
|
||||
|
||||
VirtualMachineManager vmm = Bootstrap.virtualMachineManager();
|
||||
|
||||
List connectorsList = vmm.allConnectors();
|
||||
Iterator connectorsListIterator = connectorsList.iterator();
|
||||
//
|
||||
Connector.Argument argument = null;
|
||||
|
||||
for ( ; ; ) {
|
||||
try {
|
||||
Connector connector =
|
||||
(Connector) connectorsListIterator.next();
|
||||
|
||||
Map defaultArguments = connector.defaultArguments();
|
||||
Set keyset = defaultArguments.keySet();
|
||||
int keysetSize = defaultArguments.size();
|
||||
Iterator keysetIterator = keyset.iterator();
|
||||
|
||||
for ( ; ; ) {
|
||||
try {
|
||||
String argName = (String) keysetIterator.next();
|
||||
|
||||
try {
|
||||
//
|
||||
argument = (Connector.Argument)
|
||||
defaultArguments.get(argName);
|
||||
break ;
|
||||
} catch ( ClassCastException e) {
|
||||
}
|
||||
} catch ( NoSuchElementException e) {
|
||||
break ;
|
||||
}
|
||||
}
|
||||
if (argument != null) {
|
||||
break ;
|
||||
}
|
||||
} catch ( NoSuchElementException e) {
|
||||
out.println(sErr1 +
|
||||
"no Connecter with Argument found\n");
|
||||
return exitCode0;
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
argument.setValue(null);
|
||||
exitCode = exitCode2;
|
||||
out.println(sErr2 +
|
||||
"check: setValue(null); \n" +
|
||||
"error: no NullPointerException thrown\n");
|
||||
} catch ( java.lang.NullPointerException e ) {
|
||||
}
|
||||
|
||||
if (exitCode != exitCode0)
|
||||
out.println("TEST FAILED");
|
||||
|
||||
return exitCode;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,76 @@
|
||||
/*
|
||||
* Copyright (c) 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.
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* @test
|
||||
*
|
||||
* @summary converted from VM Testbase nsk/jdi/Argument/setValue/setvalue001.
|
||||
* VM Testbase keywords: [quick, jpda, jdi]
|
||||
* VM Testbase readme:
|
||||
* DESCRIPTION:
|
||||
* The test for the implementation of an object of the type
|
||||
* Connector.Argument.
|
||||
* The test checks up that a result of the method
|
||||
* com.sun.jdi.connect.Connector.Argument.setValue()
|
||||
* complies with its specification.
|
||||
* Check: setValue(null) doesn't set NullPointerException.
|
||||
* The test works as follows:
|
||||
* - Virtual Machine Manager is invoked.
|
||||
* - First Connector.Argument object is searched among
|
||||
* VMM Connectors.
|
||||
* If no the argument is found out the test exits
|
||||
* with the return value = 95 and a warning message.
|
||||
* - The following checks are applied:
|
||||
* IF argument.setValue(null) results in NullPointerException
|
||||
* THEN an error detected
|
||||
* ELSE the check passed
|
||||
* In case of error the test produces the return value 97 and
|
||||
* a corresponding error message(s).
|
||||
* Otherwise, the test is passed and produces
|
||||
* the return value 95 and no message.
|
||||
* COMMENTS:
|
||||
* To fix the bug 4491137,
|
||||
* the test is corrected to comply with
|
||||
* the updated specification in jdi-overview.html:
|
||||
* Any method which takes a Object as an parameter
|
||||
* will throw NullPointerException if
|
||||
* null is passed directly or indirectly --
|
||||
* unless null is explicitly mentioned as a valid parameter.
|
||||
* From now, the test regards throwing NullPointerException
|
||||
* as the correct reaction to the null-parameter.
|
||||
*
|
||||
* @library /vmTestbase
|
||||
* /test/lib
|
||||
* @run driver jdk.test.lib.FileInstaller . .
|
||||
* @build nsk.jdi.Argument.setValue.setvalue001
|
||||
* @run main/othervm PropertyResolvingWrapper
|
||||
* nsk.jdi.Argument.setValue.setvalue001
|
||||
* -verbose
|
||||
* -arch=${os.family}-${os.simpleArch}
|
||||
* -waittime=5
|
||||
* -debugee.vmkind=java
|
||||
* -transport.address=dynamic
|
||||
* "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}"
|
||||
*/
|
||||
|
||||
@ -0,0 +1,143 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 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 nsk.jdi.Argument.setValue;
|
||||
|
||||
import java.io.PrintStream;
|
||||
import java.io.Serializable;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.List;
|
||||
import java.util.Iterator;
|
||||
import java.util.NoSuchElementException;
|
||||
|
||||
import com.sun.jdi.VirtualMachineManager;
|
||||
import com.sun.jdi.Bootstrap;
|
||||
import com.sun.jdi.connect.Connector;
|
||||
import com.sun.jdi.connect.Connector.Argument;
|
||||
import com.sun.jdi.connect.LaunchingConnector;
|
||||
|
||||
|
||||
/**
|
||||
* The test for the implementation of an object of the type <BR>
|
||||
* Connector.Argument. <BR>
|
||||
*
|
||||
* The test checks up that results of the method <BR>
|
||||
* <code>com.sun.jdi.connect.Connector.Argument.setValue()</code> <BR>
|
||||
* complies with its specification, when a string value to be set <BR>
|
||||
* is the empty or non-empty string. <BR>
|
||||
* <BR>
|
||||
* In case of the method Arguemnt.value() returns the value, <BR>
|
||||
* not equal to one has been set, <BR>
|
||||
* the test produces the return value 97 and <BR>
|
||||
* a corresponding error message. <BR>
|
||||
* Otherwise, the test is passed and produces <BR>
|
||||
* the return value 95 and no message. <BR>
|
||||
*/
|
||||
|
||||
|
||||
public class setvalue002 {
|
||||
|
||||
public static void main(String argv[]) {
|
||||
System.exit(run(argv, System.out) + 95); // JCK-compatible exit status
|
||||
}
|
||||
|
||||
public static int run(String argv[], PrintStream out) {
|
||||
|
||||
int exitCode = 0;
|
||||
int exitCode0 = 0;
|
||||
int exitCode2 = 2;
|
||||
//
|
||||
String sErr1 = "WARNING\n" +
|
||||
"Method tested: " +
|
||||
"jdi.Connector.IntegerArgument.max\n" ;
|
||||
//
|
||||
String sErr2 = "ERROR\n" +
|
||||
"Method tested: " +
|
||||
"jdi.Connector.Argument.setValue()\n" ;
|
||||
|
||||
VirtualMachineManager vmm = Bootstrap.virtualMachineManager();
|
||||
|
||||
List connectorsList = vmm.allConnectors();
|
||||
Iterator connectorsListIterator = connectorsList.iterator();
|
||||
//
|
||||
Connector.Argument argument = null;
|
||||
|
||||
for ( ; ; ) {
|
||||
try {
|
||||
Connector connector =
|
||||
(Connector) connectorsListIterator.next();
|
||||
|
||||
Map defaultArguments = connector.defaultArguments();
|
||||
Set keyset = defaultArguments.keySet();
|
||||
int keysetSize = defaultArguments.size();
|
||||
Iterator keysetIterator = keyset.iterator();
|
||||
|
||||
for ( ; ; ) {
|
||||
try {
|
||||
String argName = (String) keysetIterator.next();
|
||||
|
||||
try {
|
||||
//
|
||||
argument = (Connector.Argument)
|
||||
defaultArguments.get(argName);
|
||||
break ;
|
||||
} catch ( ClassCastException e) {
|
||||
}
|
||||
} catch ( NoSuchElementException e) {
|
||||
break ;
|
||||
}
|
||||
}
|
||||
if (argument != null) {
|
||||
break ;
|
||||
}
|
||||
} catch ( NoSuchElementException e) {
|
||||
out.println(sErr1 +
|
||||
"no Connecter with Argument found\n");
|
||||
return exitCode0;
|
||||
}
|
||||
}
|
||||
|
||||
argument.setValue("");
|
||||
if (argument.value() != "") {
|
||||
exitCode = exitCode2;
|
||||
out.println(sErr2 +
|
||||
"check: setValue('');\n" +
|
||||
"result: argument.value != ''\n");
|
||||
}
|
||||
|
||||
argument.setValue("a");
|
||||
if (argument.value() != "a") {
|
||||
exitCode = exitCode2;
|
||||
out.println(sErr2 +
|
||||
"check: argument.setValue('a');\n" +
|
||||
"result: argument.value != 'a'\n");
|
||||
}
|
||||
|
||||
if (exitCode != exitCode0)
|
||||
out.println("TEST FAILED");
|
||||
|
||||
return exitCode;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,71 @@
|
||||
/*
|
||||
* Copyright (c) 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.
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* @test
|
||||
*
|
||||
* @summary converted from VM Testbase nsk/jdi/Argument/setValue/setvalue002.
|
||||
* VM Testbase keywords: [quick, jpda, jdi]
|
||||
* VM Testbase readme:
|
||||
* DESCRIPTION:
|
||||
* The test for the implementation of an object of the type
|
||||
* Connector.Argument.
|
||||
* The test checks up that a result of the method
|
||||
* com.sun.jdi.connect.Connector.Argument.setValue()
|
||||
* complies with its specification.
|
||||
* The test works as follows:
|
||||
* - Virtual Machine Manager is invoked.
|
||||
* - First Connector.Argument object is searched among
|
||||
* Connectors.
|
||||
* If no the argument is found out the test exits
|
||||
* with the return value = 97 and a error message.
|
||||
* - The following checks are applied:
|
||||
* argument.setValue("");
|
||||
* IF ( argument.value != "")
|
||||
* THEN an error detected
|
||||
* ELSE the check passed
|
||||
* argument.setValue("a");
|
||||
* IF ( argument.value != "a")
|
||||
* THEN an error detected
|
||||
* ELSE the check passed
|
||||
* In case of error the test produces the return value 97 and
|
||||
* a corresponding error message(s).
|
||||
* Otherwise, the test is passed and produces
|
||||
* the return value 95 and no message.
|
||||
* COMMENTS:
|
||||
*
|
||||
* @library /vmTestbase
|
||||
* /test/lib
|
||||
* @run driver jdk.test.lib.FileInstaller . .
|
||||
* @build nsk.jdi.Argument.setValue.setvalue002
|
||||
* @run main/othervm PropertyResolvingWrapper
|
||||
* nsk.jdi.Argument.setValue.setvalue002
|
||||
* -verbose
|
||||
* -arch=${os.family}-${os.simpleArch}
|
||||
* -waittime=5
|
||||
* -debugee.vmkind=java
|
||||
* -transport.address=dynamic
|
||||
* "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}"
|
||||
*/
|
||||
|
||||
@ -0,0 +1,121 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 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 nsk.jdi.Argument.value;
|
||||
|
||||
import nsk.share.*;
|
||||
import nsk.share.jpda.*;
|
||||
import nsk.share.jdi.*;
|
||||
|
||||
import com.sun.jdi.*;
|
||||
import com.sun.jdi.connect.Connector;
|
||||
import java.io.*;
|
||||
import javax.naming.directory.Attribute;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* Test for the control of
|
||||
*
|
||||
* Interface: com.sun.jdi.connect.Connector.Argument
|
||||
* Method: public java.lang.String setValue()
|
||||
* Assertion: "Returns the current value of the argument."
|
||||
*/
|
||||
|
||||
public class value001 {
|
||||
private static Log log;
|
||||
|
||||
public static void main( String argv[] ) {
|
||||
System.exit(run(argv, System.out)+95); // JCK-compatible exit status
|
||||
}
|
||||
|
||||
public static int run(String argv[], PrintStream out) {
|
||||
ArgumentHandler argHandler = new ArgumentHandler(argv);
|
||||
log = new Log(out, argHandler);
|
||||
VirtualMachineManager vmm = Bootstrap.virtualMachineManager();
|
||||
|
||||
List acl = vmm.allConnectors();
|
||||
if (acl.size() > 0) {
|
||||
log.display("Number of all known JDI connectors: " + acl.size());
|
||||
} else {
|
||||
log.complain("FAILURE: no JDI connectors found!");
|
||||
return 2;
|
||||
}
|
||||
|
||||
Iterator aci = acl.iterator();
|
||||
for (int i = 1; aci.hasNext(); i++) {
|
||||
Connector c = (Connector) aci.next();
|
||||
Map cdfltArgmnts = c.defaultArguments();
|
||||
int ksz = cdfltArgmnts.size();
|
||||
String av[] = new String[ksz + 1];
|
||||
Set ks = cdfltArgmnts.keySet();
|
||||
if (ks.isEmpty()) {
|
||||
log.complain("FAILURE: empty default argument set is found "
|
||||
+ "for " + c.name() + " connector!");
|
||||
return 2;
|
||||
}
|
||||
|
||||
log.display("Looking over " + c.name() + " connector arguments: ");
|
||||
|
||||
Iterator argi = ks.iterator();
|
||||
for (int j = 1; argi.hasNext(); j++) {
|
||||
String argkey = (String) argi.next();
|
||||
Connector.Argument argval =
|
||||
(Connector.Argument)cdfltArgmnts.get((Object) argkey);
|
||||
|
||||
String ovl = argval.value();
|
||||
String nvl = null;
|
||||
try {
|
||||
argval.setValue(nvl);
|
||||
nvl = argval.value();
|
||||
if (nvl != null) {
|
||||
log.complain("FAILURE: Can't set up new argument "
|
||||
+ "null-value!");
|
||||
return 2;
|
||||
}
|
||||
} catch (java.lang.NullPointerException exc) {
|
||||
log.display("Can't set up new argument null-value.");
|
||||
}
|
||||
|
||||
argval.setValue("*");
|
||||
nvl = argval.value();
|
||||
if (!nvl.equals("*")) {
|
||||
log.complain("FAILURE: Can't set up new argument "
|
||||
+ "'*'");
|
||||
return 2;
|
||||
}
|
||||
|
||||
argval.setValue(ovl);
|
||||
nvl = argval.value();
|
||||
if (nvl != ovl) {
|
||||
log.complain("FAILURE: Can't reset old argument value!");
|
||||
return 2;
|
||||
}
|
||||
|
||||
log.display("Changed " + argval.name() + " argument's value "
|
||||
+ "is: " + nvl);
|
||||
};
|
||||
};
|
||||
log.display("Test PASSED!");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,54 @@
|
||||
/*
|
||||
* Copyright (c) 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.
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* @test
|
||||
*
|
||||
* @summary converted from VM Testbase nsk/jdi/Argument/value/value001.
|
||||
* VM Testbase keywords: [quick, jpda, jdi]
|
||||
* VM Testbase readme:
|
||||
* ================================================
|
||||
* DESCRIPTION:
|
||||
* The test is aimed on the control of:
|
||||
* Interface: com.sun.jdi.connect.Connector.Argument
|
||||
* Method: public java.lang.String setValue()
|
||||
* Assertion: "Returns the current value of the argument."
|
||||
* ================================================
|
||||
* COMMENTS:
|
||||
* ================================================
|
||||
*
|
||||
* @library /vmTestbase
|
||||
* /test/lib
|
||||
* @run driver jdk.test.lib.FileInstaller . .
|
||||
* @build nsk.jdi.Argument.value.value001
|
||||
* @run main/othervm PropertyResolvingWrapper
|
||||
* nsk.jdi.Argument.value.value001
|
||||
* -verbose
|
||||
* -arch=${os.family}-${os.simpleArch}
|
||||
* -waittime=5
|
||||
* -debugee.vmkind=java
|
||||
* -transport.address=dynamic
|
||||
* "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}"
|
||||
*/
|
||||
|
||||
@ -0,0 +1,98 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 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 nsk.jdi.Argument.value;
|
||||
|
||||
import nsk.share.*;
|
||||
import nsk.share.jpda.*;
|
||||
import nsk.share.jdi.*;
|
||||
|
||||
import com.sun.jdi.*;
|
||||
import com.sun.jdi.connect.Connector;
|
||||
import java.io.*;
|
||||
import javax.naming.directory.Attribute;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* Test for the control of
|
||||
*
|
||||
* Interface: com.sun.jdi.connect.Connector.Argument
|
||||
* Method: public java.lang.String value()
|
||||
* Assertion: "Initially, the default value is returned."
|
||||
*/
|
||||
|
||||
public class value002 {
|
||||
|
||||
private static Log log;
|
||||
|
||||
public static void main( String argv[] ) {
|
||||
System.exit(run(argv, System.out)+95); // JCK-compatible exit status
|
||||
}
|
||||
|
||||
public static int run(String argv[], PrintStream out) {
|
||||
ArgumentHandler argHandler = new ArgumentHandler(argv);
|
||||
log = new Log(out, argHandler);
|
||||
VirtualMachineManager vmm = Bootstrap.virtualMachineManager();
|
||||
|
||||
List acl = vmm.allConnectors();
|
||||
if (acl.size() > 0) {
|
||||
log.display("Number of all known JDI connectors: " + acl.size());
|
||||
} else {
|
||||
log.complain("FAILURE: no JDI connectors found!");
|
||||
return 2;
|
||||
}
|
||||
|
||||
Iterator aci = acl.iterator();
|
||||
for (int i=1; aci.hasNext(); i++) {
|
||||
Connector c = (Connector) aci.next();
|
||||
Map cdfltArgmnts = c.defaultArguments();
|
||||
Set ks = cdfltArgmnts.keySet();
|
||||
if (ks.isEmpty()) {
|
||||
log.complain("FAILURE: empty default argument set is found "
|
||||
+ "for " + c.name() + " connector!");
|
||||
return 2;
|
||||
}
|
||||
|
||||
log.display("Looking over " + c.name() + " connector arguments: ");
|
||||
|
||||
Iterator argi = ks.iterator();
|
||||
for (int j = 1; argi.hasNext(); j++) {
|
||||
String argkey = (String) argi.next();
|
||||
Connector.Argument argval =
|
||||
(Connector.Argument)cdfltArgmnts.get((Object) argkey);
|
||||
String vl = argval.value();
|
||||
if (vl == null) {
|
||||
log.display("The default argument value is null.");
|
||||
}
|
||||
if (vl.length() < 1) {
|
||||
log.display("The default argument value is empty.");
|
||||
}
|
||||
log.display("Next (" + j + "," + argval.name() + ") "
|
||||
+ "argument's value is: " + vl);
|
||||
};
|
||||
};
|
||||
|
||||
log.display("Test PASSED!");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,54 @@
|
||||
/*
|
||||
* Copyright (c) 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.
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* @test
|
||||
*
|
||||
* @summary converted from VM Testbase nsk/jdi/Argument/value/value002.
|
||||
* VM Testbase keywords: [quick, jpda, jdi]
|
||||
* VM Testbase readme:
|
||||
* ================================================
|
||||
* DESCRIPTION:
|
||||
* The test is aimed on the control of:
|
||||
* Interface: com.sun.jdi.connect.Connector.Argument
|
||||
* Method: public java.lang.String value()
|
||||
* Assertion: "Initially, the default value is returned."
|
||||
* ================================================
|
||||
* COMMENTS:
|
||||
* ================================================
|
||||
*
|
||||
* @library /vmTestbase
|
||||
* /test/lib
|
||||
* @run driver jdk.test.lib.FileInstaller . .
|
||||
* @build nsk.jdi.Argument.value.value002
|
||||
* @run main/othervm PropertyResolvingWrapper
|
||||
* nsk.jdi.Argument.value.value002
|
||||
* -verbose
|
||||
* -arch=${os.family}-${os.simpleArch}
|
||||
* -waittime=5
|
||||
* -debugee.vmkind=java
|
||||
* -transport.address=dynamic
|
||||
* "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}"
|
||||
*/
|
||||
|
||||
@ -0,0 +1,214 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 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 nsk.jdi.Argument.value;
|
||||
|
||||
import nsk.share.*;
|
||||
import nsk.share.jpda.*;
|
||||
import nsk.share.jdi.*;
|
||||
|
||||
import com.sun.jdi.*;
|
||||
import com.sun.jdi.connect.*;
|
||||
import java.io.*;
|
||||
import javax.naming.directory.Attribute;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* Test for the control of
|
||||
*
|
||||
* Interface: com.sun.jdi.connect.Connector.Argument
|
||||
* Method: public java.lang.String value()
|
||||
* Assertion: "Returns the current value of the argument."
|
||||
*
|
||||
*
|
||||
* Comments: The test aims on the concrete Sun's JDI
|
||||
* reference implementations. It uses
|
||||
* com.sun.jdi.CommandLineLaunch connector and its
|
||||
* "options" and "main" arguments.
|
||||
* The test sets up the new "options" and "main" arguments
|
||||
* values and then checks that new values remain previously
|
||||
* after connection establishing with debugee VM and
|
||||
* after debugee VM finishing.
|
||||
*/
|
||||
|
||||
public class value003 {
|
||||
private static Log log;
|
||||
|
||||
public static void main(String argv[] ) {
|
||||
System.exit(run(argv, System.out)+95); // JCK-compatible exit status
|
||||
}
|
||||
|
||||
public static int run(String argv[], PrintStream out) {
|
||||
ArgumentHandler argHandler = new ArgumentHandler(argv);
|
||||
log = new Log(out, argHandler);
|
||||
VirtualMachineManager vmm = Bootstrap.virtualMachineManager();
|
||||
|
||||
String javaKind = argHandler.getOptions().getProperty("debugee.vmkind");
|
||||
boolean java_g = javaKind != null && javaKind.startsWith("java_g"); // ...or java_g.exe
|
||||
if (java_g)
|
||||
log.display("Test option: java_g");
|
||||
|
||||
List lcl = vmm.launchingConnectors();
|
||||
if (lcl.size() > 0) {
|
||||
log.display("Number of all known JDI launching connectors: " +
|
||||
lcl.size());
|
||||
} else {
|
||||
log.complain("FAILURE: no JDI launching connectors found!");
|
||||
return 2;
|
||||
}
|
||||
|
||||
Iterator lci = lcl.iterator();
|
||||
for (int i = 1; lci.hasNext(); i++) {
|
||||
Connector c = (Connector) lci.next();
|
||||
if (c.name().compareTo("com.sun.jdi.CommandLineLaunch") != 0) {
|
||||
continue;
|
||||
}
|
||||
Map<String,? extends Connector.Argument> cdfltArgmnts = c.defaultArguments();
|
||||
int ksz = cdfltArgmnts.size();
|
||||
String av[] = new String[ksz + 1];
|
||||
Set ks = cdfltArgmnts.keySet();
|
||||
if (ks.isEmpty()) {
|
||||
log.complain("FAILURE: empty default argument set is found "
|
||||
+ "for " + c.name() + " connector!");
|
||||
return 2;
|
||||
}
|
||||
|
||||
log.display("Looking over " + c.name() + " connector arguments: ");
|
||||
|
||||
boolean flg = false;
|
||||
Iterator argi = ks.iterator();
|
||||
String ovl = null;
|
||||
String nvl = null;
|
||||
for (int j = 1; argi.hasNext(); j++) {
|
||||
String argkey = (String)argi.next();
|
||||
Connector.Argument argval =
|
||||
(Connector.Argument)cdfltArgmnts.get((Object) argkey);
|
||||
|
||||
if (java_g && argval.name().equals("vmexec")) {
|
||||
log.display("Substitute: vmexec --> java_g");
|
||||
argval.setValue("java_g");
|
||||
};
|
||||
|
||||
log.display("Connector.Argument argval = "+ argval);
|
||||
if (argkey.compareTo("options") != 0 &&
|
||||
argkey.compareTo("main") != 0) {
|
||||
continue;
|
||||
}
|
||||
if (argkey.compareTo("main") == 0) {
|
||||
if (argval.isValid("nsk.jdi.Argument.value.value003a")) {
|
||||
argval.setValue("nsk.jdi.Argument.value.value003a");
|
||||
} else {
|
||||
log.complain("FAILURE: Can't set up new value for "
|
||||
+ "main-argument");
|
||||
return 2;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
flg = true;
|
||||
ovl = argval.value();
|
||||
if (argval.isValid(ovl + "-verify ")) {
|
||||
argval.setValue(ovl + "-verify ");
|
||||
} else {
|
||||
log.complain("FAILURE: Can't set up new value for "
|
||||
+ "options-argument");
|
||||
return 2;
|
||||
}
|
||||
|
||||
nvl = argval.value();
|
||||
if (nvl.compareTo(ovl + "-verify ") != 0) {
|
||||
log.complain("FAILURE: Can't set up argument value!");
|
||||
return 2;
|
||||
}
|
||||
log.display("Changed " + argval.name() + " argument's "
|
||||
+ "value is: " + nvl);
|
||||
};
|
||||
|
||||
Binder binder = new Binder(argHandler, log);
|
||||
Debugee debugee = null;
|
||||
|
||||
try {
|
||||
if (flg) {
|
||||
flg = false;
|
||||
VirtualMachine vm =
|
||||
((LaunchingConnector) c).launch(cdfltArgmnts);
|
||||
log.display("VM = (" + vm + ")");
|
||||
debugee = binder.enwrapDebugee(vm, vm.process());
|
||||
|
||||
if (((Connector.Argument)cdfltArgmnts
|
||||
.get((Object)"options")).value()
|
||||
.compareTo(ovl + "-verify ") != 0) {
|
||||
log.complain("FAILURE: Current 'options' argument "
|
||||
+ "value is not coinsides with the last "
|
||||
+ "setted up value.");
|
||||
return 2;
|
||||
}
|
||||
if (((Connector.Argument)c.defaultArguments()
|
||||
.get((Object) "options")).value()
|
||||
.compareTo(ovl) != 0) {
|
||||
log.complain("FAILURE: Default 'options' argument "
|
||||
+ "value can not be changed.");
|
||||
return 2;
|
||||
}
|
||||
|
||||
debugee.resume();
|
||||
}
|
||||
} catch ( java.io.IOException exc) {
|
||||
log.complain("FAILURE: Unable to launch, so "
|
||||
+ "java.io.IOException is arisen.");
|
||||
log.complain(exc.getMessage());
|
||||
return 2;
|
||||
} catch (com.sun.jdi.connect.IllegalConnectorArgumentsException
|
||||
exc) {
|
||||
log.complain("FAILURE: One of the connector arguments is "
|
||||
+ "invalid, so IllegalConnectorArgumentsException "
|
||||
+ "is arisen.");
|
||||
log.complain(exc.getMessage());
|
||||
return 2;
|
||||
} catch ( com.sun.jdi.connect.VMStartException exc) {
|
||||
log.complain("FAILURE: VM was terminated with error before "
|
||||
+ "a connection could be established, so "
|
||||
+ "VMStartException is arisen.");
|
||||
log.complain(exc.getMessage());
|
||||
log.complain(Binder.readVMStartExceptionOutput(exc, log.getOutStream()));
|
||||
return 2;
|
||||
} finally {
|
||||
if (debugee != null) {
|
||||
try {
|
||||
debugee.dispose();
|
||||
} catch (VMDisconnectedException ignore) {
|
||||
}
|
||||
|
||||
int extcd = debugee.waitFor();
|
||||
if (extcd != 95) {
|
||||
log.complain("FAILURE: Launching VM crushes with "
|
||||
+ extcd + " exit code.");
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
log.display("Test PASSED!");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,66 @@
|
||||
/*
|
||||
* Copyright (c) 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.
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* @test
|
||||
*
|
||||
* @summary converted from VM Testbase nsk/jdi/Argument/value/value003.
|
||||
* VM Testbase keywords: [quick, jpda, jdi]
|
||||
* VM Testbase readme:
|
||||
* ================================================
|
||||
* DESCRIPTION:
|
||||
* The test is aimed on the control of:
|
||||
* Interface: com.sun.jdi.connect.Connector.Argument
|
||||
* Method: public java.lang.String value()
|
||||
* Assertion: "Returns the current value of the argument."
|
||||
* ================================================
|
||||
* COMMENTS:
|
||||
* The test aims on the concrete Sun's JDI
|
||||
* reference implementations. It uses
|
||||
* com.sun.jdi.CommandLineLaunch connector and its
|
||||
* "options" and "main" arguments.
|
||||
* The test sets up the new "options" and "main" arguments
|
||||
* values and then checks that new values remain previously
|
||||
* after connection establishing with debugee VM and
|
||||
* after debugee VM finishing.
|
||||
* Test was fixed according to test bug:
|
||||
* 4778296 TEST_BUG: debuggee VM intemittently hangs after resuming
|
||||
* - debuggee wrapper is used to handle VMStartEvent
|
||||
* ================================================
|
||||
*
|
||||
* @library /vmTestbase
|
||||
* /test/lib
|
||||
* @run driver jdk.test.lib.FileInstaller . .
|
||||
* @build nsk.jdi.Argument.value.value003
|
||||
* nsk.jdi.Argument.value.value003a
|
||||
* @run main/othervm PropertyResolvingWrapper
|
||||
* nsk.jdi.Argument.value.value003
|
||||
* -verbose
|
||||
* -arch=${os.family}-${os.simpleArch}
|
||||
* -waittime=5
|
||||
* -debugee.vmkind=java
|
||||
* -transport.address=dynamic
|
||||
* "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}"
|
||||
*/
|
||||
|
||||
@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 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 nsk.jdi.Argument.value;
|
||||
|
||||
/**
|
||||
* Debugee.
|
||||
*/
|
||||
public class value003a {
|
||||
public static void main (String args[]) {
|
||||
System.exit(95);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,220 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 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 nsk.jdi.Argument.value;
|
||||
|
||||
import nsk.share.*;
|
||||
import nsk.share.jpda.*;
|
||||
import nsk.share.jdi.*;
|
||||
|
||||
import com.sun.jdi.*;
|
||||
import com.sun.jdi.connect.*;
|
||||
import java.io.*;
|
||||
import javax.naming.directory.Attribute;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* Test for the control of
|
||||
*
|
||||
* Interface: com.sun.jdi.connect.Connector.Argument
|
||||
* Method: public java.lang.String value()
|
||||
* Assertion: "Returns the current value of the argument."
|
||||
*
|
||||
*
|
||||
* Comments: The test aims on the concrete Sun's JDI
|
||||
* reference implementations. It uses
|
||||
* com.sun.jdi.RawCommandLineLaunch connector and its
|
||||
* "command" argument.
|
||||
* The test sets up the new "command" argument
|
||||
* value and then checks that new value remains previously
|
||||
* after connection establishing with debugee VM and
|
||||
* after debugee VM finishing.
|
||||
*
|
||||
* Warning: Temporarily the test is prepared only for
|
||||
* Sparc.Solaris.dt_socket-transport of RawCommandLineLaunch
|
||||
* connector
|
||||
*/
|
||||
|
||||
public class value004 {
|
||||
private static Log log;
|
||||
|
||||
public static void main( String argv[] ) {
|
||||
System.exit(run(argv, System.out)+95); // JCK-compatible exit status
|
||||
}
|
||||
|
||||
public static int run(String argv[],PrintStream out) {
|
||||
ArgumentHandler argHandler = new ArgumentHandler(argv);
|
||||
log = new Log(out, argHandler);
|
||||
VirtualMachineManager vmm = Bootstrap.virtualMachineManager();
|
||||
|
||||
String address = argHandler.getTransportPort();
|
||||
|
||||
List lcl = vmm.launchingConnectors();
|
||||
if (lcl.size() > 0) {
|
||||
log.display("Number of all known JDI launching connectors: "
|
||||
+ lcl.size());
|
||||
} else {
|
||||
log.complain("FAILURE: no JDI launching connectors found!");
|
||||
return 2;
|
||||
}
|
||||
|
||||
Iterator lci = lcl.iterator();
|
||||
for (int i = 1; lci.hasNext(); i++) {
|
||||
Connector c = (Connector) lci.next();
|
||||
if (c.name().compareTo("com.sun.jdi.RawCommandLineLaunch") != 0) {
|
||||
continue;
|
||||
}
|
||||
log.display("Connector's transport is: " + c.transport().name());
|
||||
if (c.transport().name().compareTo("dt_socket") != 0) {
|
||||
log.display("WARNING: Temporarily the test is prepared only "
|
||||
+ "for dt_socket-transport of "
|
||||
+ "RawCommandLineLaunch connector!");
|
||||
return 0;
|
||||
}
|
||||
if (System.getProperties().getProperty("os.arch")
|
||||
.compareTo("sparc") != 0 ||
|
||||
System.getProperties().getProperty("os.name")
|
||||
.compareTo("SunOS") != 0) {
|
||||
log.display("WARNING: Temporarily the test is prepared "
|
||||
+ "only for Sparc.Solaris-transport of "
|
||||
+ "RawCommandLineLaunch connector!");
|
||||
return 0;
|
||||
}
|
||||
Map<java.lang.String,? extends com.sun.jdi.connect.Connector.Argument> cdfltArgmnts = c.defaultArguments();
|
||||
int ksz = cdfltArgmnts.size();
|
||||
String av[] = new String[ksz + 1];
|
||||
Set ks = cdfltArgmnts.keySet();
|
||||
if (ks.isEmpty()) {
|
||||
log.complain("FAILURE: empty default arguments set is "
|
||||
+ "found for " + c.name() + " connector!");
|
||||
return 2;
|
||||
}
|
||||
|
||||
log.display("Looking over " + c.name() + " connector arguments: ");
|
||||
|
||||
boolean flg = false;
|
||||
Iterator argi = ks.iterator();
|
||||
String ovl = null;
|
||||
String nvl = null;
|
||||
for (int j = 1; argi.hasNext(); j++) {
|
||||
String argkey = (String) argi.next();
|
||||
Connector.Argument argval =
|
||||
(Connector.Argument)cdfltArgmnts.get((Object) argkey);
|
||||
log.display("Connector.Argument argval = "+ argval);
|
||||
if (argkey.compareTo("command") != 0 &&
|
||||
argkey.compareTo("address") != 0) {
|
||||
continue;
|
||||
}
|
||||
if (argkey.compareTo("address") == 0) {
|
||||
if (argval.isValid(address)) {
|
||||
argval.setValue(address);
|
||||
} else {
|
||||
log.complain("FAILURE: Can't set up new value "
|
||||
+ "for address-argument");
|
||||
return 2;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
flg = true;
|
||||
ovl = argHandler.getLaunchExecPath() + " "
|
||||
+ "-Xdebug -Xnoagent -Djava.compiler=NONE "
|
||||
+ "-Xrunjdwp:transport=dt_socket,suspend=y,"
|
||||
+ "address=" + address + " nsk.jdi.Argument.value.value004a";
|
||||
if (argval.isValid(ovl)) {
|
||||
argval.setValue(ovl);
|
||||
} else {
|
||||
log.complain("FAILURE: Can't set up new value for "
|
||||
+ "command-argument");
|
||||
return 2;
|
||||
}
|
||||
|
||||
nvl = argval.value();
|
||||
if (nvl.compareTo(ovl) != 0) {
|
||||
log.complain("FAILURE: Can't set up argument value!");
|
||||
return 2;
|
||||
}
|
||||
log.display("Changed " + argval.name() + " argument's "
|
||||
+ "value is: " + nvl);
|
||||
};
|
||||
|
||||
Binder binder = new Binder(argHandler, log);
|
||||
Debugee debugee = null;
|
||||
|
||||
try {
|
||||
if (flg) {
|
||||
flg = false;
|
||||
VirtualMachine vm =
|
||||
((LaunchingConnector)c).launch(cdfltArgmnts);
|
||||
log.display("VM = (" + vm + ")");
|
||||
debugee = binder.enwrapDebugee(vm, vm.process());
|
||||
|
||||
if (((Connector.Argument) cdfltArgmnts
|
||||
.get((Object) "command")).value()
|
||||
.compareTo(ovl) != 0) {
|
||||
log.complain("FAILURE: Current 'command' argument "
|
||||
+ "value is not coinsides with the "
|
||||
+ "last setted up value.");
|
||||
return 2;
|
||||
}
|
||||
|
||||
debugee.resume();
|
||||
}
|
||||
} catch ( java.io.IOException exc) {
|
||||
log.complain("FAILURE: Unable to launch, so "
|
||||
+ "java.io.IOException is arisen.");
|
||||
log.complain(exc.getMessage());
|
||||
return 2;
|
||||
} catch ( com.sun.jdi.connect.IllegalConnectorArgumentsException
|
||||
exc) {
|
||||
log.complain("FAILURE: One of the connector arguments "
|
||||
+ "is invalid, so "
|
||||
+ "IllegalConnectorArgumentsException is arisen.");
|
||||
log.complain(exc.getMessage());
|
||||
return 2;
|
||||
} catch ( com.sun.jdi.connect.VMStartException exc) {
|
||||
log.complain("FAILURE: VM was terminated with error before "
|
||||
+ "a connection could be established, so "
|
||||
+ "VMStartException is arisen.");
|
||||
log.complain(exc.getMessage());
|
||||
log.complain(Binder.readVMStartExceptionOutput(exc, log.getOutStream()));
|
||||
return 2;
|
||||
} finally {
|
||||
if (debugee != null) {
|
||||
try {
|
||||
debugee.dispose();
|
||||
} catch (VMDisconnectedException ignore) {
|
||||
}
|
||||
|
||||
int extcd = debugee.waitFor();
|
||||
if (extcd != 95) {
|
||||
log.complain("FAILURE: Launching VM crushes "
|
||||
+ "with " + extcd + " exit code.");
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
log.display("Test PASSED!");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,71 @@
|
||||
/*
|
||||
* Copyright (c) 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.
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* @test
|
||||
*
|
||||
* @summary converted from VM Testbase nsk/jdi/Argument/value/value004.
|
||||
* VM Testbase keywords: [jpda, jdi]
|
||||
* VM Testbase readme:
|
||||
* ================================================
|
||||
* DESCRIPTION:
|
||||
* The test is aimed on the control of:
|
||||
* Interface: com.sun.jdi.connect.Connector.Argument
|
||||
* Method: public java.lang.String value()
|
||||
* Assertion: "Returns the current value of the argument."
|
||||
* ================================================
|
||||
* COMMENTS:
|
||||
* The test aims on the concrete Sun's JDI
|
||||
* reference implementations. It uses
|
||||
* com.sun.jdi.RawCommandLineLaunch connector and its
|
||||
* "command" argument.
|
||||
* The test sets up the new "command" argument
|
||||
* value and then checks that new value remains previously
|
||||
* after connection establishing with debugee VM and
|
||||
* after debugee VM finishing.
|
||||
* Test was fixed according to test bug:
|
||||
* 4778296 TEST_BUG: debuggee VM intemittently hangs after resuming
|
||||
* - debuggee wrapper is used to handle VMStartEvent
|
||||
* ================================================
|
||||
* WARNING:
|
||||
* Temporarily the test is prepared only for
|
||||
* Sparc.Solaris.dt_socket-transport of RawCommandLineLaunch
|
||||
* connector
|
||||
* ================================================
|
||||
*
|
||||
* @library /vmTestbase
|
||||
* /test/lib
|
||||
* @run driver jdk.test.lib.FileInstaller . .
|
||||
* @build nsk.jdi.Argument.value.value004
|
||||
* nsk.jdi.Argument.value.value004a
|
||||
* @run main/othervm PropertyResolvingWrapper
|
||||
* nsk.jdi.Argument.value.value004
|
||||
* -verbose
|
||||
* -arch=${os.family}-${os.simpleArch}
|
||||
* -waittime=5
|
||||
* -debugee.vmkind=java
|
||||
* -transport.address=dynamic
|
||||
* "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}"
|
||||
*/
|
||||
|
||||
@ -0,0 +1,57 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 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 nsk.jdi.Argument.value;
|
||||
|
||||
//import java.io.*;
|
||||
|
||||
/**
|
||||
* Debugee.
|
||||
*/
|
||||
public class value004a {
|
||||
public static void main (String args[]) {
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// The following fragment was used only for connection establishing debuging:
|
||||
// File outputFile = new File("ZSS");
|
||||
// FileOutputStream flos = null;
|
||||
// try {
|
||||
// flos = new FileOutputStream(outputFile);
|
||||
// } catch (java.io.FileNotFoundException exc) {
|
||||
// System.exit(97);
|
||||
// }
|
||||
// FilterOutputStream fltros = new FilterOutputStream(flos);
|
||||
// PrintStream ps = new PrintStream(fltros);
|
||||
// ps.println("=========== value004a is invoked! ==================");
|
||||
// ps.close();
|
||||
//// Thread.currentThread().suspend();
|
||||
// try {
|
||||
// Thread.currentThread().sleep(5000);
|
||||
// } catch (java.lang.InterruptedException exc) {
|
||||
// System.exit(97);
|
||||
// }
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
System.exit(95);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,568 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 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 nsk.jdi.ArrayReference.getValue;
|
||||
|
||||
import nsk.share.*;
|
||||
import nsk.share.jpda.*;
|
||||
import nsk.share.jdi.*;
|
||||
|
||||
import com.sun.jdi.*;
|
||||
import java.io.*;
|
||||
|
||||
public class getvalue001 {
|
||||
final static boolean BOOL[] = {true, false};
|
||||
final static byte BYTE[] = {Byte.MIN_VALUE, -1, 0, 1, Byte.MAX_VALUE};
|
||||
final static char CHAR[] = {Character.MIN_VALUE, '\u00ff', '\uff00',
|
||||
Character.MAX_VALUE};
|
||||
final static double DOUB[] = {Double.NEGATIVE_INFINITY, Double.MIN_VALUE,
|
||||
-1, -0, 1111111111.0, 1, Double.MAX_VALUE,
|
||||
Double.POSITIVE_INFINITY,
|
||||
Double.NaN};
|
||||
final static float FLOAT[] = {Float.NEGATIVE_INFINITY, Float.MIN_VALUE,
|
||||
-1, -0, 0, 1, Float.MAX_VALUE,
|
||||
Float.POSITIVE_INFINITY, Float.NaN};
|
||||
final static int INT[] = {Integer.MIN_VALUE, -1, 0, 1,
|
||||
Integer.MAX_VALUE};
|
||||
final static long LONG[] = {Long.MIN_VALUE, -1, 0, 1, Long.MAX_VALUE};
|
||||
final static short SHORT[] = {Short.MIN_VALUE, -1, 0, 1, Short.MAX_VALUE};
|
||||
|
||||
final static String FIELD_NAME[][] = {
|
||||
{"z1", "boolean"},
|
||||
{"b1", "byte"},
|
||||
{"c1", "char"},
|
||||
{"d1", "double"},
|
||||
{"f1", "float"},
|
||||
{"i1", "int"},
|
||||
{"l1", "long"},
|
||||
{"r1", "short"},
|
||||
|
||||
{"lF1", "long"},
|
||||
{"lP1", "long"},
|
||||
{"lU1", "long"},
|
||||
{"lR1", "long"},
|
||||
{"lT1", "long"},
|
||||
{"lV1", "long"}
|
||||
};
|
||||
|
||||
private static Log log;
|
||||
private final static String prefix = "nsk.jdi.ArrayReference.getValue.";
|
||||
private final static String className = "getvalue001";
|
||||
private final static String debugerName = prefix + className;
|
||||
private final static String debugeeName = debugerName + "a";
|
||||
private final static String classToCheckName = prefix + "getvalue001aClassToCheck";
|
||||
|
||||
public static void main(String argv[]) {
|
||||
System.exit(95 + run(argv, System.out));
|
||||
}
|
||||
|
||||
public static int run(String argv[], PrintStream out) {
|
||||
ArgumentHandler argHandler = new ArgumentHandler(argv);
|
||||
log = new Log(out, argHandler);
|
||||
Binder binder = new Binder(argHandler, log);
|
||||
Debugee debugee = binder.bindToDebugee(debugeeName
|
||||
+ (argHandler.verbose() ? " -verbose" : ""));
|
||||
IOPipe pipe = debugee.createIOPipe();
|
||||
boolean testFailed = false;
|
||||
|
||||
// Connect with debugee and resume it
|
||||
debugee.redirectStderr(out);
|
||||
debugee.resume();
|
||||
String line = pipe.readln();
|
||||
if (line == null) {
|
||||
log.complain("debuger FAILURE> UNEXPECTED debugee's signal - null");
|
||||
return 2;
|
||||
}
|
||||
if (!line.equals("ready")) {
|
||||
log.complain("debuger FAILURE> UNEXPECTED debugee's signal - "
|
||||
+ line);
|
||||
return 2;
|
||||
}
|
||||
else {
|
||||
log.display("debuger> debugee's \"ready\" signal recieved.");
|
||||
}
|
||||
|
||||
ReferenceType refType = debugee.classByName(classToCheckName);
|
||||
if (refType == null) {
|
||||
log.complain("debuger FAILURE> Class " + classToCheckName
|
||||
+ " not found.");
|
||||
return 2;
|
||||
}
|
||||
log.display("debuger> Total fields in debugee read: "
|
||||
+ refType.allFields().size() + " total fields in debuger: "
|
||||
+ FIELD_NAME.length + "\n");
|
||||
|
||||
// Check all array fields from debugee
|
||||
for (int i = 0; i < FIELD_NAME.length; i++) {
|
||||
Field field;
|
||||
String name = FIELD_NAME[i][0];
|
||||
String realType = FIELD_NAME[i][1];
|
||||
Value value;
|
||||
ArrayReference arrayRef;
|
||||
|
||||
// Get field from debuggee by name
|
||||
try {
|
||||
field = refType.fieldByName(name);
|
||||
} catch (ClassNotPreparedException e) {
|
||||
log.complain("debuger FAILURE 1> Can't get field by name "
|
||||
+ name);
|
||||
log.complain("debuger FAILURE 1> Exception: " + e);
|
||||
testFailed = true;
|
||||
continue;
|
||||
} catch (ObjectCollectedException e) {
|
||||
log.complain("debuger FAILURE 1> Can't get field by name "
|
||||
+ name);
|
||||
log.complain("debuger FAILURE 1> Exception: " + e);
|
||||
testFailed = true;
|
||||
continue;
|
||||
}
|
||||
log.display("debuger> " + i + " field " + field + " read.");
|
||||
|
||||
// Get field's value
|
||||
try {
|
||||
value = refType.getValue(field);
|
||||
} catch (IllegalArgumentException e) {
|
||||
log.complain("debuger FAILURE 2> Cannot get value for field "
|
||||
+ name);
|
||||
log.complain("debuger FAILURE 2> Exception: " + e);
|
||||
testFailed = true;
|
||||
continue;
|
||||
} catch (ObjectCollectedException e) {
|
||||
log.complain("debuger FAILURE 2> Cannot get value for field "
|
||||
+ name);
|
||||
log.complain("debuger FAILURE 2> Exception: " + e);
|
||||
testFailed = true;
|
||||
continue;
|
||||
}
|
||||
log.display("debuger> " + i + " field value is " + value);
|
||||
|
||||
// Cast to ArrayReference. All fields in debugee are
|
||||
// arrays, so ClassCastException should not be thrown
|
||||
try {
|
||||
arrayRef = (ArrayReference)value;
|
||||
} catch (ClassCastException e) {
|
||||
log.complain("debuger FAILURE 3> Cannot cast value for field "
|
||||
+ name + " to ArrayReference.");
|
||||
log.complain("debuger FAILURE 3> Exception: " + e);
|
||||
testFailed = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
// All arrays have different length, so cycle "for (int j..)"
|
||||
// is inside "if realType.equal("
|
||||
|
||||
if (realType.equals("boolean")) {
|
||||
///////////////////// Check boolean[] /////////////////////
|
||||
|
||||
for (int j = 0; j < BOOL.length; j++){
|
||||
Value arrayValue;
|
||||
BooleanValue boolValue;
|
||||
boolean element;
|
||||
|
||||
// Get each element from array
|
||||
try {
|
||||
arrayValue = arrayRef.getValue(j);
|
||||
} catch (ObjectCollectedException e) {
|
||||
log.complain("debuger FAILURE Z1> Cannot get " + j
|
||||
+ " value from field " + name);
|
||||
log.complain("debuger FAILURE Z1> Exception: " + e);
|
||||
testFailed = true;
|
||||
continue;
|
||||
} catch (IndexOutOfBoundsException e) {
|
||||
log.complain("debuger FAILURE Z1> Cannot get " + j
|
||||
+ " value from field " + name);
|
||||
log.complain("debuger FAILURE Z1> Exception: " + e);
|
||||
testFailed = true;
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
boolValue = (BooleanValue)arrayValue;
|
||||
} catch (ClassCastException e) {
|
||||
log.complain("debuger FAILURE Z2> Cannot cast to "
|
||||
+ "boolean " + j + " value of field "
|
||||
+ name);
|
||||
log.complain("debuger FAILURE Z2> Exception: " + e);
|
||||
testFailed = true;
|
||||
continue;
|
||||
}
|
||||
element = boolValue.value();
|
||||
log.display("debuger> " + i + " field has " + j
|
||||
+ " element " + element);
|
||||
|
||||
// Check element's value
|
||||
if (element != BOOL[j]) {
|
||||
log.complain("debuger FAILURE Z3> " + j + " element of "
|
||||
+ "array " + name + " was expected "
|
||||
+ BOOL[j] + ", but returned " + element);
|
||||
testFailed = true;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
} else if (realType.equals("byte")) {
|
||||
///////////////////// Check byte[] /////////////////////
|
||||
|
||||
for (int j = 0; j < BYTE.length; j++){
|
||||
Value arrayValue;
|
||||
ByteValue byteValue;
|
||||
byte element;
|
||||
|
||||
// Get each element from array
|
||||
try {
|
||||
arrayValue = arrayRef.getValue(j);
|
||||
} catch (ObjectCollectedException e) {
|
||||
log.complain("debuger FAILURE B1> Cannot get " + j
|
||||
+ " value from field " + name);
|
||||
log.complain("debuger FAILURE B1> Exception: " + e);
|
||||
testFailed = true;
|
||||
continue;
|
||||
} catch (IndexOutOfBoundsException e) {
|
||||
log.complain("debuger FAILURE B1> Cannot get " + j
|
||||
+ " value from field " + name);
|
||||
log.complain("debuger FAILURE B1> Exception: " + e);
|
||||
testFailed = true;
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
byteValue = (ByteValue)arrayValue;
|
||||
} catch (ClassCastException e) {
|
||||
log.complain("debuger FAILURE B2> Cannot cast to "
|
||||
+ "byte " + j + " value of field " + name);
|
||||
log.complain("debuger FAILURE B2> Exception: " + e);
|
||||
testFailed = true;
|
||||
continue;
|
||||
}
|
||||
element = byteValue.value();
|
||||
log.display("debuger> " + i + " field has " + j
|
||||
+ " element " + element);
|
||||
|
||||
// Check element's value
|
||||
if (element != BYTE[j]) {
|
||||
log.complain("debuger FAILURE B3> " + j + " element of "
|
||||
+ "array " + name + " was expected "
|
||||
+ CHAR[j] + ", but returned " + element);
|
||||
testFailed = true;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
} else if (realType.equals("char")) {
|
||||
///////////////////// Check char[] /////////////////////
|
||||
|
||||
for (int j = 0; j < CHAR.length; j++){
|
||||
Value arrayValue;
|
||||
CharValue charValue;
|
||||
char element;
|
||||
|
||||
// Get each element from array
|
||||
try {
|
||||
arrayValue = arrayRef.getValue(j);
|
||||
} catch (ObjectCollectedException e) {
|
||||
log.complain("debuger FAILURE C1> Cannot get " + j
|
||||
+ " value from field " + name);
|
||||
log.complain("debuger FAILURE C1> Exception: " + e);
|
||||
testFailed = true;
|
||||
continue;
|
||||
} catch (IndexOutOfBoundsException e) {
|
||||
log.complain("debuger FAILURE C1> Cannot get " + j
|
||||
+ " value from field " + name);
|
||||
log.complain("debuger FAILURE C1> Exception: " + e);
|
||||
testFailed = true;
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
charValue = (CharValue)arrayValue;
|
||||
} catch (ClassCastException e) {
|
||||
log.complain("debuger FAILURE C2> Cannot cast to "
|
||||
+ "char " + j + " value of field " + name);
|
||||
log.complain("debuger FAILURE C2> Exception: " + e);
|
||||
testFailed = true;
|
||||
continue;
|
||||
}
|
||||
element = charValue.value();
|
||||
log.display("debuger> " + i + " field has " + j
|
||||
+ " element " + element);
|
||||
|
||||
if (element != CHAR[j]) {
|
||||
log.complain("debuger FAILURE C3> " + j + " element of "
|
||||
+ "array " + name + " was expected "
|
||||
+ CHAR[j] + ", but returned " + element);
|
||||
testFailed = true;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
} else if (realType.equals("double")) {
|
||||
///////////////////// Check double[] /////////////////////
|
||||
|
||||
for (int j = 0; j < DOUB.length; j++){
|
||||
Value arrayValue;
|
||||
DoubleValue doubleValue;
|
||||
Double element;
|
||||
|
||||
// Get each element from array
|
||||
try {
|
||||
arrayValue = arrayRef.getValue(j);
|
||||
} catch (ObjectCollectedException e) {
|
||||
log.complain("debuger FAILURE D1> Cannot get " + j
|
||||
+ " value from field " + name);
|
||||
log.complain("debuger FAILURE D1> Exception: " + e);
|
||||
testFailed = true;
|
||||
continue;
|
||||
} catch (IndexOutOfBoundsException e) {
|
||||
log.complain("debuger FAILURE D1> Cannot get " + j
|
||||
+ " value from field " + name);
|
||||
log.complain("debuger FAILURE D1> Exception: " + e);
|
||||
testFailed = true;
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
doubleValue = (DoubleValue)arrayValue;
|
||||
} catch (ClassCastException e) {
|
||||
log.complain("debuger FAILURE D2> Cannot cast to "
|
||||
+ "double " + j + " value of field " + name);
|
||||
log.complain("debuger FAILURE D2> Exception: " + e);
|
||||
testFailed = true;
|
||||
continue;
|
||||
}
|
||||
element = new Double(doubleValue.value());
|
||||
log.display("debuger> " + i + " field has " + j
|
||||
+ " element " + element);
|
||||
|
||||
if (!element.equals(new Double(DOUB[j]))) {
|
||||
log.complain("debuger FAILURE D3> " + j + " element of "
|
||||
+ "array " + name + " was expected "
|
||||
+ DOUB[j] + ", but returned " + element);
|
||||
testFailed = true;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
} else if (realType.equals("float")) {
|
||||
///////////////////// Check float[] /////////////////////
|
||||
|
||||
for (int j = 0; j < FLOAT.length; j++){
|
||||
Value arrayValue;
|
||||
FloatValue floatValue;
|
||||
Float element;
|
||||
|
||||
// Get each element from array
|
||||
try {
|
||||
arrayValue = arrayRef.getValue(j);
|
||||
} catch (ObjectCollectedException e) {
|
||||
log.complain("debuger FAILURE F1> Cannot get " + j
|
||||
+ " value from field " + name);
|
||||
log.complain("debuger FAILURE F1> Exception: " + e);
|
||||
testFailed = true;
|
||||
continue;
|
||||
} catch (IndexOutOfBoundsException e) {
|
||||
log.complain("debuger FAILURE F1> Cannot get " + j
|
||||
+ " value from field " + name);
|
||||
log.complain("debuger FAILURE F1> Exception: " + e);
|
||||
testFailed = true;
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
floatValue = (FloatValue)arrayValue;
|
||||
} catch (ClassCastException e) {
|
||||
log.complain("debuger FAILURE F2> Cannot cast to "
|
||||
+ "float " + j + " value of field " + name);
|
||||
log.complain("debuger FAILURE F2> Exception: " + e);
|
||||
testFailed = true;
|
||||
continue;
|
||||
}
|
||||
element = new Float(floatValue.value());
|
||||
log.display("debuger> " + i + " field has " + j
|
||||
+ " element " + element);
|
||||
|
||||
if (!element.equals(new Float(FLOAT[j]))) {
|
||||
log.complain("debuger FAILURE F3> " + j + " element of "
|
||||
+ "array " + name + " was expected "
|
||||
+ FLOAT[j] + ", but returned " + element);
|
||||
testFailed = true;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
} else if (realType.equals("int")) {
|
||||
///////////////////// Check int[] /////////////////////
|
||||
|
||||
for (int j = 0; j < INT.length; j++){
|
||||
Value arrayValue;
|
||||
IntegerValue intValue;
|
||||
int element;
|
||||
|
||||
// Get each element from array
|
||||
try {
|
||||
arrayValue = arrayRef.getValue(j);
|
||||
} catch (ObjectCollectedException e) {
|
||||
log.complain("debuger FAILURE I1> Cannot get " + j
|
||||
+ " value from field " + name);
|
||||
log.complain("debuger FAILURE I1> Exception: " + e);
|
||||
testFailed = true;
|
||||
continue;
|
||||
} catch (IndexOutOfBoundsException e) {
|
||||
log.complain("debuger FAILURE I1> Cannot get " + j
|
||||
+ " value from field " + name);
|
||||
log.complain("debuger FAILURE I1> Exception: " + e);
|
||||
testFailed = true;
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
intValue = (IntegerValue)arrayValue;
|
||||
} catch (ClassCastException e) {
|
||||
log.complain("debuger FAILURE I2> Cannot cast to "
|
||||
+ "int " + j + " value of field " + name);
|
||||
log.complain("debuger FAILURE I2> Exception: " + e);
|
||||
testFailed = true;
|
||||
continue;
|
||||
}
|
||||
element = intValue.value();
|
||||
log.display("debuger> " + i + " field has " + j
|
||||
+ " element " + element + " ("
|
||||
+ Integer.toHexString(element) + ") ");
|
||||
|
||||
if (element != INT[j]) {
|
||||
log.complain("debuger FAILURE I3> " + j + " element of "
|
||||
+ "array " + name + " was expected " + INT[j]
|
||||
+ " (" + Integer.toHexString(INT[j]) + "), "
|
||||
+ " but returned " + element);
|
||||
testFailed = true;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
} else if (realType.equals("long")) {
|
||||
///////////////////// Check long[] /////////////////////
|
||||
|
||||
for (int j = 0; j < LONG.length; j++){
|
||||
Value arrayValue;
|
||||
LongValue longValue;
|
||||
long element;
|
||||
|
||||
// Get each element from array
|
||||
try {
|
||||
arrayValue = arrayRef.getValue(j);
|
||||
} catch (ObjectCollectedException e) {
|
||||
log.complain("debuger FAILURE L1> Cannot get " + j
|
||||
+ " value from field " + name);
|
||||
log.complain("debuger FAILURE L1> Exception: " + e);
|
||||
testFailed = true;
|
||||
continue;
|
||||
} catch (IndexOutOfBoundsException e) {
|
||||
log.complain("debuger FAILURE L1> Cannot get " + j
|
||||
+ " value from field " + name);
|
||||
log.complain("debuger FAILURE L1> Exception: " + e);
|
||||
testFailed = true;
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
longValue = (LongValue)arrayValue;
|
||||
} catch (ClassCastException e) {
|
||||
log.complain("debuger FAILURE L2> Cannot cast to "
|
||||
+ "long " + j + " value of field " + name);
|
||||
log.complain("debuger FAILURE L2> Exception: " + e);
|
||||
testFailed = true;
|
||||
continue;
|
||||
}
|
||||
element = longValue.value();
|
||||
log.display("debuger> " + i + " field has " + j
|
||||
+ " element " + element + " ("
|
||||
+ Long.toHexString(element) + ") ");
|
||||
|
||||
if (element != LONG[j]) {
|
||||
log.complain("debuger FAILURE L3> " + j + " element of "
|
||||
+ "array " + name + " was expected "
|
||||
+ LONG[j] + " (" + Long.toHexString(LONG[j])
|
||||
+ "), but returned " + element);
|
||||
testFailed = true;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
} else if (realType.equals("short")) {
|
||||
///////////////////// Check short[] /////////////////////
|
||||
|
||||
for (int j = 0; j < SHORT.length; j++){
|
||||
Value arrayValue;
|
||||
ShortValue shortValue;
|
||||
short element;
|
||||
|
||||
// Get each element from array
|
||||
try {
|
||||
arrayValue = arrayRef.getValue(j);
|
||||
} catch (ObjectCollectedException e) {
|
||||
log.complain("debuger FAILURE R1> Cannot get " + j
|
||||
+ " value from field " + name);
|
||||
log.complain("debuger FAILURE R1> Exception: " + e);
|
||||
testFailed = true;
|
||||
continue;
|
||||
} catch (IndexOutOfBoundsException e) {
|
||||
log.complain("debuger FAILURE R1> Cannot get " + j
|
||||
+ " value from field " + name);
|
||||
log.complain("debuger FAILURE R1> Exception: " + e);
|
||||
testFailed = true;
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
shortValue = (ShortValue)arrayValue;
|
||||
} catch (ClassCastException e) {
|
||||
log.complain("debuger FAILURE R2> Cannot cast to "
|
||||
+ "short " + j + " value of field " + name);
|
||||
log.complain("debuger FAILURE R2> Exception: " + e);
|
||||
testFailed = true;
|
||||
continue;
|
||||
}
|
||||
element = shortValue.value();
|
||||
log.display("debuger> " + i + " field has " + j
|
||||
+ " element " + element);
|
||||
|
||||
if (element != SHORT[j]) {
|
||||
log.complain("debuger FAILURE R3> " + j + " element of "
|
||||
+ "array " + name + " was expected "
|
||||
+ SHORT[j] + ", but returned " + element);
|
||||
testFailed = true;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
log.complain("debuger FAILURE 4> Unexpected type: " + realType);
|
||||
testFailed = true;
|
||||
continue;
|
||||
}
|
||||
log.display("debuger> " + i + " field checked.\n");
|
||||
}
|
||||
|
||||
pipe.println("quit");
|
||||
debugee.waitFor();
|
||||
int status = debugee.getStatus();
|
||||
if (testFailed) {
|
||||
log.complain("debuger FAILURE> TEST FAILED");
|
||||
return 2;
|
||||
} else {
|
||||
if (status == 95) {
|
||||
log.display("debuger> expected Debugee's exit "
|
||||
+ "status - " + status);
|
||||
return 0;
|
||||
} else {
|
||||
log.complain("debuger FAILURE> UNEXPECTED Debugee's exit "
|
||||
+ "status (not 95) - " + status);
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,71 @@
|
||||
/*
|
||||
* Copyright (c) 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.
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* @test
|
||||
*
|
||||
* @summary converted from VM Testbase nsk/jdi/ArrayReference/getValue/getvalue001.
|
||||
* VM Testbase keywords: [jpda, jdi]
|
||||
* VM Testbase readme:
|
||||
* DESCRIPTION
|
||||
* This test checks the getValue(int) method of ArrayReference interface of
|
||||
* com.sun.jdi package.
|
||||
* The method spec:
|
||||
* public Value getValue(int index)
|
||||
* Returns an array component value.
|
||||
* Parameters: index - the index of the component to retrieve
|
||||
* Returns: the Value at the given index.
|
||||
* Throws: java.lang.IndexOutOfBoundsException - if the index is beyond the
|
||||
* end of this array.
|
||||
* ObjectCollectedException - if this object has been garbage
|
||||
* collected.
|
||||
* nsk/jdi/ArrayReference/getValue/getvalue001 checks assertion:
|
||||
* public Value getValue(int index)
|
||||
* 1. Returns the Value at the given index. Array has components of primitive
|
||||
* types only, index is in array bounds.
|
||||
* Debuggee defines a number of array fields with components of primitive types
|
||||
* only.
|
||||
* Debugger gets each field from debuggee by name, gets field's value and
|
||||
* casts it to ArrayReference. Then debugger determines field's type (by
|
||||
* field's name), gets each element of the array invoking the method
|
||||
* getValue(int). Returned Value is casted to correspondent PrimitiveType and
|
||||
* the test gets its primitive value. This value is compared with expected.
|
||||
* COMMENTS
|
||||
* 4419982: JDI: two StackFrame methods return incorrect values for double
|
||||
*
|
||||
* @library /vmTestbase
|
||||
* /test/lib
|
||||
* @run driver jdk.test.lib.FileInstaller . .
|
||||
* @build nsk.jdi.ArrayReference.getValue.getvalue001
|
||||
* nsk.jdi.ArrayReference.getValue.getvalue001a
|
||||
* @run main/othervm PropertyResolvingWrapper
|
||||
* nsk.jdi.ArrayReference.getValue.getvalue001
|
||||
* -verbose
|
||||
* -arch=${os.family}-${os.simpleArch}
|
||||
* -waittime=5
|
||||
* -debugee.vmkind=java
|
||||
* -transport.address=dynamic
|
||||
* "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}"
|
||||
*/
|
||||
|
||||
@ -0,0 +1,75 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 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 nsk.jdi.ArrayReference.getValue;
|
||||
|
||||
import nsk.share.*;
|
||||
import nsk.share.jpda.*;
|
||||
import nsk.share.jdi.*;
|
||||
|
||||
|
||||
public class getvalue001a {
|
||||
public static void main (String argv[]) {
|
||||
ArgumentHandler argHandler = new ArgumentHandler(argv);
|
||||
Log log = new Log(System.err, argHandler);
|
||||
IOPipe pipe = argHandler.createDebugeeIOPipe(log);
|
||||
getvalue001aClassToCheck classToCheck = new getvalue001aClassToCheck();
|
||||
|
||||
log.display("DEBUGEE> debugee started.");
|
||||
pipe.println("ready");
|
||||
String instruction = pipe.readln();
|
||||
if (instruction.equals("quit")) {
|
||||
log.display("DEBUGEE> \"quit\" signal recieved.");
|
||||
log.display("DEBUGEE> completed succesfully.");
|
||||
System.exit(95);
|
||||
}
|
||||
log.complain("DEBUGEE FAILURE> unexpected signal "
|
||||
+ "(no \"quit\") - " + instruction);
|
||||
log.complain("DEBUGEE FAILURE> TEST FAILED");
|
||||
System.exit(97);
|
||||
}
|
||||
}
|
||||
|
||||
class getvalue001aClassToCheck {
|
||||
static boolean z1[] = {true, false};
|
||||
static byte b1[] = {Byte.MIN_VALUE, -1, 0, 1, Byte.MAX_VALUE};
|
||||
static char c1[] = {Character.MIN_VALUE, '\u00ff', '\uff00',
|
||||
Character.MAX_VALUE};
|
||||
static double d1[] = {Double.NEGATIVE_INFINITY, Double.MIN_VALUE, -1, -0,
|
||||
1111111111.0, 1, Double.MAX_VALUE, Double.POSITIVE_INFINITY,
|
||||
Double.NaN};
|
||||
static float f1[] = {Float.NEGATIVE_INFINITY, Float.MIN_VALUE, -1, -0,
|
||||
0, 1, Float.MAX_VALUE, Float.POSITIVE_INFINITY,
|
||||
Float.NaN};
|
||||
static int i1[] = {Integer.MIN_VALUE, -1, 0, 1, Integer.MAX_VALUE};
|
||||
static long l1[] = {Long.MIN_VALUE, -1, 0, 1, Long.MAX_VALUE};
|
||||
static short r1[] = {Short.MIN_VALUE, -1, 0, 1, Short.MAX_VALUE};
|
||||
|
||||
static final long lF1[] = {Long.MIN_VALUE, -1, 0, 1, Long.MAX_VALUE};
|
||||
static private long lP1[] = {Long.MIN_VALUE, -1, 0, 1, Long.MAX_VALUE};
|
||||
static public long lU1[] = {Long.MIN_VALUE, -1, 0, 1, Long.MAX_VALUE};
|
||||
static protected long lR1[] = {Long.MIN_VALUE, -1, 0, 1, Long.MAX_VALUE};
|
||||
static transient long lT1[] = {Long.MIN_VALUE, -1, 0, 1, Long.MAX_VALUE};
|
||||
static volatile long lV1[] = {Long.MIN_VALUE, -1, 0, 1, Long.MAX_VALUE};
|
||||
}
|
||||
@ -0,0 +1,207 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 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 nsk.jdi.ArrayReference.getValue;
|
||||
|
||||
import nsk.share.*;
|
||||
import nsk.share.jpda.*;
|
||||
import nsk.share.jdi.*;
|
||||
|
||||
import com.sun.jdi.*;
|
||||
import java.io.*;
|
||||
|
||||
public class getvalue002 {
|
||||
final static int MIN_INDEX = -50;
|
||||
final static int MAX_INDEX = 51;
|
||||
final static String FIELD_NAME[][] = {
|
||||
{"z1", "5"},
|
||||
{"b1", "5"},
|
||||
{"c1", "6"},
|
||||
{"d1", "1"},
|
||||
{"f1", "1"},
|
||||
{"i1", "10"},
|
||||
{"l1", "2"},
|
||||
{"r1", "5"},
|
||||
|
||||
{"lF1", "0"},
|
||||
{"lP1", "2"},
|
||||
{"lU1", "3"},
|
||||
{"lR1", "4"},
|
||||
{"lT1", "5"},
|
||||
{"lV1", "6"}
|
||||
};
|
||||
|
||||
private static Log log;
|
||||
private final static String prefix = "nsk.jdi.ArrayReference.getValue.";
|
||||
private final static String className = "getvalue002";
|
||||
private final static String debugerName = prefix + className;
|
||||
private final static String debugeeName = debugerName + "a";
|
||||
private final static String classToCheckName = prefix + "getvalue002aClassToCheck";
|
||||
|
||||
public static void main(String argv[]) {
|
||||
System.exit(95 + run(argv, System.out));
|
||||
}
|
||||
|
||||
public static int run(String argv[], PrintStream out) {
|
||||
ArgumentHandler argHandler = new ArgumentHandler(argv);
|
||||
log = new Log(out, argHandler);
|
||||
Binder binder = new Binder(argHandler, log);
|
||||
Debugee debugee = binder.bindToDebugee(debugeeName
|
||||
+ (argHandler.verbose() ? " -verbose" : ""));
|
||||
IOPipe pipe = debugee.createIOPipe();
|
||||
boolean testFailed = false;
|
||||
|
||||
// Connect with debugee and resume it
|
||||
debugee.redirectStderr(out);
|
||||
debugee.resume();
|
||||
String line = pipe.readln();
|
||||
if (line == null) {
|
||||
log.complain("debuger FAILURE> UNEXPECTED debugee's signal - null");
|
||||
return 2;
|
||||
}
|
||||
if (!line.equals("ready")) {
|
||||
log.complain("debuger FAILURE> UNEXPECTED debugee's signal - "
|
||||
+ line);
|
||||
return 2;
|
||||
}
|
||||
else {
|
||||
log.display("debuger> debugee's \"ready\" signal recieved.");
|
||||
}
|
||||
|
||||
ReferenceType refType = debugee.classByName(classToCheckName);
|
||||
if (refType == null) {
|
||||
log.complain("debuger FAILURE> Class " + classToCheckName
|
||||
+ " not found.");
|
||||
return 2;
|
||||
}
|
||||
|
||||
log.display("debuger> Total fields in debugee read: "
|
||||
+ refType.allFields().size() + " total fields in debuger: "
|
||||
+ FIELD_NAME.length + "\n");
|
||||
|
||||
// Check all array fields from debugee
|
||||
for (int i = 0; i < FIELD_NAME.length; i++) {
|
||||
Field field;
|
||||
String name = FIELD_NAME[i][0];
|
||||
Integer totalElements = new Integer(FIELD_NAME[i][1]);
|
||||
int lastElementIndex = totalElements.intValue() - 1;
|
||||
Value value;
|
||||
ArrayReference arrayRef;
|
||||
|
||||
// Get field from debuggee by name
|
||||
try {
|
||||
field = refType.fieldByName(name);
|
||||
} catch (ClassNotPreparedException e) {
|
||||
log.complain("debuger FAILURE 1> Can't get field by name "
|
||||
+ name);
|
||||
log.complain("debuger FAILURE 1> Exception: " + e);
|
||||
testFailed = true;
|
||||
continue;
|
||||
} catch (ObjectCollectedException e) {
|
||||
log.complain("debuger FAILURE 1> Can't get field by name "
|
||||
+ name);
|
||||
log.complain("debuger FAILURE 1> Exception: " + e);
|
||||
testFailed = true;
|
||||
continue;
|
||||
}
|
||||
log.display("debuger> " + i + " field " + field + " read.");
|
||||
|
||||
// Get field's value
|
||||
try {
|
||||
value = refType.getValue(field);
|
||||
} catch (IllegalArgumentException e) {
|
||||
log.complain("debuger FAILURE 2> Cannot get value for field "
|
||||
+ name);
|
||||
log.complain("debuger FAILURE 2> Exception: " + e);
|
||||
testFailed = true;
|
||||
continue;
|
||||
} catch (ObjectCollectedException e) {
|
||||
log.complain("debuger FAILURE 2> Cannot get value for field "
|
||||
+ name);
|
||||
log.complain("debuger FAILURE 2> Exception: " + e);
|
||||
testFailed = true;
|
||||
continue;
|
||||
}
|
||||
log.display("debuger> " + i + " field value is " + value);
|
||||
|
||||
// Cast to ArrayReference. All fields in debugee are
|
||||
// arrays, so ClassCastException should not be thrown
|
||||
try {
|
||||
arrayRef = (ArrayReference)value;
|
||||
} catch (ClassCastException e) {
|
||||
log.complain("debuger FAILURE 3> Cannot cast value for field "
|
||||
+ name + " to ArrayReference.");
|
||||
log.complain("debuger FAILURE 3> Exception: " + e);
|
||||
testFailed = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
// Try to get value by index from MIN_INDEX to -1 and from
|
||||
// arrayRef.length() to MAX_INDEX
|
||||
for (int j = MIN_INDEX; j < MAX_INDEX; j++) {
|
||||
if ( (j < 0) || (j > lastElementIndex) ) {
|
||||
Value arrayValue;
|
||||
|
||||
try {
|
||||
arrayValue = arrayRef.getValue(j);
|
||||
log.complain("debuger FAILURE 4> Value for " + j
|
||||
+ " element of field " + name + " is " + arrayValue
|
||||
+ ", but IndexOutOfBoundsException expected.");
|
||||
testFailed = true;
|
||||
} catch (ObjectCollectedException e) {
|
||||
log.display("debuger> Cannot get " + j + " value from "
|
||||
+ "field " + name);
|
||||
log.display("debuger> Exception: " + e);
|
||||
testFailed = true;
|
||||
} catch (IndexOutOfBoundsException e) {
|
||||
// Index is always out of bounds, so
|
||||
// IndexOutOfBoundsException is expected
|
||||
log.display("debuger> " + i + " field: cannot get "
|
||||
+ "element with index " + j + ". Expected "
|
||||
+ "exception: " + e);
|
||||
}
|
||||
}
|
||||
}
|
||||
log.display("debuger> " + i + " field checked.\n");
|
||||
}
|
||||
|
||||
pipe.println("quit");
|
||||
debugee.waitFor();
|
||||
int status = debugee.getStatus();
|
||||
if (testFailed) {
|
||||
log.complain("debuger FAILURE> TEST FAILED");
|
||||
return 2;
|
||||
} else {
|
||||
if (status == 95) {
|
||||
log.display("debuger> expected Debugee's exit "
|
||||
+ "status - " + status);
|
||||
return 0;
|
||||
} else {
|
||||
log.complain("debuger FAILURE> UNEXPECTED Debugee's exit "
|
||||
+ "status (not 95) - " + status);
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,69 @@
|
||||
/*
|
||||
* Copyright (c) 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.
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* @test
|
||||
*
|
||||
* @summary converted from VM Testbase nsk/jdi/ArrayReference/getValue/getvalue002.
|
||||
* VM Testbase keywords: [jpda, jdi]
|
||||
* VM Testbase readme:
|
||||
* DESCRIPTION
|
||||
* This test checks the getValue(int) method of ArrayReference interface of
|
||||
* com.sun.jdi package.
|
||||
* The method spec:
|
||||
* public Value getValue(int index)
|
||||
* Returns an array component value.
|
||||
* Parameters: index - the index of the component to retrieve
|
||||
* Returns: the Value at the given index.
|
||||
* Throws: java.lang.IndexOutOfBoundsException - if the index is beyond the
|
||||
* end of this array.
|
||||
* ObjectCollectedException - if this object has been garbage
|
||||
* collected.
|
||||
* nsk/jdi/ArrayReference/getValue/getvalue002 checks assertion:
|
||||
* public Value getValue(int index)
|
||||
* 1. IndexOutOfBoundsException is thrown, if the index is out of range of
|
||||
* ArrayReference. Array has components of primitive types only.
|
||||
* Debuggee defines a number of array fields with components of primitive types
|
||||
* only. The fields have different lengths.
|
||||
* Debugger gets each field from debuggee by name, gets field's value and
|
||||
* casts it to ArrayReference. Then debugger tries to invoke the method
|
||||
* getValue(int) with index from MIN_INDEX to -1 and from last index to
|
||||
* MAX_INDEX. For each index IndexOutOfBoundsException is expected.
|
||||
* COMMENTS
|
||||
*
|
||||
* @library /vmTestbase
|
||||
* /test/lib
|
||||
* @run driver jdk.test.lib.FileInstaller . .
|
||||
* @build nsk.jdi.ArrayReference.getValue.getvalue002
|
||||
* nsk.jdi.ArrayReference.getValue.getvalue002a
|
||||
* @run main/othervm PropertyResolvingWrapper
|
||||
* nsk.jdi.ArrayReference.getValue.getvalue002
|
||||
* -verbose
|
||||
* -arch=${os.family}-${os.simpleArch}
|
||||
* -waittime=5
|
||||
* -debugee.vmkind=java
|
||||
* -transport.address=dynamic
|
||||
* "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}"
|
||||
*/
|
||||
|
||||
@ -0,0 +1,71 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 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 nsk.jdi.ArrayReference.getValue;
|
||||
|
||||
import nsk.share.*;
|
||||
import nsk.share.jpda.*;
|
||||
import nsk.share.jdi.*;
|
||||
|
||||
|
||||
public class getvalue002a {
|
||||
public static void main (String argv[]) {
|
||||
ArgumentHandler argHandler = new ArgumentHandler(argv);
|
||||
Log log = new Log(System.err, argHandler);
|
||||
IOPipe pipe = argHandler.createDebugeeIOPipe(log);
|
||||
getvalue002aClassToCheck classToCheck = new getvalue002aClassToCheck();
|
||||
|
||||
log.display("DEBUGEE> debugee started.");
|
||||
pipe.println("ready");
|
||||
String instruction = pipe.readln();
|
||||
if (instruction.equals("quit")) {
|
||||
log.display("DEBUGEE> \"quit\" signal recieved.");
|
||||
log.display("DEBUGEE> completed succesfully.");
|
||||
System.exit(95);
|
||||
}
|
||||
log.complain("DEBUGEE FAILURE> unexpected signal "
|
||||
+ "(no \"quit\") - " + instruction);
|
||||
log.complain("DEBUGEE FAILURE> TEST FAILED");
|
||||
System.exit(97);
|
||||
}
|
||||
}
|
||||
|
||||
class getvalue002aClassToCheck {
|
||||
static boolean z1[] = {true, false, false, true, true};
|
||||
static byte b1[] = {Byte.MIN_VALUE, -1, 0, 1, Byte.MAX_VALUE};
|
||||
static char c1[] = {Character.MIN_VALUE, '\u00ff', '\uff00',
|
||||
'\u1234', '\u4321', Character.MAX_VALUE};
|
||||
static double d1[] = {Double.NEGATIVE_INFINITY};
|
||||
static float f1[] = {Float.POSITIVE_INFINITY};
|
||||
static int i1[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 0};
|
||||
static long l1[] = {Long.MIN_VALUE, Long.MAX_VALUE};
|
||||
static short r1[] = {-2, -1, 0, 1, 2};
|
||||
|
||||
static final long lF1[] = {};
|
||||
static private long lP1[] = {-1, 0};
|
||||
static public long lU1[] = {0, 1, 2};
|
||||
static protected long lR1[] = {0, 1, 2, 3};
|
||||
static transient long lT1[] = {1, 2, 3, 4, 5};
|
||||
static volatile long lV1[] = {1, 2, 3, 4, 5, 6};
|
||||
}
|
||||
@ -0,0 +1,283 @@
|
||||
/*
|
||||
* Copyright (c) 2002, 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 nsk.jdi.ArrayReference.getValue;
|
||||
|
||||
import nsk.share.*;
|
||||
import nsk.share.jpda.*;
|
||||
import nsk.share.jdi.*;
|
||||
|
||||
import com.sun.jdi.*;
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
|
||||
public class getvalue003 {
|
||||
|
||||
// exit code when test failed
|
||||
public final static int TEST_FAILED = 2;
|
||||
// exit code when test passed
|
||||
public final static int TEST_PASSED = 0;
|
||||
// shift of exit code
|
||||
public final static int JCK_STATUS_BASE = 95;
|
||||
|
||||
private final static String prefix = "nsk.jdi.ArrayReference.getValue.";
|
||||
private final static String className = "getvalue003";
|
||||
private final static String debuggerName = prefix + className;
|
||||
private final static String debugeeName = debuggerName + "a";
|
||||
private final static String fieldToCheck = "testedObj";
|
||||
|
||||
private int exitStatus;
|
||||
private Log log;
|
||||
private Debugee debugee;
|
||||
private IOPipe pipe;
|
||||
|
||||
private getvalue003() {
|
||||
log = null;
|
||||
debugee = null;
|
||||
pipe = null;
|
||||
}
|
||||
|
||||
public static void main(String argv[]) {
|
||||
System.exit(JCK_STATUS_BASE + run(argv, System.out));
|
||||
}
|
||||
|
||||
public static int run(String argv[], PrintStream out) {
|
||||
|
||||
getvalue003 tstObj = new getvalue003();
|
||||
|
||||
if ( tstObj.prepareDebugee(argv, out) ) {
|
||||
tstObj.execTest();
|
||||
tstObj.disposeOfDebugee();
|
||||
}
|
||||
|
||||
if ( tstObj.exitStatus == TEST_FAILED )
|
||||
tstObj.complain("run:: TEST FAILED");
|
||||
else
|
||||
tstObj.display("run:: TEST PASSED");
|
||||
return tstObj.exitStatus;
|
||||
}
|
||||
|
||||
private boolean prepareDebugee(String argv[], PrintStream out) {
|
||||
ArgumentHandler argHandler = new ArgumentHandler(argv);
|
||||
log = new Log(out, argHandler);
|
||||
Binder binder = new Binder(argHandler, log);
|
||||
display("prepareDebugee:: binder created.");
|
||||
|
||||
debugee = binder.bindToDebugee(debugeeName);
|
||||
log.display("prepareDebugee:: binded to debugee.");
|
||||
pipe = debugee.createIOPipe();
|
||||
log.display("prepareDebugee:: pipe created.");
|
||||
|
||||
debugee.redirectStderr(out);
|
||||
debugee.resume();
|
||||
|
||||
String line = pipe.readln();
|
||||
if ( line == null ) {
|
||||
complain("prepareDebugee:: UNEXPECTED debugee's signal - null");
|
||||
return false;
|
||||
}
|
||||
if ( !line.equals("ready") ) {
|
||||
complain("prepareDebugee:: UNEXPECTED debugee's signal - "
|
||||
+ line);
|
||||
return false;
|
||||
}
|
||||
|
||||
display("prepareDebugee:: debugee's \"ready\" signal recieved.");
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean disposeOfDebugee() {
|
||||
pipe.println("quit");
|
||||
debugee.waitFor();
|
||||
int status = debugee.getStatus();
|
||||
|
||||
if ( status != JCK_STATUS_BASE ) {
|
||||
complain("disposeOfDebugee:: UNEXPECTED Debugee's exit "
|
||||
+ "status (not " + JCK_STATUS_BASE + ") - " + status);
|
||||
return false;
|
||||
}
|
||||
display("disposeOfDebugee:: expected Debugee's exit "
|
||||
+ "status - " + status);
|
||||
return true;
|
||||
}
|
||||
|
||||
private void display(String msg) {
|
||||
if ( log != null )
|
||||
log.display("debugger> " + msg);
|
||||
}
|
||||
|
||||
private void complain(String msg) {
|
||||
if ( log != null )
|
||||
log.complain("debugger FAILURE> " + msg);
|
||||
}
|
||||
|
||||
private boolean execTest() {
|
||||
exitStatus = TEST_FAILED;
|
||||
|
||||
ReferenceType refType = debugee.classByName(debugeeName);
|
||||
if ( refType == null ) {
|
||||
complain("eventHandler:: Class '" + debugeeName + "' not found.");
|
||||
return false;
|
||||
}
|
||||
|
||||
Field field = refType.fieldByName(fieldToCheck);
|
||||
if ( field == null ) {
|
||||
complain("eventHandler:: Field '" + fieldToCheck + "' not found.");
|
||||
return false;
|
||||
}
|
||||
|
||||
Value value = refType.getValue(field);
|
||||
if ( value == null ) {
|
||||
complain("eventHandler:: Field '" + fieldToCheck + "' not initialized.");
|
||||
return false;
|
||||
}
|
||||
|
||||
return checkObjectFields(value);
|
||||
}
|
||||
|
||||
public boolean checkObjectFields(Value value) {
|
||||
List fieldList;
|
||||
if ( ! (value instanceof ObjectReference) )
|
||||
return false;
|
||||
|
||||
fieldList = ((ClassType)value.type()).allFields();
|
||||
|
||||
// Check all array fields from debugee
|
||||
Field field;
|
||||
display("\ncheckObjectFields:: Tests starts >>>");
|
||||
for (int i = 0; i < fieldList.size(); i++) {
|
||||
field = (Field)fieldList.get(i);
|
||||
|
||||
display("");
|
||||
display("checkObjectFields:: <" + field.name() + "> field is being "
|
||||
+ " checked.");
|
||||
|
||||
// Check getting of item from field-array
|
||||
if ( !checkFieldValue((ObjectReference)value, field) )
|
||||
return false;
|
||||
}
|
||||
exitStatus = TEST_PASSED;
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean checkFieldValue(ObjectReference object, Field field) {
|
||||
Value value;
|
||||
ArrayReference arrayRef;
|
||||
String fieldName = field.name();
|
||||
try {
|
||||
value = object.getValue(field);
|
||||
} catch (IllegalArgumentException e) {
|
||||
complain("checkFieldValue:: can not get value for field " + fieldName);
|
||||
complain("checkFieldValue:: " + e);
|
||||
return false;
|
||||
}
|
||||
|
||||
display("checkFieldValue:: ***" + fieldName + " = " + value);
|
||||
|
||||
boolean checkNULL = false;
|
||||
// scaning of non-initialized arrays
|
||||
for ( int i = 0; i < getvalue003a.NON_INIT_FIELDS.length; i++ )
|
||||
{
|
||||
if ( fieldName.compareTo(getvalue003a.NON_INIT_FIELDS[i]) == 0 ) {
|
||||
checkNULL = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// checking of field value
|
||||
if ( checkNULL ) {
|
||||
|
||||
// value is not null, but array has not to be initialized.
|
||||
if ( value != null ) {
|
||||
complain("checkFieldValue:: Value of '" + fieldName + "' is " + value
|
||||
+ ", but IndexOutOfBoundsException expected.");
|
||||
return false;
|
||||
|
||||
// array is not initialized. Expected value is null
|
||||
} else {
|
||||
display("checkFieldValue:: Expected value is null.");
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
|
||||
// value is null, but array has to be initialized.
|
||||
if ( value == null ) {
|
||||
complain("checkFieldValue:: Unexpected value of '" + fieldName
|
||||
+ "'" + value);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
display("checkFieldValue:: *** type of " + fieldName + " = " + value.type());
|
||||
|
||||
// check up type of value. it has to be ArrayType
|
||||
if ( ! (value.type() instanceof ArrayType) ) {
|
||||
display("checkFieldValue:: type of value is not ArrayType.");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Cast to ArrayReference. All fields in debugee are
|
||||
// arrays, so ClassCastException should not be thrown
|
||||
return checkValue(0, fieldName, (ArrayReference )value, ((ArrayReference )value).length() + 1) &&
|
||||
checkValue(0, fieldName, (ArrayReference )value, Integer.MAX_VALUE) &&
|
||||
checkValue(0, fieldName, (ArrayReference )value, Integer.MAX_VALUE + 1);
|
||||
}
|
||||
|
||||
private boolean checkValue(int depth, String name, ArrayReference arrayRef,
|
||||
long itemIndex) {
|
||||
|
||||
Value itemValue;
|
||||
int length = arrayRef.length();
|
||||
try {
|
||||
itemValue = arrayRef.getValue(0);
|
||||
if ( itemValue != null ) {
|
||||
if ( itemValue.type() instanceof ArrayType ) {
|
||||
|
||||
// itemValue has array type, check it by the same way
|
||||
long index = (length + 1 != itemIndex) ? itemIndex :
|
||||
((ArrayReference )itemValue).length() + 1;
|
||||
if ( !checkValue(depth + 1, name, (ArrayReference )itemValue, index) )
|
||||
return false;
|
||||
}
|
||||
}
|
||||
itemValue = arrayRef.getValue((int)itemIndex);
|
||||
if ( itemIndex > length || itemIndex < 0 ) {
|
||||
complain("checkValue[" + depth + "]:: " + name + "[" + itemIndex + "] = "
|
||||
+ itemValue + ", but IndexOutOfBoundsException expected.");
|
||||
return false;
|
||||
}
|
||||
|
||||
} catch (IndexOutOfBoundsException e) {
|
||||
/* Index is always out of bounds, so
|
||||
* IndexOutOfBoundsException is expected
|
||||
*/
|
||||
display("checkValue[" + depth + "]:: expected IndexOutOfBoundsException " +
|
||||
"is thrown for " + itemIndex + " item.");
|
||||
} catch (Exception e) {
|
||||
complain("checkValue[" + depth + "]:: Unexpected exception: " + e);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,81 @@
|
||||
/*
|
||||
* Copyright (c) 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.
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* @test
|
||||
*
|
||||
* @summary converted from VM Testbase nsk/jdi/ArrayReference/getValue/getvalue003.
|
||||
* VM Testbase keywords: [jpda, jdi]
|
||||
* VM Testbase readme:
|
||||
* DESCRIPTION:
|
||||
* The test for the boundary value of the parameters.
|
||||
* The test checks up that the method
|
||||
* com.sun.jdi.ArrayReference.getValue(int)
|
||||
* correctly works for the boundary value of parameter complies with its spec:
|
||||
* public Value getValue(int index)
|
||||
* Returns an array component value.
|
||||
* Parameters:
|
||||
* index - the index of the component to retrieve
|
||||
* Returns:
|
||||
* the Value at the given index.
|
||||
* Throws:
|
||||
* IndexOutOfBoundsException - if index is outside the range of
|
||||
* this array, that is, if either of the following are true:
|
||||
* index < 0
|
||||
* index >= length()
|
||||
* The test cases include static and instance fields of int and Object types,
|
||||
* which are one- and two- dimensional arrays. Values of the method parameter
|
||||
* are <length of array> + 1, Integer.MAX_VALUE and Integer.MAX_VALUE + 1.
|
||||
* IndexOutOfBoundsException is expected or, when array have no initalization,
|
||||
* <null> value is expected.
|
||||
* The test works as follows:
|
||||
* The debugger program - nsk.jdi.ArrayReference.getValue.getvalue003;
|
||||
* the debuggee program - nsk.jdi.ArrayReference.getValue.getvalue003a.
|
||||
* Using nsk.jdi.share classes, the debugger gets the debuggee running
|
||||
* on another JavaVM, establishes a pipe with the debuggee program,
|
||||
* and then send to the programm commands, to which the debuggee replies
|
||||
* via the pipe.
|
||||
* Upon getting reply, the debugger requests fields of checked object
|
||||
* and trys to read array values or an item of arrays correspondence with
|
||||
* the test cases above.
|
||||
* In case of error the test produces the return value 97 and a corresponding
|
||||
* error message(s). Otherwise, the test is passed and produces the return
|
||||
* value 95 and no message.
|
||||
* COMMENTS:
|
||||
*
|
||||
* @library /vmTestbase
|
||||
* /test/lib
|
||||
* @run driver jdk.test.lib.FileInstaller . .
|
||||
* @build nsk.jdi.ArrayReference.getValue.getvalue003
|
||||
* nsk.jdi.ArrayReference.getValue.getvalue003a
|
||||
* @run main/othervm PropertyResolvingWrapper
|
||||
* nsk.jdi.ArrayReference.getValue.getvalue003
|
||||
* -verbose
|
||||
* -arch=${os.family}-${os.simpleArch}
|
||||
* -waittime=5
|
||||
* -debugee.vmkind=java
|
||||
* -transport.address=dynamic
|
||||
* "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}"
|
||||
*/
|
||||
|
||||
@ -0,0 +1,101 @@
|
||||
/*
|
||||
* Copyright (c) 2002, 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 nsk.jdi.ArrayReference.getValue;
|
||||
|
||||
import nsk.share.*;
|
||||
import nsk.share.jpda.*;
|
||||
import nsk.share.jdi.*;
|
||||
|
||||
|
||||
public class getvalue003a {
|
||||
|
||||
public final static String[] NON_INIT_FIELDS = {"staticIntArr2C",
|
||||
"staticIntArrC",
|
||||
"staticObjArrC"};
|
||||
|
||||
static getvalue003aClassToCheck testedObj = new getvalue003aClassToCheck();
|
||||
|
||||
|
||||
public static void main (String argv[]) {
|
||||
|
||||
ArgumentHandler argHandler = new ArgumentHandler(argv);
|
||||
Log log = new Log(System.err, argHandler);
|
||||
IOPipe pipe = argHandler.createDebugeeIOPipe(log);
|
||||
pipe.println("ready");
|
||||
|
||||
String instruction = pipe.readln();
|
||||
|
||||
if ( instruction.equals("quit") ) {
|
||||
log.display("DEBUGEE> \"quit\" signal recieved.");
|
||||
log.display("DEBUGEE> completed succesfully.");
|
||||
System.exit(getvalue003.TEST_PASSED + getvalue003.JCK_STATUS_BASE);
|
||||
}
|
||||
log.complain("DEBUGEE FAILURE> unexpected signal "
|
||||
+ "(no \"quit\") - " + instruction);
|
||||
log.complain("DEBUGEE FAILURE> TEST FAILED");
|
||||
System.exit(getvalue003.TEST_FAILED + getvalue003.JCK_STATUS_BASE);
|
||||
}
|
||||
}
|
||||
|
||||
class getvalue003aClassToCheck {
|
||||
static int[] staticIntArr = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
|
||||
static Object[] staticObjArr = {null, null, null, null, null, null, null, null, null, null};
|
||||
|
||||
static int[][] staticIntArr2 = {{0, 1, 2, 3, 4, 5, 6, 7, 8, 9},
|
||||
{0, 1, 2, 3, 4, 5, 6, 7, 8, 9}};
|
||||
|
||||
static int[][] staticIntArr2C; // not initialized
|
||||
|
||||
static int[] staticIntArrC; // not initialized
|
||||
public int[] publicIntArrC;
|
||||
protected int[] protecIntArrC;
|
||||
private int[] privatIntArrC;
|
||||
|
||||
static Object[] staticObjArrC; // not initialized
|
||||
public Object[] publicObjArrC;
|
||||
protected Object[] protecObjArrC;
|
||||
private Object[] privatObjArrC;
|
||||
|
||||
public getvalue003aClassToCheck() {
|
||||
publicIntArrC = createIntArray();
|
||||
protecIntArrC = createIntArray();
|
||||
privatIntArrC = createIntArray();
|
||||
|
||||
publicObjArrC = createObjArray();
|
||||
protecObjArrC = createObjArray();
|
||||
privatObjArrC = createObjArray();
|
||||
}
|
||||
|
||||
static private int[] createIntArray() {
|
||||
int[] array = new int[10];
|
||||
for ( int i = 0; i < 10; i++ ) array[i] = i;
|
||||
return array;
|
||||
}
|
||||
|
||||
static private Object[] createObjArray() {
|
||||
Object[] array = new Object[10];
|
||||
return array;
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,453 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 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 nsk.jdi.ArrayReference.getValues;
|
||||
|
||||
import nsk.share.*;
|
||||
import nsk.share.jpda.*;
|
||||
import nsk.share.jdi.*;
|
||||
|
||||
import com.sun.jdi.*;
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
|
||||
public class getvalues001 {
|
||||
final static boolean BOOL[] = {true, false};
|
||||
final static byte BYTE[] = {Byte.MIN_VALUE, -1, 0, 1, Byte.MAX_VALUE};
|
||||
final static char CHAR[] = {Character.MIN_VALUE, '\u00ff', '\uff00',
|
||||
Character.MAX_VALUE};
|
||||
final static double DOUB[] = {Double.NEGATIVE_INFINITY, Double.MIN_VALUE,
|
||||
-1, -0, 0, 1, Double.MAX_VALUE,
|
||||
Double.POSITIVE_INFINITY,
|
||||
Double.NaN};
|
||||
final static float FLOAT[] = {Float.NEGATIVE_INFINITY, Float.MIN_VALUE,
|
||||
-1, -0, 0, 1, Float.MAX_VALUE,
|
||||
Float.POSITIVE_INFINITY, Float.NaN};
|
||||
final static int INT[] = {Integer.MIN_VALUE, -1, 0, 1,
|
||||
Integer.MAX_VALUE};
|
||||
final static long LONG[] = {Long.MIN_VALUE, -1, 0, 1, Long.MAX_VALUE};
|
||||
final static short SHORT[] = {Short.MIN_VALUE, -1, 0, 1, Short.MAX_VALUE};
|
||||
|
||||
final static String FIELD_NAME[][] = {
|
||||
{"z1", "boolean"},
|
||||
{"b1", "byte"},
|
||||
{"c1", "char"},
|
||||
{"d1", "double"},
|
||||
{"f1", "float"},
|
||||
{"i1", "int"},
|
||||
{"l1", "long"},
|
||||
{"r1", "short"},
|
||||
|
||||
{"lF1", "long"},
|
||||
{"lP1", "long"},
|
||||
{"lU1", "long"},
|
||||
{"lR1", "long"},
|
||||
{"lT1", "long"},
|
||||
{"lV1", "long"}
|
||||
};
|
||||
|
||||
private static Log log;
|
||||
private final static String prefix = "nsk.jdi.ArrayReference.getValues.";
|
||||
private final static String className = "getvalues001";
|
||||
private final static String debugerName = prefix + className;
|
||||
private final static String debugeeName = debugerName + "a";
|
||||
private final static String classToCheckName = prefix + "getvalues001aClassToCheck";
|
||||
|
||||
public static void main(String argv[]) {
|
||||
System.exit(95 + run(argv, System.out));
|
||||
}
|
||||
|
||||
public static int run(String argv[], PrintStream out) {
|
||||
ArgumentHandler argHandler = new ArgumentHandler(argv);
|
||||
log = new Log(out, argHandler);
|
||||
Binder binder = new Binder(argHandler, log);
|
||||
Debugee debugee = binder.bindToDebugee(debugeeName
|
||||
+ (argHandler.verbose() ? " -verbose" : ""));
|
||||
IOPipe pipe = debugee.createIOPipe();
|
||||
boolean testFailed = false;
|
||||
|
||||
// Connect with debugee and resume it
|
||||
debugee.redirectStderr(out);
|
||||
debugee.resume();
|
||||
String line = pipe.readln();
|
||||
if (line == null) {
|
||||
log.complain("debuger FAILURE> UNEXPECTED debugee's signal - null");
|
||||
return 2;
|
||||
}
|
||||
if (!line.equals("ready")) {
|
||||
log.complain("debuger FAILURE> UNEXPECTED debugee's signal - "
|
||||
+ line);
|
||||
return 2;
|
||||
}
|
||||
else {
|
||||
log.display("debuger> debugee's \"ready\" signal recieved.");
|
||||
}
|
||||
|
||||
ReferenceType refType = debugee.classByName(classToCheckName);
|
||||
if (refType == null) {
|
||||
log.complain("debuger FAILURE> Class " + classToCheckName
|
||||
+ " not found.");
|
||||
return 2;
|
||||
}
|
||||
log.display("debuger> Total fields in debugee read: "
|
||||
+ refType.allFields().size() + " total fields in debuger: "
|
||||
+ FIELD_NAME.length + "\n");
|
||||
|
||||
// Check all array fields from debugee
|
||||
for (int i = 0; i < FIELD_NAME.length; i++) {
|
||||
Field field;
|
||||
String name = FIELD_NAME[i][0];
|
||||
String realType = FIELD_NAME[i][1];
|
||||
Value value;
|
||||
Value arrayValue;
|
||||
ArrayReference arrayRef;
|
||||
List listOfValues;
|
||||
|
||||
// Get field from debuggee by name
|
||||
try {
|
||||
field = refType.fieldByName(name);
|
||||
} catch (ClassNotPreparedException e) {
|
||||
log.complain("debuger FAILURE 1> Can't get field by name "
|
||||
+ name);
|
||||
log.complain("debuger FAILURE 1> Exception: " + e);
|
||||
testFailed = true;
|
||||
continue;
|
||||
} catch (ObjectCollectedException e) {
|
||||
log.complain("debuger FAILURE 1> Can't get field by name "
|
||||
+ name);
|
||||
log.complain("debuger FAILURE 1> Exception: " + e);
|
||||
testFailed = true;
|
||||
continue;
|
||||
}
|
||||
log.display("debuger> " + i + " field " + field + " read.");
|
||||
|
||||
// Get field's value
|
||||
try {
|
||||
value = refType.getValue(field);
|
||||
} catch (IllegalArgumentException e) {
|
||||
log.complain("debuger FAILURE 2> Cannot get value for field "
|
||||
+ name);
|
||||
log.complain("debuger FAILURE 2> Exception: " + e);
|
||||
testFailed = true;
|
||||
continue;
|
||||
} catch (ObjectCollectedException e) {
|
||||
log.complain("debuger FAILURE 2> Cannot get value for field "
|
||||
+ name);
|
||||
log.complain("debuger FAILURE 2> Exception: " + e);
|
||||
testFailed = true;
|
||||
continue;
|
||||
}
|
||||
log.display("debuger> " + i + " field value is " + value);
|
||||
|
||||
// Cast to ArrayReference. All fields in debugee are
|
||||
// arrays, so ClassCastException should not be thrown
|
||||
try {
|
||||
arrayRef = (ArrayReference)value;
|
||||
} catch (ClassCastException e) {
|
||||
log.complain("debuger FAILURE 3> Cannot cast value for field "
|
||||
+ name + " to ArrayReference.");
|
||||
log.complain("debuger FAILURE 3> Exception: " + e);
|
||||
testFailed = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
// Get all components from array
|
||||
try {
|
||||
listOfValues = arrayRef.getValues();
|
||||
} catch (ObjectCollectedException e) {
|
||||
log.complain("debuger FAILURE 4> Cannot get values from field "
|
||||
+ name);
|
||||
log.complain("debuger FAILURE 4> Exception: " + e);
|
||||
testFailed = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
// Check each element of the list
|
||||
for (int j = 0; j < listOfValues.size(); j++) {
|
||||
try {
|
||||
arrayValue = (Value)listOfValues.get(j);
|
||||
} catch (ClassCastException e) {
|
||||
log.complain("debuger FAILURE 5> Cannot cast to Value "
|
||||
+ j + " element of field " + name);
|
||||
log.complain("debuger FAILURE 5> Exception: " + e);
|
||||
testFailed = true;
|
||||
continue;
|
||||
}
|
||||
log.display("debuger> " + i + " field has " + j + " value "
|
||||
+ arrayValue);
|
||||
|
||||
if (realType.equals("boolean")) {
|
||||
|
||||
///////////////////// Check boolean[] /////////////////////
|
||||
BooleanValue boolValue;
|
||||
boolean element;
|
||||
|
||||
try {
|
||||
boolValue = (BooleanValue)arrayValue;
|
||||
} catch (ClassCastException e) {
|
||||
log.complain("debuger FAILURE Z1> Cannot cast to "
|
||||
+ "boolean " + j + " value of field "
|
||||
+ name);
|
||||
log.complain("debuger FAILURE Z1> Exception: " + e);
|
||||
testFailed = true;
|
||||
continue;
|
||||
}
|
||||
element = boolValue.value();
|
||||
log.display("debuger> " + i + " field has " + j
|
||||
+ " element " + element);
|
||||
|
||||
// Check element's value
|
||||
if (element != BOOL[j]) {
|
||||
log.complain("debuger FAILURE Z2> " + j + " element "
|
||||
+ "of array " + name + " was expected "
|
||||
+ BOOL[j] + ", but returned " + element);
|
||||
testFailed = true;
|
||||
continue;
|
||||
}
|
||||
} else if (realType.equals("byte")) {
|
||||
|
||||
///////////////////// Check byte[] /////////////////////
|
||||
ByteValue byteValue;
|
||||
byte element;
|
||||
|
||||
try {
|
||||
byteValue = (ByteValue)arrayValue;
|
||||
} catch (ClassCastException e) {
|
||||
log.complain("debuger FAILURE B1> Cannot cast to "
|
||||
+ "byte " + j + " value of field "
|
||||
+ name);
|
||||
log.complain("debuger FAILURE B1> Exception: " + e);
|
||||
testFailed = true;
|
||||
continue;
|
||||
}
|
||||
element = byteValue.value();
|
||||
log.display("debuger> " + i + " field has " + j
|
||||
+ " element " + element);
|
||||
|
||||
// Check element's value
|
||||
if (element != BYTE[j]) {
|
||||
log.complain("debuger FAILURE B2> " + j + " element "
|
||||
+ "of array " + name + " was expected "
|
||||
+ BYTE[j] + ", but returned " + element);
|
||||
testFailed = true;
|
||||
continue;
|
||||
}
|
||||
} else if (realType.equals("char")) {
|
||||
|
||||
///////////////////// Check char[] /////////////////////
|
||||
CharValue charValue;
|
||||
char element;
|
||||
|
||||
try {
|
||||
charValue = (CharValue)arrayValue;
|
||||
} catch (ClassCastException e) {
|
||||
log.complain("debuger FAILURE C1> Cannot cast to "
|
||||
+ "char " + j + " value of field "
|
||||
+ name);
|
||||
log.complain("debuger FAILURE C1> Exception: " + e);
|
||||
testFailed = true;
|
||||
continue;
|
||||
}
|
||||
element = charValue.value();
|
||||
log.display("debuger> " + i + " field has " + j
|
||||
+ " element " + element);
|
||||
|
||||
// Check element's value
|
||||
if (element != CHAR[j]) {
|
||||
log.complain("debuger FAILURE C2> " + j + " element "
|
||||
+ "of array " + name + " was expected "
|
||||
+ CHAR[j] + ", but returned " + element);
|
||||
testFailed = true;
|
||||
continue;
|
||||
}
|
||||
} else if (realType.equals("double")) {
|
||||
|
||||
///////////////////// Check double[] /////////////////////
|
||||
DoubleValue doubleValue;
|
||||
Double element;
|
||||
|
||||
try {
|
||||
doubleValue = (DoubleValue)arrayValue;
|
||||
} catch (ClassCastException e) {
|
||||
log.complain("debuger FAILURE D1> Cannot cast to "
|
||||
+ "double " + j + " value of field "
|
||||
+ name);
|
||||
log.complain("debuger FAILURE D1> Exception: " + e);
|
||||
testFailed = true;
|
||||
continue;
|
||||
}
|
||||
element = new Double(doubleValue.value());
|
||||
log.display("debuger> " + i + " field has " + j
|
||||
+ " element " + element);
|
||||
|
||||
// Check element's value
|
||||
if (!element.equals(new Double(DOUB[j]))) {
|
||||
log.complain("debuger FAILURE D2> " + j + " element "
|
||||
+ "of array " + name + " was expected "
|
||||
+ DOUB[j] + ", but returned " + element);
|
||||
testFailed = true;
|
||||
continue;
|
||||
}
|
||||
} else if (realType.equals("float")) {
|
||||
|
||||
///////////////////// Check float[] /////////////////////
|
||||
FloatValue floatValue;
|
||||
Float element;
|
||||
|
||||
try {
|
||||
floatValue = (FloatValue)arrayValue;
|
||||
} catch (ClassCastException e) {
|
||||
log.complain("debuger FAILURE F1> Cannot cast to "
|
||||
+ "float " + j + " value of field "
|
||||
+ name);
|
||||
log.complain("debuger FAILURE F1> Exception: " + e);
|
||||
testFailed = true;
|
||||
continue;
|
||||
}
|
||||
element = new Float(floatValue.value());
|
||||
log.display("debuger> " + i + " field has " + j
|
||||
+ " element " + element);
|
||||
|
||||
// Check element's value
|
||||
if (!element.equals(new Float(FLOAT[j]))) {
|
||||
log.complain("debuger FAILURE F2> " + j + " element "
|
||||
+ "of array " + name + " was expected "
|
||||
+ FLOAT[j] + ", but returned " + element);
|
||||
testFailed = true;
|
||||
continue;
|
||||
}
|
||||
} else if (realType.equals("int")) {
|
||||
|
||||
///////////////////// Check int[] /////////////////////
|
||||
IntegerValue intValue;
|
||||
int element;
|
||||
|
||||
try {
|
||||
intValue = (IntegerValue)arrayValue;
|
||||
} catch (ClassCastException e) {
|
||||
log.complain("debuger FAILURE I1> Cannot cast to "
|
||||
+ "int " + j + " value of field "
|
||||
+ name);
|
||||
log.complain("debuger FAILURE I1> Exception: " + e);
|
||||
testFailed = true;
|
||||
continue;
|
||||
}
|
||||
element = intValue.value();
|
||||
log.display("debuger> " + i + " field has " + j
|
||||
+ " element " + element);
|
||||
|
||||
// Check element's value
|
||||
if (element != INT[j]) {
|
||||
log.complain("debuger FAILURE I2> " + j + " element "
|
||||
+ "of array " + name + " was expected "
|
||||
+ INT[j] + ", but returned " + element);
|
||||
testFailed = true;
|
||||
continue;
|
||||
}
|
||||
} else if (realType.equals("long")) {
|
||||
|
||||
///////////////////// Check long[] /////////////////////
|
||||
LongValue longValue;
|
||||
long element;
|
||||
|
||||
try {
|
||||
longValue = (LongValue)arrayValue;
|
||||
} catch (ClassCastException e) {
|
||||
log.complain("debuger FAILURE L1> Cannot cast to "
|
||||
+ "long " + j + " value of field "
|
||||
+ name);
|
||||
log.complain("debuger FAILURE L1> Exception: " + e);
|
||||
testFailed = true;
|
||||
continue;
|
||||
}
|
||||
element = longValue.value();
|
||||
log.display("debuger> " + i + " field has " + j
|
||||
+ " element " + element);
|
||||
|
||||
// Check element's value
|
||||
if (element != LONG[j]) {
|
||||
log.complain("debuger FAILURE L2> " + j + " element "
|
||||
+ "of array " + name + " was expected "
|
||||
+ LONG[j] + ", but returned " + element);
|
||||
testFailed = true;
|
||||
continue;
|
||||
}
|
||||
} else if (realType.equals("short")) {
|
||||
|
||||
///////////////////// Check short[] /////////////////////
|
||||
ShortValue shortValue;
|
||||
short element;
|
||||
|
||||
try {
|
||||
shortValue = (ShortValue)arrayValue;
|
||||
} catch (ClassCastException e) {
|
||||
log.complain("debuger FAILURE R1> Cannot cast to "
|
||||
+ "short " + j + " value of field "
|
||||
+ name);
|
||||
log.complain("debuger FAILURE R1> Exception: " + e);
|
||||
testFailed = true;
|
||||
continue;
|
||||
}
|
||||
element = shortValue.value();
|
||||
log.display("debuger> " + i + " field has " + j
|
||||
+ " element " + element);
|
||||
|
||||
// Check element's value
|
||||
if (element != SHORT[j]) {
|
||||
log.complain("debuger FAILURE R2> " + j + " element "
|
||||
+ "of array " + name + " was expected "
|
||||
+ SHORT[j] + ", but returned " + element);
|
||||
testFailed = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
} else {
|
||||
log.complain("debuger FAILURE 6> Unexpected type: "
|
||||
+ realType);
|
||||
testFailed = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
log.display("debuger> " + i + " field checked.\n");
|
||||
}
|
||||
|
||||
pipe.println("quit");
|
||||
debugee.waitFor();
|
||||
int status = debugee.getStatus();
|
||||
if (testFailed) {
|
||||
log.complain("debuger FAILURE> TEST FAILED");
|
||||
return 2;
|
||||
} else {
|
||||
if (status == 95) {
|
||||
log.display("debuger> expected Debugee's exit "
|
||||
+ "status - " + status);
|
||||
return 0;
|
||||
} else {
|
||||
log.complain("debuger FAILURE> UNEXPECTED Debugee's exit "
|
||||
+ "status (not 95) - " + status);
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,71 @@
|
||||
/*
|
||||
* Copyright (c) 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.
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* @test
|
||||
*
|
||||
* @summary converted from VM Testbase nsk/jdi/ArrayReference/getValues/getvalues001.
|
||||
* VM Testbase keywords: [jpda, jdi]
|
||||
* VM Testbase readme:
|
||||
* DESCRIPTION
|
||||
* This test checks the getValues() method of ArrayReference interface of
|
||||
* com.sun.jdi package.
|
||||
* The method spec:
|
||||
* public List getValues()
|
||||
* Returns all of the components in this array.
|
||||
* Returns: a list of Value objects, one for each array component ordered by
|
||||
* array index.
|
||||
* Throws: ObjectCollectedException - if this object has been garbage
|
||||
* collected.
|
||||
* nsk/jdi/ArrayReference/getValues/getvalues001 checks assertion:
|
||||
* public List getValues()
|
||||
* 1. Returns all of the components in this array with primitive type
|
||||
* components.
|
||||
* Debuggee defines a number of array fields which component type is primitive
|
||||
* type only.
|
||||
* Debugger gets each field from debuggee by name, gets its value and casts it
|
||||
* to ArrayReference. Then the test gets all elements of the array invoking the
|
||||
* method getValues() and then checks each element of the ArrayReference. The
|
||||
* debugger determines component's type (by field's name), gets each element
|
||||
* of the list, casts it to correspondent PrimitiveType and then gets its
|
||||
* primitive value. Then the test compares returned and expected primitive
|
||||
* values.
|
||||
* COMMENTS
|
||||
* 4419982: JDI: two StackFrame methods return incorrect values for double
|
||||
*
|
||||
* @library /vmTestbase
|
||||
* /test/lib
|
||||
* @run driver jdk.test.lib.FileInstaller . .
|
||||
* @build nsk.jdi.ArrayReference.getValues.getvalues001
|
||||
* nsk.jdi.ArrayReference.getValues.getvalues001a
|
||||
* @run main/othervm PropertyResolvingWrapper
|
||||
* nsk.jdi.ArrayReference.getValues.getvalues001
|
||||
* -verbose
|
||||
* -arch=${os.family}-${os.simpleArch}
|
||||
* -waittime=5
|
||||
* -debugee.vmkind=java
|
||||
* -transport.address=dynamic
|
||||
* "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}"
|
||||
*/
|
||||
|
||||
@ -0,0 +1,75 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 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 nsk.jdi.ArrayReference.getValues;
|
||||
|
||||
import nsk.share.*;
|
||||
import nsk.share.jpda.*;
|
||||
import nsk.share.jdi.*;
|
||||
|
||||
|
||||
public class getvalues001a {
|
||||
public static void main (String argv[]) {
|
||||
ArgumentHandler argHandler = new ArgumentHandler(argv);
|
||||
Log log = new Log(System.err, argHandler);
|
||||
IOPipe pipe = argHandler.createDebugeeIOPipe(log);
|
||||
getvalues001aClassToCheck classToCheck = new getvalues001aClassToCheck();
|
||||
|
||||
log.display("DEBUGEE> debugee started.");
|
||||
pipe.println("ready");
|
||||
String instruction = pipe.readln();
|
||||
if (instruction.equals("quit")) {
|
||||
log.display("DEBUGEE> \"quit\" signal recieved.");
|
||||
log.display("DEBUGEE> completed succesfully.");
|
||||
System.exit(95);
|
||||
}
|
||||
log.complain("DEBUGEE FAILURE> unexpected signal "
|
||||
+ "(no \"quit\") - " + instruction);
|
||||
log.complain("DEBUGEE FAILURE> TEST FAILED");
|
||||
System.exit(97);
|
||||
}
|
||||
}
|
||||
|
||||
class getvalues001aClassToCheck {
|
||||
static boolean z1[] = {true, false};
|
||||
static byte b1[] = {Byte.MIN_VALUE, -1, 0, 1, Byte.MAX_VALUE};
|
||||
static char c1[] = {Character.MIN_VALUE, '\u00ff', '\uff00',
|
||||
Character.MAX_VALUE};
|
||||
static double d1[] = {Double.NEGATIVE_INFINITY, Double.MIN_VALUE, -1, -0,
|
||||
0, 1, Double.MAX_VALUE, Double.POSITIVE_INFINITY,
|
||||
Double.NaN};
|
||||
static float f1[] = {Float.NEGATIVE_INFINITY, Float.MIN_VALUE, -1, -0,
|
||||
0, 1, Float.MAX_VALUE, Float.POSITIVE_INFINITY,
|
||||
Float.NaN};
|
||||
static int i1[] = {Integer.MIN_VALUE, -1, 0, 1, Integer.MAX_VALUE};
|
||||
static long l1[] = {Long.MIN_VALUE, -1, 0, 1, Long.MAX_VALUE};
|
||||
static short r1[] = {Short.MIN_VALUE, -1, 0, 1, Short.MAX_VALUE};
|
||||
|
||||
static final long lF1[] = {Long.MIN_VALUE, -1, 0, 1, Long.MAX_VALUE};
|
||||
static private long lP1[] = {Long.MIN_VALUE, -1, 0, 1, Long.MAX_VALUE};
|
||||
static public long lU1[] = {Long.MIN_VALUE, -1, 0, 1, Long.MAX_VALUE};
|
||||
static protected long lR1[] = {Long.MIN_VALUE, -1, 0, 1, Long.MAX_VALUE};
|
||||
static transient long lT1[] = {Long.MIN_VALUE, -1, 0, 1, Long.MAX_VALUE};
|
||||
static volatile long lV1[] = {Long.MIN_VALUE, -1, 0, 1, Long.MAX_VALUE};
|
||||
}
|
||||
@ -0,0 +1,177 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 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 nsk.jdi.ArrayReference.getValues;
|
||||
|
||||
import nsk.share.*;
|
||||
import nsk.share.jpda.*;
|
||||
import nsk.share.jdi.*;
|
||||
|
||||
import com.sun.jdi.*;
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
|
||||
public class getvalues002 {
|
||||
final static String FIELD_NAME[] = {"z1", "b1", "c1", "d1", "f1", "i1",
|
||||
"l1", "r1", "lF1", "lP1", "lU1", "lR1",
|
||||
"lT1", "lV1"};
|
||||
private static Log log;
|
||||
private final static String prefix = "nsk.jdi.ArrayReference.getValues.";
|
||||
private final static String className = "getvalues002";
|
||||
private final static String debugerName = prefix + className;
|
||||
private final static String debugeeName = debugerName + "a";
|
||||
private final static String classToCheckName = prefix + "getvalues002aClassToCheck";
|
||||
|
||||
public static void main(String argv[]) {
|
||||
System.exit(95 + run(argv, System.out));
|
||||
}
|
||||
|
||||
public static int run(String argv[], PrintStream out) {
|
||||
ArgumentHandler argHandler = new ArgumentHandler(argv);
|
||||
log = new Log(out, argHandler);
|
||||
Binder binder = new Binder(argHandler, log);
|
||||
Debugee debugee = binder.bindToDebugee(debugeeName
|
||||
+ (argHandler.verbose() ? " -verbose" : ""));
|
||||
IOPipe pipe = debugee.createIOPipe();
|
||||
boolean testFailed = false;
|
||||
|
||||
// Connect with debugee and resume it
|
||||
debugee.redirectStderr(out);
|
||||
debugee.resume();
|
||||
String line = pipe.readln();
|
||||
if (line == null) {
|
||||
log.complain("debuger FAILURE> UNEXPECTED debugee's signal - null");
|
||||
return 2;
|
||||
}
|
||||
if (!line.equals("ready")) {
|
||||
log.complain("debuger FAILURE> UNEXPECTED debugee's signal - "
|
||||
+ line);
|
||||
return 2;
|
||||
}
|
||||
else {
|
||||
log.display("debuger> debugee's \"ready\" signal recieved.");
|
||||
}
|
||||
|
||||
ReferenceType refType = debugee.classByName(classToCheckName);
|
||||
if (refType == null) {
|
||||
log.complain("debuger FAILURE> Class " + classToCheckName
|
||||
+ " not found.");
|
||||
return 2;
|
||||
}
|
||||
log.display("debuger> Total fields in debugee read: "
|
||||
+ refType.allFields().size() + " total fields in debuger: "
|
||||
+ FIELD_NAME.length + "\n");
|
||||
|
||||
// Check all array fields from debugee
|
||||
for (int i = 0; i < FIELD_NAME.length; i++) {
|
||||
Field field;
|
||||
String name = FIELD_NAME[i];
|
||||
Value value;
|
||||
ArrayReference arrayRef;
|
||||
List listOfValues;
|
||||
|
||||
// Get field from debuggee by name
|
||||
try {
|
||||
field = refType.fieldByName(name);
|
||||
} catch (ClassNotPreparedException e) {
|
||||
log.complain("debuger FAILURE 1> Can't get field by name "
|
||||
+ name);
|
||||
log.complain("debuger FAILURE 1> Exception: " + e);
|
||||
testFailed = true;
|
||||
continue;
|
||||
} catch (ObjectCollectedException e) {
|
||||
log.complain("debuger FAILURE 1> Can't get field by name "
|
||||
+ name);
|
||||
log.complain("debuger FAILURE 1> Exception: " + e);
|
||||
testFailed = true;
|
||||
continue;
|
||||
}
|
||||
log.display("debuger> " + i + " field " + field + " read.");
|
||||
|
||||
// Get field's value
|
||||
try {
|
||||
value = refType.getValue(field);
|
||||
} catch (IllegalArgumentException e) {
|
||||
log.complain("debuger FAILURE 2> Cannot get value for field "
|
||||
+ name);
|
||||
log.complain("debuger FAILURE 2> Exception: " + e);
|
||||
testFailed = true;
|
||||
continue;
|
||||
} catch (ObjectCollectedException e) {
|
||||
log.complain("debuger FAILURE 2> Cannot get value for field "
|
||||
+ name);
|
||||
log.complain("debuger FAILURE 2> Exception: " + e);
|
||||
testFailed = true;
|
||||
continue;
|
||||
}
|
||||
log.display("debuger> " + i + " field value is " + value);
|
||||
|
||||
// Cast to ArrayReference. All fields in debugee are
|
||||
// arrays, so ClassCastException should not be thrown
|
||||
try {
|
||||
arrayRef = (ArrayReference)value;
|
||||
} catch (ClassCastException e) {
|
||||
log.complain("debuger FAILURE 3> Cannot cast value for field "
|
||||
+ name + " to ArrayReference.");
|
||||
log.complain("debuger FAILURE 3> Exception: " + e);
|
||||
testFailed = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
// Get all components from array
|
||||
try {
|
||||
listOfValues = arrayRef.getValues();
|
||||
} catch (ObjectCollectedException e) {
|
||||
log.complain("debuger FAILURE 4> Cannot get values from field "
|
||||
+ name);
|
||||
log.complain("debuger FAILURE 4> Exception: " + e);
|
||||
testFailed = true;
|
||||
} catch (IndexOutOfBoundsException e) {
|
||||
log.complain("debuger FAILURE 4> Cannot get values from field "
|
||||
+ name);
|
||||
log.complain("debuger FAILURE 4> Exception: " + e);
|
||||
testFailed = true;
|
||||
}
|
||||
log.display("debuger> " + i + " field checked.\n");
|
||||
}
|
||||
|
||||
pipe.println("quit");
|
||||
debugee.waitFor();
|
||||
int status = debugee.getStatus();
|
||||
if (testFailed) {
|
||||
log.complain("debuger FAILURE> TEST FAILED");
|
||||
return 2;
|
||||
} else {
|
||||
if (status == 95) {
|
||||
log.display("debuger> expected Debugee's exit "
|
||||
+ "status - " + status);
|
||||
return 0;
|
||||
} else {
|
||||
log.complain("debuger FAILURE> UNEXPECTED Debugee's exit "
|
||||
+ "status (not 95) - " + status);
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,70 @@
|
||||
/*
|
||||
* Copyright (c) 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.
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* @test
|
||||
*
|
||||
* @summary converted from VM Testbase nsk/jdi/ArrayReference/getValues/getvalues002.
|
||||
* VM Testbase keywords: [jpda, jdi]
|
||||
* VM Testbase readme:
|
||||
* DESCRIPTION
|
||||
* This test checks the getValues() method of ArrayReference interface of
|
||||
* com.sun.jdi package.
|
||||
* The method spec:
|
||||
* public List getValues()
|
||||
* Returns all of the components in this array.
|
||||
* Returns: a list of Value objects, one for each array component ordered by
|
||||
* array index.
|
||||
* Throws: ObjectCollectedException - if this object has been garbage
|
||||
* collected.
|
||||
* nsk/jdi/ArrayReference/getValues/getvalues002 checks assertion:
|
||||
* public List getValues()
|
||||
* 1. Returns all of the components in this empty-array with primitive type
|
||||
* components.
|
||||
* Debuggee defines a number of empty-array fields which component type is
|
||||
* primitive type only.
|
||||
* Debugger gets each field from debuggee by name, gets its value and casts
|
||||
* it to ArrayReference. Then the test tries to inkove the method getValues().
|
||||
* No exception should be thrown. ObjectCollectedException is declared in the
|
||||
* spec, but debuggee does not need huge amount of memory, so even
|
||||
* ObjectCollectedException is treated as failure.
|
||||
* COMMENTS
|
||||
* The test shows the bug:
|
||||
* 4439631 ArrayReference.getValues() throws undeclared IndexOutOfBoundsException
|
||||
*
|
||||
* @library /vmTestbase
|
||||
* /test/lib
|
||||
* @run driver jdk.test.lib.FileInstaller . .
|
||||
* @build nsk.jdi.ArrayReference.getValues.getvalues002
|
||||
* nsk.jdi.ArrayReference.getValues.getvalues002a
|
||||
* @run main/othervm PropertyResolvingWrapper
|
||||
* nsk.jdi.ArrayReference.getValues.getvalues002
|
||||
* -verbose
|
||||
* -arch=${os.family}-${os.simpleArch}
|
||||
* -waittime=5
|
||||
* -debugee.vmkind=java
|
||||
* -transport.address=dynamic
|
||||
* "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}"
|
||||
*/
|
||||
|
||||
@ -0,0 +1,71 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 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 nsk.jdi.ArrayReference.getValues;
|
||||
|
||||
import nsk.share.*;
|
||||
import nsk.share.jpda.*;
|
||||
import nsk.share.jdi.*;
|
||||
|
||||
|
||||
public class getvalues002a {
|
||||
public static void main (String argv[]) {
|
||||
ArgumentHandler argHandler = new ArgumentHandler(argv);
|
||||
Log log = new Log(System.err, argHandler);
|
||||
IOPipe pipe = argHandler.createDebugeeIOPipe(log);
|
||||
getvalues002aClassToCheck classToCheck = new getvalues002aClassToCheck();
|
||||
|
||||
|
||||
log.display("DEBUGEE> debugee started.");
|
||||
pipe.println("ready");
|
||||
String instruction = pipe.readln();
|
||||
if (instruction.equals("quit")) {
|
||||
log.display("DEBUGEE> \"quit\" signal recieved.");
|
||||
log.display("DEBUGEE> completed succesfully.");
|
||||
System.exit(95);
|
||||
}
|
||||
log.complain("DEBUGEE FAILURE> unexpected signal "
|
||||
+ "(no \"quit\") - " + instruction);
|
||||
log.complain("DEBUGEE FAILURE> TEST FAILED");
|
||||
System.exit(97);
|
||||
}
|
||||
}
|
||||
|
||||
class getvalues002aClassToCheck {
|
||||
static boolean z1[] = {};
|
||||
static byte b1[] = {};
|
||||
static char c1[] = {};
|
||||
static double d1[] = {};
|
||||
static float f1[] = {};
|
||||
static int i1[] = {};
|
||||
static long l1[] = {};
|
||||
static short r1[] = {};
|
||||
|
||||
static final long lF1[] = {};
|
||||
static private long lP1[] = {};
|
||||
static public long lU1[] = {};
|
||||
static protected long lR1[] = {};
|
||||
static transient long lT1[] = {};
|
||||
static volatile long lV1[] = {};
|
||||
}
|
||||
@ -0,0 +1,236 @@
|
||||
/*
|
||||
* Copyright (c) 2002, 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 nsk.jdi.ArrayReference.getValues;
|
||||
|
||||
import nsk.share.*;
|
||||
import nsk.share.jpda.*;
|
||||
import nsk.share.jdi.*;
|
||||
|
||||
import com.sun.jdi.*;
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
|
||||
public class getvalues003 {
|
||||
|
||||
// exit code when test failed
|
||||
public final static int TEST_FAILED = 2;
|
||||
// exit code when test passed
|
||||
public final static int TEST_PASSED = 0;
|
||||
// shift of exit code
|
||||
public final static int JCK_STATUS_BASE = 95;
|
||||
|
||||
private final static String prefix = "nsk.jdi.ArrayReference.getValues.";
|
||||
private final static String className = "getvalues003";
|
||||
private final static String debuggerName = prefix + className;
|
||||
private final static String debugeeName = debuggerName + "a";
|
||||
private final static String fieldToCheck = "testedObj";
|
||||
|
||||
private int exitStatus;
|
||||
private Log log;
|
||||
private Debugee debugee;
|
||||
private IOPipe pipe;
|
||||
|
||||
private getvalues003() {
|
||||
log = null;
|
||||
debugee = null;
|
||||
pipe = null;
|
||||
}
|
||||
|
||||
public static void main(String argv[]) {
|
||||
System.exit(JCK_STATUS_BASE + run(argv, System.out));
|
||||
}
|
||||
|
||||
public static int run(String argv[], PrintStream out) {
|
||||
|
||||
getvalues003 tstObj = new getvalues003();
|
||||
|
||||
if ( tstObj.prepareDebugee(argv, out) ) {
|
||||
tstObj.execTest();
|
||||
tstObj.disposeOfDebugee();
|
||||
}
|
||||
|
||||
if ( tstObj.exitStatus == TEST_FAILED )
|
||||
tstObj.complain("run:: TEST FAILED");
|
||||
else
|
||||
tstObj.display("run:: TEST PASSED");
|
||||
return tstObj.exitStatus;
|
||||
}
|
||||
|
||||
private boolean prepareDebugee(String argv[], PrintStream out) {
|
||||
ArgumentHandler argHandler = new ArgumentHandler(argv);
|
||||
log = new Log(out, argHandler);
|
||||
Binder binder = new Binder(argHandler, log);
|
||||
display("prepareDebugee:: binder created.");
|
||||
|
||||
debugee = binder.bindToDebugee(debugeeName);
|
||||
log.display("prepareDebugee:: binded to debugee.");
|
||||
pipe = debugee.createIOPipe();
|
||||
log.display("prepareDebugee:: pipe created.");
|
||||
|
||||
debugee.redirectStderr(out);
|
||||
debugee.resume();
|
||||
|
||||
String line = pipe.readln();
|
||||
if ( line == null ) {
|
||||
complain("prepareDebugee:: UNEXPECTED debugee's signal - null");
|
||||
return false;
|
||||
}
|
||||
if ( !line.equals("ready") ) {
|
||||
complain("prepareDebugee:: UNEXPECTED debugee's signal - "
|
||||
+ line);
|
||||
return false;
|
||||
}
|
||||
|
||||
display("prepareDebugee:: debugee's \"ready\" signal recieved.");
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean disposeOfDebugee() {
|
||||
pipe.println("quit");
|
||||
debugee.waitFor();
|
||||
int status = debugee.getStatus();
|
||||
|
||||
if ( status != JCK_STATUS_BASE ) {
|
||||
complain("disposeOfDebugee:: UNEXPECTED Debugee's exit "
|
||||
+ "status (not " + JCK_STATUS_BASE + ") - " + status);
|
||||
return false;
|
||||
}
|
||||
display("disposeOfDebugee:: expected Debugee's exit "
|
||||
+ "status - " + status);
|
||||
return true;
|
||||
}
|
||||
|
||||
private void display(String msg) {
|
||||
if ( log != null )
|
||||
log.display("debugger> " + msg);
|
||||
}
|
||||
|
||||
private void complain(String msg) {
|
||||
if ( log != null )
|
||||
log.complain("debugger FAILURE> " + msg);
|
||||
}
|
||||
|
||||
private boolean execTest() {
|
||||
exitStatus = TEST_FAILED;
|
||||
|
||||
ReferenceType refType = debugee.classByName(debugeeName);
|
||||
if ( refType == null ) {
|
||||
complain("eventHandler:: Class '" + debugeeName + "' not found.");
|
||||
return false;
|
||||
}
|
||||
|
||||
Field field = refType.fieldByName(fieldToCheck);
|
||||
if ( field == null ) {
|
||||
complain("eventHandler:: Field '" + fieldToCheck + "' not found.");
|
||||
return false;
|
||||
}
|
||||
|
||||
Value value = refType.getValue(field);
|
||||
if ( value == null ) {
|
||||
complain("eventHandler:: Field '" + fieldToCheck + "' not initialized.");
|
||||
return false;
|
||||
}
|
||||
|
||||
return checkObjectFields(value);
|
||||
}
|
||||
|
||||
public boolean checkObjectFields(Value value) {
|
||||
List fieldList;
|
||||
if ( ! (value instanceof ObjectReference) )
|
||||
return false;
|
||||
|
||||
fieldList = ((ClassType)value.type()).allFields();
|
||||
|
||||
// Check all array fields from debugee
|
||||
Field field;
|
||||
display("\ncheckObjectFields:: Tests starts >>>");
|
||||
for (int i = 0; i < fieldList.size(); i++) {
|
||||
field = (Field)fieldList.get(i);
|
||||
|
||||
display("");
|
||||
display("checkObjectFields:: <" + field.name() + "> field is being "
|
||||
+ " checked.");
|
||||
|
||||
// Check getting of item from field-array
|
||||
if ( !checkFieldValue((ObjectReference)value, field) )
|
||||
return false;
|
||||
}
|
||||
exitStatus = TEST_PASSED;
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean checkFieldValue(ObjectReference object, Field field) {
|
||||
Value value;
|
||||
ArrayReference arrayRef;
|
||||
String name = field.name();
|
||||
try {
|
||||
value = object.getValue(field);
|
||||
} catch (IllegalArgumentException e) {
|
||||
complain("checkFieldValue:: can not get value for field " + name);
|
||||
complain("checkFieldValue:: " + e);
|
||||
return false;
|
||||
}
|
||||
|
||||
display("checkFieldValue:: ***" + field.name() + " = " + value);
|
||||
|
||||
// non-initialized fields hav not to be
|
||||
if ( value == null ) {
|
||||
complain("checkFieldValue:: value is null.");
|
||||
return false;
|
||||
}
|
||||
display("checkFieldValue:: *** type of " + field.name() + " = " + value.type());
|
||||
|
||||
// check up type of value. it has to be ArrayType
|
||||
if ( ! (value.type() instanceof ArrayType) ) {
|
||||
display("checkFieldValue:: type of value is not ArrayType.");
|
||||
return true;
|
||||
}
|
||||
|
||||
// Cast to ArrayReference. All fields in debugee are
|
||||
// arrays, so ClassCastException should not be thrown
|
||||
return checkValue(name, (ArrayReference )value);
|
||||
}
|
||||
|
||||
private boolean checkValue(String name, ArrayReference arrayRef) {
|
||||
|
||||
// Get all components from array
|
||||
List listOfValues;
|
||||
try {
|
||||
listOfValues = arrayRef.getValues();
|
||||
} catch (Exception e) {
|
||||
complain("checkValue:: Unexpected exception: " + e);
|
||||
return false;
|
||||
}
|
||||
display("checkValue:: length of ArrayReference object - " + arrayRef.length());
|
||||
display("checkValue:: size of values list - " + listOfValues.size());
|
||||
|
||||
if ( listOfValues.size() == 0 ) {
|
||||
display("checkValue:: <" + name + "> field has been checked.\n");
|
||||
return true;
|
||||
}
|
||||
complain("checkValue:: <" + name + "> field has non-zero length.\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,71 @@
|
||||
/*
|
||||
* Copyright (c) 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.
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* @test
|
||||
*
|
||||
* @summary converted from VM Testbase nsk/jdi/ArrayReference/getValues/getvalues003.
|
||||
* VM Testbase keywords: [jpda, jdi]
|
||||
* VM Testbase readme:
|
||||
* DESCRIPTION:
|
||||
* The test for the boundary values.
|
||||
* The test checks up that the method
|
||||
* com.sun.jdi.ArrayReference.getValues()
|
||||
* correctly works for arrays with zero size complies with its spec:
|
||||
* public List getValues()
|
||||
* Returns all of the components in this array.
|
||||
* Returns:
|
||||
* a list of Value objects, one for each array component ordered by
|
||||
* array index. For zero length arrays, an empty list is returned.
|
||||
* The test cases include static and instance fields of int and Object types,
|
||||
* which are one-dimensional arrays of zero-sizes. An empty list is expected.
|
||||
* The test works as follows:
|
||||
* The debugger program - nsk.jdi.ArrayReference.getValues.getvalues003;
|
||||
* the debuggee program - nsk.jdi.ArrayReference.getValues.getvalues003a.
|
||||
* Using nsk.jdi.share classes, the debugger gets the debuggee running
|
||||
* on another JavaVM, establishes a pipe with the debuggee program,
|
||||
* and then send to the programm commands, to which the debuggee replies
|
||||
* via the pipe.
|
||||
* Upon getting reply, the debugger requests fields of checked object
|
||||
* and trys to read array values correspondence with the test cases above.
|
||||
* In case of error the test produces the return value 97 and a corresponding
|
||||
* error message(s). Otherwise, the test is passed and produces the return
|
||||
* value 95 and no message.
|
||||
* COMMENTS:
|
||||
*
|
||||
* @library /vmTestbase
|
||||
* /test/lib
|
||||
* @run driver jdk.test.lib.FileInstaller . .
|
||||
* @build nsk.jdi.ArrayReference.getValues.getvalues003
|
||||
* nsk.jdi.ArrayReference.getValues.getvalues003a
|
||||
* @run main/othervm PropertyResolvingWrapper
|
||||
* nsk.jdi.ArrayReference.getValues.getvalues003
|
||||
* -verbose
|
||||
* -arch=${os.family}-${os.simpleArch}
|
||||
* -waittime=5
|
||||
* -debugee.vmkind=java
|
||||
* -transport.address=dynamic
|
||||
* "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}"
|
||||
*/
|
||||
|
||||
@ -0,0 +1,87 @@
|
||||
/*
|
||||
* Copyright (c) 2002, 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 nsk.jdi.ArrayReference.getValues;
|
||||
|
||||
import nsk.share.*;
|
||||
import nsk.share.jpda.*;
|
||||
import nsk.share.jdi.*;
|
||||
|
||||
|
||||
public class getvalues003a {
|
||||
|
||||
static getvalues003aClassToCheck testedObj = new getvalues003aClassToCheck();
|
||||
|
||||
public static void main (String argv[]) {
|
||||
|
||||
ArgumentHandler argHandler = new ArgumentHandler(argv);
|
||||
Log log = new Log(System.err, argHandler);
|
||||
IOPipe pipe = argHandler.createDebugeeIOPipe(log);
|
||||
|
||||
pipe.println("ready");
|
||||
|
||||
String instruction = pipe.readln();
|
||||
|
||||
if ( instruction.equals("quit") ) {
|
||||
log.display("DEBUGEE> \"quit\" signal recieved.");
|
||||
log.display("DEBUGEE> completed succesfully.");
|
||||
System.exit(getvalues003.TEST_FAILED + getvalues003.JCK_STATUS_BASE);
|
||||
}
|
||||
log.complain("DEBUGEE FAILURE> unexpected signal "
|
||||
+ "(no \"quit\") - " + instruction);
|
||||
log.complain("DEBUGEE FAILURE> TEST FAILED");
|
||||
System.exit(getvalues003.TEST_FAILED + getvalues003.JCK_STATUS_BASE);
|
||||
}
|
||||
}
|
||||
|
||||
class getvalues003aClassToCheck {
|
||||
static int[] staticIntArr = {};
|
||||
static Object[] staticObjArr = {};
|
||||
|
||||
public int[] publicIntArrC;
|
||||
protected int[] protecIntArrC;
|
||||
private int[] privatIntArrC;
|
||||
|
||||
public Object[] publicObjArrC;
|
||||
protected Object[] protecObjArrC;
|
||||
private Object[] privatObjArrC;
|
||||
|
||||
public getvalues003aClassToCheck() {
|
||||
publicIntArrC = createIntArray();
|
||||
protecIntArrC = createIntArray();
|
||||
privatIntArrC = createIntArray();
|
||||
|
||||
publicObjArrC = createObjArray();
|
||||
protecObjArrC = createObjArray();
|
||||
privatObjArrC = createObjArray();
|
||||
}
|
||||
|
||||
static private int[] createIntArray() {
|
||||
return new int[0];
|
||||
}
|
||||
|
||||
static private Object[] createObjArray() {
|
||||
return new Object[0];
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,679 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 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 nsk.jdi.ArrayReference.getValues_ii;
|
||||
|
||||
import nsk.share.*;
|
||||
import nsk.share.jpda.*;
|
||||
import nsk.share.jdi.*;
|
||||
|
||||
import com.sun.jdi.*;
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
|
||||
public class getvaluesii001 {
|
||||
final static String FIELD_NAME[][] = {
|
||||
{"z1", "boolean"},
|
||||
{"b1", "byte"},
|
||||
{"c1", "char"},
|
||||
{"d1", "double"},
|
||||
{"f1", "float"},
|
||||
{"i1", "int"},
|
||||
{"l1", "long"},
|
||||
{"r1", "short"},
|
||||
|
||||
{"lF1", "long_final"},
|
||||
{"lP1", "long_private"},
|
||||
{"lU1", "long_public"},
|
||||
{"lR1", "long_protected"},
|
||||
{"lT1", "long_transient"},
|
||||
{"lV1", "long_volatile"}
|
||||
};
|
||||
|
||||
final static boolean BOOL[] = {true, false, false, false, true, false,
|
||||
false, true, false, false, false, true,
|
||||
true};
|
||||
final static byte BYTE[] = {0,
|
||||
Byte.MIN_VALUE, -1, 0, 1, Byte.MAX_VALUE,
|
||||
-101, -100, -99, Byte.MIN_VALUE + 1, 99,
|
||||
Byte.MAX_VALUE - 1, 101, -1};
|
||||
final static char CHAR[] = {0, 1,
|
||||
Character.MIN_VALUE, '\u00ff', '\uff00',
|
||||
'\uff00', '\uff00', '\u1234', '\u0f0f',
|
||||
Character.MAX_VALUE, '\u0f0f',
|
||||
Character.MIN_VALUE, Character.MAX_VALUE,
|
||||
'\u1234'};
|
||||
final static double DOUB[] = {0, 1, 2,
|
||||
Double.NEGATIVE_INFINITY, Double.MIN_VALUE,
|
||||
-1, -0, 0, 1, Double.MAX_VALUE, Double.NaN,
|
||||
Double.NaN, Double.POSITIVE_INFINITY,
|
||||
Double.NaN};
|
||||
final static float FLOAT[] = {0, 1, 2, 3,
|
||||
Float.NEGATIVE_INFINITY, Float.MIN_VALUE,
|
||||
-1, -0, 0, 1, Float.MAX_VALUE,
|
||||
Float.POSITIVE_INFINITY, Float.NaN,
|
||||
Float.POSITIVE_INFINITY};
|
||||
final static int INT[] = {0, 1, 2, 3, 4,
|
||||
-255, Integer.MIN_VALUE, -1, 0, 1,
|
||||
Integer.MAX_VALUE, 254, 255, 256};
|
||||
final static long LONG[] = {0, 1, 2, 3, 4, 5,
|
||||
Long.MIN_VALUE, -1, 0, 1, Long.MAX_VALUE,
|
||||
-1, -2, 0};
|
||||
final static short SHORT[] = {0, 1, 2, 3, 4, 5, 6,
|
||||
Short.MIN_VALUE, -1, 0, 1, Short.MAX_VALUE,
|
||||
-2, 0};
|
||||
final static long LONGF[] = {0, 1, 2, 3, 4, 5, 6, 7,
|
||||
-1, 0, 1, 2, 3, 4};
|
||||
final static long LONGP[] = {0, 1, 2, 3, 4, 5, 6, 7, 8,
|
||||
Long.MIN_VALUE, -1, 0, 1, Long.MAX_VALUE};
|
||||
final static long LONGU[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
|
||||
Long.MAX_VALUE, 10, 0, -10};
|
||||
final static long LONGR[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
|
||||
-1, 0, 1};
|
||||
final static long LONGT[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
|
||||
Long.MAX_VALUE, Long.MIN_VALUE};
|
||||
final static long LONGV[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
|
||||
Long.MAX_VALUE};
|
||||
|
||||
private static Log log;
|
||||
private final static String prefix = "nsk.jdi.ArrayReference.getValues_ii.";
|
||||
private final static String className = "getvaluesii001";
|
||||
private final static String debugerName = prefix + className;
|
||||
private final static String debugeeName = debugerName + "a";
|
||||
private final static String classToCheckName = prefix + "getvaluesii001aClassToCheck";
|
||||
|
||||
public static void main(String argv[]) {
|
||||
System.exit(95 + run(argv, System.out));
|
||||
}
|
||||
|
||||
public static int run(String argv[], PrintStream out) {
|
||||
ArgumentHandler argHandler = new ArgumentHandler(argv);
|
||||
log = new Log(out, argHandler);
|
||||
Binder binder = new Binder(argHandler, log);
|
||||
Debugee debugee = binder.bindToDebugee(debugeeName
|
||||
+ (argHandler.verbose() ? " -verbose" : ""));
|
||||
IOPipe pipe = debugee.createIOPipe();
|
||||
boolean testFailed = false;
|
||||
|
||||
// Connect with debugee and resume it
|
||||
debugee.redirectStderr(out);
|
||||
debugee.resume();
|
||||
String line = pipe.readln();
|
||||
if (line == null) {
|
||||
log.complain("debuger FAILURE> UNEXPECTED debugee's signal - null");
|
||||
return 2;
|
||||
}
|
||||
if (!line.equals("ready")) {
|
||||
log.complain("debuger FAILURE> UNEXPECTED debugee's signal - "
|
||||
+ line);
|
||||
return 2;
|
||||
}
|
||||
else {
|
||||
log.display("debuger> debugee's \"ready\" signal recieved.");
|
||||
}
|
||||
|
||||
ReferenceType refType = debugee.classByName(classToCheckName);
|
||||
if (refType == null) {
|
||||
log.complain("debuger FAILURE> Class " + classToCheckName
|
||||
+ " not found.");
|
||||
return 2;
|
||||
}
|
||||
log.display("debuger> Total fields in debugee read: "
|
||||
+ refType.allFields().size() + " total fields in debuger: "
|
||||
+ FIELD_NAME.length + "\n");
|
||||
|
||||
// Check all array fields from debugee
|
||||
for (int i = 0; i < FIELD_NAME.length; i++) {
|
||||
Field field;
|
||||
String name = FIELD_NAME[i][0];
|
||||
String realType = FIELD_NAME[i][1];
|
||||
Value value;
|
||||
ArrayReference arrayRef;
|
||||
List listOfValues;
|
||||
|
||||
// Get field from debuggee by name
|
||||
try {
|
||||
field = refType.fieldByName(name);
|
||||
} catch (ClassNotPreparedException e) {
|
||||
log.complain("debuger FAILURE 1> Can't get field by name "
|
||||
+ name);
|
||||
log.complain("debuger FAILURE 1> Exception: " + e);
|
||||
testFailed = true;
|
||||
continue;
|
||||
} catch (ObjectCollectedException e) {
|
||||
log.complain("debuger FAILURE 1> Can't get field by name "
|
||||
+ name);
|
||||
log.complain("debuger FAILURE 1> Exception: " + e);
|
||||
testFailed = true;
|
||||
continue;
|
||||
}
|
||||
log.display("debuger> " + i + " field " + field + " read.");
|
||||
|
||||
// Get field's value
|
||||
try {
|
||||
value = refType.getValue(field);
|
||||
} catch (IllegalArgumentException e) {
|
||||
log.complain("debuger FAILURE 2> Cannot get value for field "
|
||||
+ name);
|
||||
log.complain("debuger FAILURE 2> Exception: " + e);
|
||||
testFailed = true;
|
||||
continue;
|
||||
} catch (ObjectCollectedException e) {
|
||||
log.complain("debuger FAILURE 2> Cannot get value for field "
|
||||
+ name);
|
||||
log.complain("debuger FAILURE 2> Exception: " + e);
|
||||
testFailed = true;
|
||||
continue;
|
||||
}
|
||||
log.display("debuger> " + i + " field value is " + value);
|
||||
|
||||
// Cast to ArrayReference. All fields in debugee are
|
||||
// arrays, so ClassCastException should not be thrown
|
||||
try {
|
||||
arrayRef = (ArrayReference)value;
|
||||
} catch (ClassCastException e) {
|
||||
log.complain("debuger FAILURE 3> Cannot cast value for field "
|
||||
+ name + " to ArrayReference.");
|
||||
log.complain("debuger FAILURE 3> Exception: " + e);
|
||||
testFailed = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
// Get all components from i to the end of the array.
|
||||
// Each array has 14 elements, so IndexOutOfBoundsException
|
||||
// should never be thrown
|
||||
try {
|
||||
listOfValues = arrayRef.getValues(i, -1);
|
||||
} catch (ObjectCollectedException e) {
|
||||
log.complain("debuger FAILURE 4> Cannot get values from field "
|
||||
+ name);
|
||||
log.complain("debuger FAILURE 4> Exception: " + e);
|
||||
testFailed = true;
|
||||
continue;
|
||||
} catch (IndexOutOfBoundsException e) {
|
||||
log.complain("debuger FAILURE 4> Cannot get values from field "
|
||||
+ name);
|
||||
log.complain("debuger FAILURE 4> Exception: " + e);
|
||||
testFailed = true;
|
||||
continue;
|
||||
}
|
||||
log.display("debuger> " + i + " field read: " + listOfValues);
|
||||
|
||||
// Check each element from the list
|
||||
for (int j = 0; j < listOfValues.size(); j++) {
|
||||
Value arrayValue;
|
||||
|
||||
try {
|
||||
arrayValue = (Value)listOfValues.get(j);
|
||||
} catch (ClassCastException e) {
|
||||
log.complain("debuger FAILURE 5> Cannot cast to Value "
|
||||
+ j + " element of field " + name);
|
||||
log.complain("debuger FAILURE 5> Exception: " + e);
|
||||
testFailed = true;
|
||||
continue;
|
||||
}
|
||||
log.display("debuger> " + i + " field has " + j + " value "
|
||||
+ arrayValue);
|
||||
|
||||
if (realType.equals("boolean")) {
|
||||
|
||||
///////////////////// Check boolean[] /////////////////////
|
||||
BooleanValue boolValue;
|
||||
boolean element;
|
||||
|
||||
try {
|
||||
boolValue = (BooleanValue)arrayValue;
|
||||
} catch (ClassCastException e) {
|
||||
log.complain("debuger FAILURE Z1> Cannot cast to "
|
||||
+ "boolean " + j + " value of field "
|
||||
+ name);
|
||||
log.complain("debuger FAILURE Z1> Exception: " + e);
|
||||
testFailed = true;
|
||||
continue;
|
||||
}
|
||||
element = boolValue.value();
|
||||
log.display("debuger> " + i + " field has " + j
|
||||
+ " element " + element);
|
||||
|
||||
// Check element's value
|
||||
if (element != BOOL[j + i]) {
|
||||
log.complain("debuger FAILURE Z2> " + j + " element "
|
||||
+ "of array " + name + " was expected "
|
||||
+ BOOL[j + i] + ", but returned "
|
||||
+ element);
|
||||
testFailed = true;
|
||||
continue;
|
||||
}
|
||||
} else if (realType.equals("byte")) {
|
||||
|
||||
///////////////////// Check byte[] /////////////////////
|
||||
ByteValue byteValue;
|
||||
byte element;
|
||||
|
||||
try {
|
||||
byteValue = (ByteValue)arrayValue;
|
||||
} catch (ClassCastException e) {
|
||||
log.complain("debuger FAILURE B1> Cannot cast to "
|
||||
+ "byte " + j + " value of field "
|
||||
+ name);
|
||||
log.complain("debuger FAILURE B1> Exception: " + e);
|
||||
testFailed = true;
|
||||
continue;
|
||||
}
|
||||
element = byteValue.value();
|
||||
log.display("debuger> " + i + " field has " + j
|
||||
+ " element " + element);
|
||||
|
||||
// Check element's value
|
||||
if (element != BYTE[j + i]) {
|
||||
log.complain("debuger FAILURE B2> " + j + " element "
|
||||
+ "of array " + name + " was expected "
|
||||
+ BYTE[j + i] + ", but returned "
|
||||
+ element);
|
||||
testFailed = true;
|
||||
continue;
|
||||
}
|
||||
} else if (realType.equals("char")) {
|
||||
|
||||
///////////////////// Check char[] /////////////////////
|
||||
CharValue charValue;
|
||||
char element;
|
||||
|
||||
try {
|
||||
charValue = (CharValue)arrayValue;
|
||||
} catch (ClassCastException e) {
|
||||
log.complain("debuger FAILURE C1> Cannot cast to "
|
||||
+ "char " + j + " value of field "
|
||||
+ name);
|
||||
log.complain("debuger FAILURE C1> Exception: " + e);
|
||||
testFailed = true;
|
||||
continue;
|
||||
}
|
||||
element = charValue.value();
|
||||
log.display("debuger> " + i + " field has " + j
|
||||
+ " element " + element);
|
||||
|
||||
// Check element's value
|
||||
if (element != CHAR[j + i]) {
|
||||
Character c = new Character('c');
|
||||
Integer n = new Integer(0);
|
||||
String sReal = n.toHexString(
|
||||
c.getNumericValue(CHAR[j + i])
|
||||
);
|
||||
String sRead = n.toHexString(
|
||||
c.getNumericValue(element)
|
||||
);
|
||||
|
||||
log.complain("debuger FAILURE C2> " + j + " element "
|
||||
+ "of array " + name + " was expected "
|
||||
+ sReal + " but returned " + sRead);
|
||||
testFailed = true;
|
||||
continue;
|
||||
}
|
||||
} else if (realType.equals("double")) {
|
||||
|
||||
///////////////////// Check double[] /////////////////////
|
||||
DoubleValue doubleValue;
|
||||
Double element;
|
||||
|
||||
try {
|
||||
doubleValue = (DoubleValue)arrayValue;
|
||||
} catch (ClassCastException e) {
|
||||
log.complain("debuger FAILURE D1> Cannot cast to "
|
||||
+ "double " + j + " value of field "
|
||||
+ name);
|
||||
log.complain("debuger FAILURE D1> Exception: " + e);
|
||||
testFailed = true;
|
||||
continue;
|
||||
}
|
||||
element = new Double(doubleValue.value());
|
||||
log.display("debuger> " + i + " field has " + j
|
||||
+ " element " + element);
|
||||
|
||||
// Check element's value
|
||||
if (!element.equals(new Double(DOUB[j + i]))) {
|
||||
log.complain("debuger FAILURE D2> " + j + " element "
|
||||
+ "of array " + name + " was expected "
|
||||
+ DOUB[j + i] + ", but returned " + element);
|
||||
testFailed = true;
|
||||
continue;
|
||||
}
|
||||
} else if (realType.equals("float")) {
|
||||
|
||||
///////////////////// Check float[] /////////////////////
|
||||
FloatValue floatValue;
|
||||
Float element;
|
||||
|
||||
try {
|
||||
floatValue = (FloatValue)arrayValue;
|
||||
} catch (ClassCastException e) {
|
||||
log.complain("debuger FAILURE F1> Cannot cast to "
|
||||
+ "float " + j + " value of field "
|
||||
+ name);
|
||||
log.complain("debuger FAILURE F1> Exception: " + e);
|
||||
testFailed = true;
|
||||
continue;
|
||||
}
|
||||
element = new Float(floatValue.value());
|
||||
log.display("debuger> " + i + " field has " + j
|
||||
+ " element " + element);
|
||||
|
||||
// Check element's value
|
||||
if (!element.equals(new Float(FLOAT[j + i]))) {
|
||||
log.complain("debuger FAILURE F2> " + j + " element "
|
||||
+ "of array " + name + " was expected "
|
||||
+ FLOAT[j + i] + ", but returned "
|
||||
+ element);
|
||||
testFailed = true;
|
||||
continue;
|
||||
}
|
||||
} else if (realType.equals("int")) {
|
||||
|
||||
///////////////////// Check int[] /////////////////////
|
||||
IntegerValue intValue;
|
||||
int element;
|
||||
|
||||
try {
|
||||
intValue = (IntegerValue)arrayValue;
|
||||
} catch (ClassCastException e) {
|
||||
log.complain("debuger FAILURE I1> Cannot cast to "
|
||||
+ "int " + j + " value of field "
|
||||
+ name);
|
||||
log.complain("debuger FAILURE I1> Exception: " + e);
|
||||
testFailed = true;
|
||||
continue;
|
||||
}
|
||||
element = intValue.value();
|
||||
log.display("debuger> " + i + " field has " + j
|
||||
+ " element " + element);
|
||||
|
||||
// Check element's value
|
||||
if (element != INT[j + i]) {
|
||||
log.complain("debuger FAILURE I2> " + j + " element "
|
||||
+ "of array " + name + " was expected "
|
||||
+ INT[j + i] + ", but returned " + element);
|
||||
testFailed = true;
|
||||
continue;
|
||||
}
|
||||
} else if (realType.equals("long")) {
|
||||
|
||||
///////////////////// Check long[] /////////////////////
|
||||
LongValue longValue;
|
||||
long element;
|
||||
|
||||
try {
|
||||
longValue = (LongValue)arrayValue;
|
||||
} catch (ClassCastException e) {
|
||||
log.complain("debuger FAILURE L1> Cannot cast to "
|
||||
+ "long " + j + " value of field "
|
||||
+ name);
|
||||
log.complain("debuger FAILURE L1> Exception: " + e);
|
||||
testFailed = true;
|
||||
continue;
|
||||
}
|
||||
element = longValue.value();
|
||||
log.display("debuger> " + i + " field has " + j
|
||||
+ " element " + element);
|
||||
|
||||
// Check element's value
|
||||
if (element != LONG[j + i]) {
|
||||
log.complain("debuger FAILURE L2> " + j + " element "
|
||||
+ "of array " + name + " was expected "
|
||||
+ LONG[j + i] + ", but returned "
|
||||
+ element);
|
||||
testFailed = true;
|
||||
continue;
|
||||
}
|
||||
} else if (realType.equals("short")) {
|
||||
|
||||
///////////////////// Check short[] /////////////////////
|
||||
ShortValue shortValue;
|
||||
short element;
|
||||
|
||||
try {
|
||||
shortValue = (ShortValue)arrayValue;
|
||||
} catch (ClassCastException e) {
|
||||
log.complain("debuger FAILURE R1> Cannot cast to "
|
||||
+ "short " + j + " value of field "
|
||||
+ name);
|
||||
log.complain("debuger FAILURE R1> Exception: " + e);
|
||||
testFailed = true;
|
||||
continue;
|
||||
}
|
||||
element = shortValue.value();
|
||||
log.display("debuger> " + i + " field has " + j
|
||||
+ " element " + element);
|
||||
|
||||
// Check element's value
|
||||
if (element != SHORT[j + i]) {
|
||||
log.complain("debuger FAILURE R2> " + j + " element "
|
||||
+ "of array " + name + " was expected "
|
||||
+ SHORT[j + i] + ", but returned "
|
||||
+ element);
|
||||
testFailed = true;
|
||||
continue;
|
||||
}
|
||||
} else if (realType.equals("long_final")) {
|
||||
|
||||
//////////////////// Check final long[] /////////////////
|
||||
LongValue longValue;
|
||||
long element;
|
||||
|
||||
try {
|
||||
longValue = (LongValue)arrayValue;
|
||||
} catch (ClassCastException e) {
|
||||
log.complain("debuger FAILURE LF1> Cannot cast to "
|
||||
+ "long " + j + " value of field "
|
||||
+ name);
|
||||
log.complain("debuger FAILURE LF1> Exception: " + e);
|
||||
testFailed = true;
|
||||
continue;
|
||||
}
|
||||
element = longValue.value();
|
||||
log.display("debuger> " + i + " field has " + j
|
||||
+ " element " + element);
|
||||
|
||||
// Check element's value
|
||||
if (element != LONGF[j + i]) {
|
||||
log.complain("debuger FAILURE LF2> " + j + " element "
|
||||
+ "of array " + name + " was expected "
|
||||
+ LONGF[j + i] + ", but returned "
|
||||
+ element);
|
||||
testFailed = true;
|
||||
continue;
|
||||
}
|
||||
} else if (realType.equals("long_private")) {
|
||||
|
||||
//////////////////// Check private long[] ////////////////
|
||||
LongValue longValue;
|
||||
long element;
|
||||
|
||||
try {
|
||||
longValue = (LongValue)arrayValue;
|
||||
} catch (ClassCastException e) {
|
||||
log.complain("debuger FAILURE LP1> Cannot cast to "
|
||||
+ "long " + j + " value of field "
|
||||
+ name);
|
||||
log.complain("debuger FAILURE LP1> Exception: " + e);
|
||||
testFailed = true;
|
||||
continue;
|
||||
}
|
||||
element = longValue.value();
|
||||
log.display("debuger> " + i + " field has " + j
|
||||
+ " element " + element);
|
||||
|
||||
// Check element's value
|
||||
if (element != LONGP[j + i]) {
|
||||
log.complain("debuger FAILURE LP2> " + j + " element "
|
||||
+ "of array " + name + " was expected "
|
||||
+ LONGP[j + i] + ", but returned "
|
||||
+ element);
|
||||
testFailed = true;
|
||||
continue;
|
||||
}
|
||||
} else if (realType.equals("long_public")) {
|
||||
|
||||
//////////////////// Check public long[] ////////////////
|
||||
LongValue longValue;
|
||||
long element;
|
||||
|
||||
try {
|
||||
longValue = (LongValue)arrayValue;
|
||||
} catch (ClassCastException e) {
|
||||
log.complain("debuger FAILURE LU1> Cannot cast to "
|
||||
+ "long " + j + " value of field "
|
||||
+ name);
|
||||
log.complain("debuger FAILURE LU1> Exception: " + e);
|
||||
testFailed = true;
|
||||
continue;
|
||||
}
|
||||
element = longValue.value();
|
||||
log.display("debuger> " + i + " field has " + j
|
||||
+ " element " + element);
|
||||
|
||||
// Check element's value
|
||||
if (element != LONGU[j + i]) {
|
||||
log.complain("debuger FAILURE LU2> " + j + " element "
|
||||
+ "of array " + name + " was expected "
|
||||
+ LONGU[j + i] + ", but returned "
|
||||
+ element);
|
||||
testFailed = true;
|
||||
continue;
|
||||
}
|
||||
} else if (realType.equals("long_protected")) {
|
||||
|
||||
////////////////// Check protected long[] //////////////
|
||||
LongValue longValue;
|
||||
long element;
|
||||
|
||||
try {
|
||||
longValue = (LongValue)arrayValue;
|
||||
} catch (ClassCastException e) {
|
||||
log.complain("debuger FAILURE LR1> Cannot cast to "
|
||||
+ "long " + j + " value of field "
|
||||
+ name);
|
||||
log.complain("debuger FAILURE LR1> Exception: " + e);
|
||||
testFailed = true;
|
||||
continue;
|
||||
}
|
||||
element = longValue.value();
|
||||
log.display("debuger> " + i + " field has " + j
|
||||
+ " element " + element);
|
||||
|
||||
// Check element's value
|
||||
if (element != LONGR[j + i]) {
|
||||
log.complain("debuger FAILURE LR2> " + j + " element "
|
||||
+ "of array " + name + " was expected "
|
||||
+ LONGR[j + i] + ", but returned "
|
||||
+ element);
|
||||
testFailed = true;
|
||||
continue;
|
||||
}
|
||||
} else if (realType.equals("long_transient")) {
|
||||
|
||||
////////////////// Check transient long[] //////////////
|
||||
LongValue longValue;
|
||||
long element;
|
||||
|
||||
try {
|
||||
longValue = (LongValue)arrayValue;
|
||||
} catch (ClassCastException e) {
|
||||
log.complain("debuger FAILURE LT1> Cannot cast to "
|
||||
+ "long " + j + " value of field "
|
||||
+ name);
|
||||
log.complain("debuger FAILURE LT1> Exception: " + e);
|
||||
testFailed = true;
|
||||
continue;
|
||||
}
|
||||
element = longValue.value();
|
||||
log.display("debuger> " + i + " field has " + j
|
||||
+ " element " + element);
|
||||
|
||||
// Check element's value
|
||||
if (element != LONGT[j + i]) {
|
||||
log.complain("debuger FAILURE LT2> " + j + " element "
|
||||
+ "of array " + name + " was expected "
|
||||
+ LONGT[j + i] + ", but returned "
|
||||
+ element);
|
||||
testFailed = true;
|
||||
continue;
|
||||
}
|
||||
} else if (realType.equals("long_volatile")) {
|
||||
|
||||
////////////////// Check volatile long[] //////////////
|
||||
LongValue longValue;
|
||||
long element;
|
||||
|
||||
try {
|
||||
longValue = (LongValue)arrayValue;
|
||||
} catch (ClassCastException e) {
|
||||
log.complain("debuger FAILURE LV1> Cannot cast to "
|
||||
+ "long " + j + " value of field "
|
||||
+ name);
|
||||
log.complain("debuger FAILURE LV1> Exception: " + e);
|
||||
testFailed = true;
|
||||
continue;
|
||||
}
|
||||
element = longValue.value();
|
||||
log.display("debuger> " + i + " field has " + j
|
||||
+ " element " + element);
|
||||
|
||||
// Check element's value
|
||||
if (element != LONGV[j + i]) {
|
||||
log.complain("debuger FAILURE LV2> " + j + " element "
|
||||
+ "of array " + name + " was expected "
|
||||
+ LONGV[j + i] + ", but returned "
|
||||
+ element);
|
||||
testFailed = true;
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
log.complain("debuger FAILURE 6> Unexpected type: "
|
||||
+ realType);
|
||||
testFailed = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
log.display("debuger> " + i + " field checked.\n");
|
||||
}
|
||||
|
||||
pipe.println("quit");
|
||||
debugee.waitFor();
|
||||
int status = debugee.getStatus();
|
||||
if (testFailed) {
|
||||
log.complain("debuger FAILURE> TEST FAILED");
|
||||
return 2;
|
||||
} else {
|
||||
if (status == 95) {
|
||||
log.display("debuger> expected Debugee's exit "
|
||||
+ "status - " + status);
|
||||
return 0;
|
||||
} else {
|
||||
log.complain("debuger FAILURE> UNEXPECTED Debugee's exit "
|
||||
+ "status (not 95) - " + status);
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,76 @@
|
||||
/*
|
||||
* Copyright (c) 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.
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* @test
|
||||
*
|
||||
* @summary converted from VM Testbase nsk/jdi/ArrayReference/getValues_ii/getvaluesii001.
|
||||
* VM Testbase keywords: [jpda, jdi]
|
||||
* VM Testbase readme:
|
||||
* DESCRIPTION
|
||||
* This test checks the getValues(int, int) method of ArrayReference
|
||||
* interface of com.sun.jdi package.
|
||||
* The method spec:
|
||||
* public List getValues(int index, int length)
|
||||
* Returns a range of array components.
|
||||
* Parameters: index - the index of the first component to retrieve
|
||||
* length - the number of components to retrieve, or -1 to
|
||||
* retrieve all components to the end of this array.
|
||||
* Returns: a list of Value objects, one for each requested array component
|
||||
* ordered by array index.
|
||||
* Throws: java.lang.IndexOutOfBoundsException - if index + length is an
|
||||
* index beyond the end of this array.
|
||||
* ObjectCollectedException - if this object has been garbage
|
||||
* collected.
|
||||
* nsk/jdi/ArrayReference/getValues_ii/getvaluesii001 checks assertion:
|
||||
* public Value getValues(int index, int length)
|
||||
* 1. Returns a list of Value objects -- all components to the end of the
|
||||
* array. Index is from 0 up to the index of the last element of the
|
||||
* array; length is always -1.
|
||||
* Debuggee defines 14 array fields which component type is primitive type
|
||||
* only. Each field consists of 14 elements.
|
||||
* Debugger gets each field from debuggee by name, gets its value and casts
|
||||
* it to ArrayReference. For i field debugger invokes method getValues(i, -1)
|
||||
* to get all components from i to the end of this array. The debugger
|
||||
* determines component's type (by field's name), gets each element of the
|
||||
* list, casts it to correspondent PrimitiveType and then gets its primitive
|
||||
* value. Then the test compares returned and expected primitive values.
|
||||
* COMMENTS
|
||||
* 4419982: JDI: two StackFrame methods return incorrect values for double
|
||||
*
|
||||
* @library /vmTestbase
|
||||
* /test/lib
|
||||
* @run driver jdk.test.lib.FileInstaller . .
|
||||
* @build nsk.jdi.ArrayReference.getValues_ii.getvaluesii001
|
||||
* nsk.jdi.ArrayReference.getValues_ii.getvaluesii001a
|
||||
* @run main/othervm PropertyResolvingWrapper
|
||||
* nsk.jdi.ArrayReference.getValues_ii.getvaluesii001
|
||||
* -verbose
|
||||
* -arch=${os.family}-${os.simpleArch}
|
||||
* -waittime=5
|
||||
* -debugee.vmkind=java
|
||||
* -transport.address=dynamic
|
||||
* "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}"
|
||||
*/
|
||||
|
||||
@ -0,0 +1,97 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 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 nsk.jdi.ArrayReference.getValues_ii;
|
||||
|
||||
import nsk.share.*;
|
||||
import nsk.share.jpda.*;
|
||||
import nsk.share.jdi.*;
|
||||
|
||||
|
||||
public class getvaluesii001a {
|
||||
public static void main (String argv[]) {
|
||||
ArgumentHandler argHandler = new ArgumentHandler(argv);
|
||||
Log log = new Log(System.err, argHandler);
|
||||
IOPipe pipe = argHandler.createDebugeeIOPipe(log);
|
||||
getvaluesii001aClassToCheck classToCheck = new getvaluesii001aClassToCheck();
|
||||
|
||||
log.display("DEBUGEE> debugee started.");
|
||||
pipe.println("ready");
|
||||
String instruction = pipe.readln();
|
||||
if (instruction.equals("quit")) {
|
||||
log.display("DEBUGEE> \"quit\" signal recieved.");
|
||||
log.display("DEBUGEE> completed succesfully.");
|
||||
System.exit(95);
|
||||
}
|
||||
log.complain("DEBUGEE FAILURE> unexpected signal "
|
||||
+ "(no \"quit\") - " + instruction);
|
||||
log.complain("DEBUGEE FAILURE> TEST FAILED");
|
||||
System.exit(97);
|
||||
}
|
||||
}
|
||||
|
||||
class getvaluesii001aClassToCheck {
|
||||
|
||||
// Each of 14 array fields has 14 elements
|
||||
static boolean z1[] = {true, false, false, false, true,
|
||||
false, false, true, false, false,
|
||||
false, true, true};
|
||||
static byte b1[] = {0,
|
||||
Byte.MIN_VALUE, -1, 0, 1, Byte.MAX_VALUE,
|
||||
-101, -100, -99, Byte.MIN_VALUE + 1, 99,
|
||||
Byte.MAX_VALUE - 1, 101, -1};
|
||||
static char c1[] = {0, 1,
|
||||
Character.MIN_VALUE, '\u00ff', '\uff00', '\uff00',
|
||||
'\uff00', '\u1234', '\u0f0f', Character.MAX_VALUE,
|
||||
'\u0f0f', Character.MIN_VALUE, Character.MAX_VALUE,
|
||||
'\u1234'};
|
||||
static double d1[] = {0, 1, 2,
|
||||
Double.NEGATIVE_INFINITY, Double.MIN_VALUE, -1, -0,
|
||||
0, 1, Double.MAX_VALUE, Double.NaN, Double.NaN,
|
||||
Double.POSITIVE_INFINITY, Double.NaN};
|
||||
static float f1[] = {0, 1, 2, 3,
|
||||
Float.NEGATIVE_INFINITY, Float.MIN_VALUE, -1, -0,
|
||||
0, 1, Float.MAX_VALUE, Float.POSITIVE_INFINITY,
|
||||
Float.NaN, Float.POSITIVE_INFINITY};
|
||||
static int i1[] = {0, 1, 2, 3, 4,
|
||||
-255, Integer.MIN_VALUE, -1, 0, 1, Integer.MAX_VALUE,
|
||||
254, 255, 256};
|
||||
static long l1[] = {0, 1, 2, 3, 4, 5,
|
||||
Long.MIN_VALUE, -1, 0, 1, Long.MAX_VALUE, -1, -2, 0};
|
||||
static short r1[] = {0, 1, 2, 3, 4, 5, 6,
|
||||
Short.MIN_VALUE, -1, 0, 1, Short.MAX_VALUE, -2, 0};
|
||||
|
||||
static final long lF1[] = {0, 1, 2, 3, 4, 5, 6, 7,
|
||||
-1, 0, 1, 2, 3, 4};
|
||||
static private long lP1[] = {0, 1, 2, 3, 4, 5, 6, 7, 8,
|
||||
Long.MIN_VALUE, -1, 0, 1, Long.MAX_VALUE};
|
||||
static public long lU1[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
|
||||
Long.MAX_VALUE, 10, 0, -10};
|
||||
static protected long lR1[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
|
||||
-1, 0, 1};
|
||||
static transient long lT1[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
|
||||
Long.MAX_VALUE, Long.MIN_VALUE};
|
||||
static volatile long lV1[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
|
||||
Long.MAX_VALUE};
|
||||
}
|
||||
@ -0,0 +1,694 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 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 nsk.jdi.ArrayReference.getValues_ii;
|
||||
|
||||
import nsk.share.*;
|
||||
import nsk.share.jpda.*;
|
||||
import nsk.share.jdi.*;
|
||||
|
||||
import com.sun.jdi.*;
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
|
||||
public class getvaluesii002 {
|
||||
final static String FIELD_NAME[][] = {
|
||||
{"z1", "boolean"},
|
||||
{"b1", "byte"},
|
||||
{"c1", "char"},
|
||||
{"i1", "int"},
|
||||
{"l1", "long"},
|
||||
{"r1", "short"},
|
||||
{"d1", "double"},
|
||||
{"f1", "float"},
|
||||
|
||||
{"lF1", "long_final"},
|
||||
{"lP1", "long_private"},
|
||||
{"lU1", "long_public"},
|
||||
{"lR1", "long_protected"},
|
||||
{"lT1", "long_transient"},
|
||||
{"lV1", "long_volatile"}
|
||||
};
|
||||
|
||||
static boolean BOOL[] = {true};
|
||||
static byte BYTE[] = {Byte.MIN_VALUE, 0, Byte.MAX_VALUE};
|
||||
static char CHAR[] = {Character.MIN_VALUE, '\u00ff', '\uff00',
|
||||
Character.MAX_VALUE, Character.MAX_VALUE};
|
||||
static int INT[] = {Integer.MIN_VALUE, -1, 0, 1, Integer.MAX_VALUE,
|
||||
Integer.MIN_VALUE + 1, Integer.MAX_VALUE - 1};
|
||||
static long LONG[] = {Long.MIN_VALUE, -1, 0, 1, Long.MAX_VALUE,
|
||||
Long.MIN_VALUE + 2, -2, 2, Long.MAX_VALUE - 2};
|
||||
static short SHORT[] = {Short.MIN_VALUE, -1, 0, 0, 1, Short.MAX_VALUE,
|
||||
Short.MAX_VALUE - 1, 1, 1, 0, Short.MIN_VALUE};
|
||||
static double DOUB[] = {Double.NEGATIVE_INFINITY, Double.MIN_VALUE, -1, -0,
|
||||
0, 1, Double.MAX_VALUE, Double.POSITIVE_INFINITY,
|
||||
Double.NaN, Double.NaN, -0, 0, 1};
|
||||
static float FLOAT[] = {Float.NEGATIVE_INFINITY, Float.MIN_VALUE, -1, -0,
|
||||
0, 1, Float.MAX_VALUE, Float.POSITIVE_INFINITY,
|
||||
Float.NaN, Float.NaN, 123456, 0, -123456,
|
||||
Float.NaN, Float.NEGATIVE_INFINITY};
|
||||
|
||||
static final long LONGF[] = {Long.MIN_VALUE, -1, 0, 1, Long.MAX_VALUE,
|
||||
Long.MIN_VALUE, -1, 0, 1, Long.MAX_VALUE,
|
||||
Long.MIN_VALUE, -1, 0, 1, Long.MAX_VALUE,
|
||||
Long.MIN_VALUE, -1, 0};
|
||||
static private long LONGP[] = {Long.MAX_VALUE, -1, 0, 1, Long.MIN_VALUE,
|
||||
Long.MAX_VALUE, -1, 0, 1, Long.MIN_VALUE,
|
||||
Long.MAX_VALUE, -1, 0, 1, Long.MIN_VALUE,
|
||||
Long.MAX_VALUE, -1, 0, 1, Long.MIN_VALUE};
|
||||
static public long LONGU[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
|
||||
-1, -2, -3, -4, -5, -6, -7, -8, -9, -10,
|
||||
Long.MAX_VALUE, Long.MIN_VALUE};
|
||||
static protected long LONGR[] = {-1, -2, -3, -4, -5, -6, -7, -8, -9, -10,
|
||||
1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
|
||||
Long.MAX_VALUE, Long.MIN_VALUE, 0, 0};
|
||||
static transient long LONGT[] = {Long.MIN_VALUE, Long.MIN_VALUE,
|
||||
Long.MIN_VALUE, Long.MIN_VALUE,
|
||||
Long.MIN_VALUE, Long.MIN_VALUE,
|
||||
Long.MIN_VALUE, Long.MIN_VALUE,
|
||||
Long.MIN_VALUE, Long.MIN_VALUE,
|
||||
Long.MIN_VALUE, Long.MIN_VALUE,
|
||||
Long.MIN_VALUE, Long.MIN_VALUE,
|
||||
Long.MIN_VALUE, Long.MIN_VALUE,
|
||||
Long.MIN_VALUE, Long.MIN_VALUE,
|
||||
Long.MIN_VALUE, Long.MIN_VALUE,
|
||||
Long.MIN_VALUE, Long.MIN_VALUE,
|
||||
Long.MIN_VALUE, Long.MIN_VALUE,
|
||||
Long.MAX_VALUE, Long.MAX_VALUE - 1};
|
||||
static volatile long LONGV[] = {Long.MAX_VALUE, Long.MAX_VALUE,
|
||||
Long.MAX_VALUE, Long.MAX_VALUE,
|
||||
Long.MAX_VALUE, Long.MAX_VALUE,
|
||||
Long.MAX_VALUE, Long.MAX_VALUE,
|
||||
Long.MAX_VALUE, Long.MAX_VALUE,
|
||||
Long.MAX_VALUE, Long.MAX_VALUE,
|
||||
Long.MAX_VALUE, Long.MAX_VALUE,
|
||||
Long.MAX_VALUE, Long.MAX_VALUE,
|
||||
Long.MAX_VALUE, Long.MAX_VALUE,
|
||||
Long.MAX_VALUE, Long.MAX_VALUE,
|
||||
Long.MAX_VALUE, Long.MAX_VALUE,
|
||||
Long.MAX_VALUE, Long.MAX_VALUE,
|
||||
Long.MAX_VALUE, Long.MAX_VALUE,
|
||||
Long.MIN_VALUE};
|
||||
|
||||
private static Log log;
|
||||
private final static String prefix = "nsk.jdi.ArrayReference.getValues_ii.";
|
||||
private final static String className = "getvaluesii002";
|
||||
private final static String debugerName = prefix + className;
|
||||
private final static String debugeeName = debugerName + "a";
|
||||
private final static String classToCheckName = prefix + "getvaluesii002aClassToCheck";
|
||||
|
||||
public static void main(String argv[]) {
|
||||
System.exit(95 + run(argv, System.out));
|
||||
}
|
||||
|
||||
public static int run(String argv[], PrintStream out) {
|
||||
ArgumentHandler argHandler = new ArgumentHandler(argv);
|
||||
log = new Log(out, argHandler);
|
||||
Binder binder = new Binder(argHandler, log);
|
||||
Debugee debugee = binder.bindToDebugee(debugeeName
|
||||
+ (argHandler.verbose() ? " -verbose" : ""));
|
||||
IOPipe pipe = debugee.createIOPipe();
|
||||
boolean testFailed = false;
|
||||
|
||||
// Connect with debugee and resume it
|
||||
debugee.redirectStderr(out);
|
||||
debugee.resume();
|
||||
String line = pipe.readln();
|
||||
if (line == null) {
|
||||
log.complain("debuger FAILURE> UNEXPECTED debugee's signal - null");
|
||||
return 2;
|
||||
}
|
||||
if (!line.equals("ready")) {
|
||||
log.complain("debuger FAILURE> UNEXPECTED debugee's signal - "
|
||||
+ line);
|
||||
return 2;
|
||||
}
|
||||
else {
|
||||
log.display("debuger> debugee's \"ready\" signal recieved.");
|
||||
}
|
||||
|
||||
ReferenceType refType = debugee.classByName(classToCheckName);
|
||||
if (refType == null) {
|
||||
log.complain("debuger FAILURE> Class " + classToCheckName
|
||||
+ " not found.");
|
||||
return 2;
|
||||
}
|
||||
log.display("debuger> Total fields in debugee read: "
|
||||
+ refType.allFields().size() + " total fields in debuger: "
|
||||
+ FIELD_NAME.length + "\n");
|
||||
|
||||
// Check all array fields from debugee
|
||||
for (int i = 0; i < FIELD_NAME.length; i++) {
|
||||
Field field;
|
||||
String name = FIELD_NAME[i][0];
|
||||
String realType = FIELD_NAME[i][1];
|
||||
Value value;
|
||||
ArrayReference arrayRef;
|
||||
List listOfValues;
|
||||
|
||||
// Get field from debuggee by name
|
||||
try {
|
||||
field = refType.fieldByName(name);
|
||||
} catch (ClassNotPreparedException e) {
|
||||
log.complain("debuger FAILURE 1> Can't get field by name "
|
||||
+ name);
|
||||
log.complain("debuger FAILURE 1> Exception: " + e);
|
||||
testFailed = true;
|
||||
continue;
|
||||
} catch (ObjectCollectedException e) {
|
||||
log.complain("debuger FAILURE 1> Can't get field by name "
|
||||
+ name);
|
||||
log.complain("debuger FAILURE 1> Exception: " + e);
|
||||
testFailed = true;
|
||||
continue;
|
||||
}
|
||||
log.display("debuger> " + i + " field " + field + " read.");
|
||||
|
||||
// Get field's value
|
||||
try {
|
||||
value = refType.getValue(field);
|
||||
} catch (IllegalArgumentException e) {
|
||||
log.complain("debuger FAILURE 2> Cannot get value for field "
|
||||
+ name);
|
||||
log.complain("debuger FAILURE 2> Exception: " + e);
|
||||
testFailed = true;
|
||||
continue;
|
||||
} catch (ObjectCollectedException e) {
|
||||
log.complain("debuger FAILURE 2> Cannot get value for field "
|
||||
+ name);
|
||||
log.complain("debuger FAILURE 2> Exception: " + e);
|
||||
testFailed = true;
|
||||
continue;
|
||||
}
|
||||
log.display("debuger> " + i + " field value is " + value);
|
||||
|
||||
// Cast to ArrayReference. All fields in debugee are
|
||||
// arrays, so ClassCastException should not be thrown
|
||||
try {
|
||||
arrayRef = (ArrayReference)value;
|
||||
} catch (ClassCastException e) {
|
||||
log.complain("debuger FAILURE 3> Cannot cast value for field "
|
||||
+ name + " to ArrayReference.");
|
||||
log.complain("debuger FAILURE 3> Exception: " + e);
|
||||
testFailed = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
// Get i + 1 components from index i. Each array has enough
|
||||
// elements, so that IndexOutOfBoundsException should never be
|
||||
// thrown
|
||||
try {
|
||||
listOfValues = arrayRef.getValues(i, i + 1);
|
||||
} catch (ObjectCollectedException e) {
|
||||
log.complain("debuger FAILURE 4> Cannot get values from field "
|
||||
+ name + " from index " + i);
|
||||
log.complain("debuger FAILURE 4> Exception: " + e);
|
||||
testFailed = true;
|
||||
continue;
|
||||
} catch (IndexOutOfBoundsException e) {
|
||||
log.complain("debuger FAILURE 4> Cannot get values from field "
|
||||
+ name + " from index " + i);
|
||||
log.complain("debuger FAILURE 4> Exception: " + e);
|
||||
testFailed = true;
|
||||
continue;
|
||||
}
|
||||
log.display("debuger> " + i + " field read: " + listOfValues);
|
||||
|
||||
// Check each element from the list
|
||||
for (int j = 0; j < listOfValues.size(); j++) {
|
||||
Value arrayValue;
|
||||
|
||||
try {
|
||||
arrayValue = (Value)listOfValues.get(j);
|
||||
} catch (ClassCastException e) {
|
||||
log.complain("debuger FAILURE 5> Cannot cast to Value "
|
||||
+ j + " element of field " + name);
|
||||
log.complain("debuger FAILURE 5> Exception: " + e);
|
||||
testFailed = true;
|
||||
continue;
|
||||
}
|
||||
log.display("debuger> " + i + " field has " + j + " value "
|
||||
+ arrayValue);
|
||||
|
||||
if (realType.equals("boolean")) {
|
||||
|
||||
///////////////////// Check boolean[] /////////////////////
|
||||
BooleanValue boolValue;
|
||||
boolean element;
|
||||
|
||||
try {
|
||||
boolValue = (BooleanValue)arrayValue;
|
||||
} catch (ClassCastException e) {
|
||||
log.complain("debuger FAILURE Z1> Cannot cast to "
|
||||
+ "boolean " + j + " value of field "
|
||||
+ name);
|
||||
log.complain("debuger FAILURE Z1> Exception: " + e);
|
||||
testFailed = true;
|
||||
continue;
|
||||
}
|
||||
element = boolValue.value();
|
||||
log.display("debuger> " + i + " field has " + j
|
||||
+ " element " + element);
|
||||
|
||||
// Check element's value
|
||||
if (element != BOOL[j + i]) {
|
||||
log.complain("debuger FAILURE Z2> " + j + " element "
|
||||
+ "of array " + name + " was expected "
|
||||
+ BOOL[j + i] + ", but returned "
|
||||
+ element);
|
||||
testFailed = true;
|
||||
continue;
|
||||
}
|
||||
} else if (realType.equals("byte")) {
|
||||
|
||||
///////////////////// Check byte[] /////////////////////
|
||||
ByteValue byteValue;
|
||||
byte element;
|
||||
|
||||
try {
|
||||
byteValue = (ByteValue)arrayValue;
|
||||
} catch (ClassCastException e) {
|
||||
log.complain("debuger FAILURE B1> Cannot cast to "
|
||||
+ "byte " + j + " value of field "
|
||||
+ name);
|
||||
log.complain("debuger FAILURE B1> Exception: " + e);
|
||||
testFailed = true;
|
||||
continue;
|
||||
}
|
||||
element = byteValue.value();
|
||||
log.display("debuger> " + i + " field has " + j
|
||||
+ " element " + element);
|
||||
|
||||
// Check element's value
|
||||
if (element != BYTE[j + i]) {
|
||||
log.complain("debuger FAILURE B2> " + j + " element "
|
||||
+ "of array " + name + " was expected "
|
||||
+ BYTE[j + i] + ", but returned "
|
||||
+ element);
|
||||
testFailed = true;
|
||||
continue;
|
||||
}
|
||||
} else if (realType.equals("char")) {
|
||||
|
||||
///////////////////// Check char[] /////////////////////
|
||||
CharValue charValue;
|
||||
char element;
|
||||
|
||||
try {
|
||||
charValue = (CharValue)arrayValue;
|
||||
} catch (ClassCastException e) {
|
||||
log.complain("debuger FAILURE C1> Cannot cast to "
|
||||
+ "char " + j + " value of field "
|
||||
+ name);
|
||||
log.complain("debuger FAILURE C1> Exception: " + e);
|
||||
testFailed = true;
|
||||
continue;
|
||||
}
|
||||
element = charValue.value();
|
||||
log.display("debuger> " + i + " field has " + j
|
||||
+ " element " + element);
|
||||
|
||||
// Check element's value
|
||||
if (element != CHAR[j + i]) {
|
||||
Character c = new Character('c');
|
||||
Integer n = new Integer(0);
|
||||
String sReal = n.toHexString(
|
||||
c.getNumericValue(CHAR[j + i])
|
||||
);
|
||||
String sRead = n.toHexString(
|
||||
c.getNumericValue(element)
|
||||
);
|
||||
|
||||
log.complain("debuger FAILURE C2> " + j + " element "
|
||||
+ "of array " + name + " was expected "
|
||||
+ sReal + " but returned " + sRead);
|
||||
testFailed = true;
|
||||
continue;
|
||||
}
|
||||
} else if (realType.equals("double")) {
|
||||
|
||||
///////////////////// Check double[] /////////////////////
|
||||
DoubleValue doubleValue;
|
||||
Double element;
|
||||
|
||||
try {
|
||||
doubleValue = (DoubleValue)arrayValue;
|
||||
} catch (ClassCastException e) {
|
||||
log.complain("debuger FAILURE D1> Cannot cast to "
|
||||
+ "double " + j + " value of field "
|
||||
+ name);
|
||||
log.complain("debuger FAILURE D1> Exception: " + e);
|
||||
testFailed = true;
|
||||
continue;
|
||||
}
|
||||
element = new Double(doubleValue.value());
|
||||
log.display("debuger> " + i + " field has " + j
|
||||
+ " element " + element);
|
||||
|
||||
// Check element's value
|
||||
if (!element.equals(new Double(DOUB[j + i]))) {
|
||||
log.complain("debuger FAILURE D2> " + j + " element "
|
||||
+ "of array " + name + " was expected "
|
||||
+ DOUB[j + i] + ", but returned " + element);
|
||||
testFailed = true;
|
||||
continue;
|
||||
}
|
||||
} else if (realType.equals("float")) {
|
||||
|
||||
///////////////////// Check float[] /////////////////////
|
||||
FloatValue floatValue;
|
||||
Float element;
|
||||
|
||||
try {
|
||||
floatValue = (FloatValue)arrayValue;
|
||||
} catch (ClassCastException e) {
|
||||
log.complain("debuger FAILURE F1> Cannot cast to "
|
||||
+ "float " + j + " value of field "
|
||||
+ name);
|
||||
log.complain("debuger FAILURE F1> Exception: " + e);
|
||||
testFailed = true;
|
||||
continue;
|
||||
}
|
||||
element = new Float(floatValue.value());
|
||||
log.display("debuger> " + i + " field has " + j
|
||||
+ " element " + element);
|
||||
|
||||
// Check element's value
|
||||
if (!element.equals(new Float(FLOAT[j + i]))) {
|
||||
log.complain("debuger FAILURE F2> " + j + " element "
|
||||
+ "of array " + name + " was expected "
|
||||
+ FLOAT[j + i] + ", but returned "
|
||||
+ element);
|
||||
testFailed = true;
|
||||
continue;
|
||||
}
|
||||
} else if (realType.equals("int")) {
|
||||
|
||||
///////////////////// Check int[] /////////////////////
|
||||
IntegerValue intValue;
|
||||
int element;
|
||||
|
||||
try {
|
||||
intValue = (IntegerValue)arrayValue;
|
||||
} catch (ClassCastException e) {
|
||||
log.complain("debuger FAILURE I1> Cannot cast to "
|
||||
+ "int " + j + " value of field "
|
||||
+ name);
|
||||
log.complain("debuger FAILURE I1> Exception: " + e);
|
||||
testFailed = true;
|
||||
continue;
|
||||
}
|
||||
element = intValue.value();
|
||||
log.display("debuger> " + i + " field has " + j
|
||||
+ " element " + element);
|
||||
|
||||
// Check element's value
|
||||
if (element != INT[j + i]) {
|
||||
log.complain("debuger FAILURE I2> " + j + " element "
|
||||
+ "of array " + name + " was expected "
|
||||
+ INT[j + i] + ", but returned " + element);
|
||||
testFailed = true;
|
||||
continue;
|
||||
}
|
||||
} else if (realType.equals("long")) {
|
||||
|
||||
///////////////////// Check long[] /////////////////////
|
||||
LongValue longValue;
|
||||
long element;
|
||||
|
||||
try {
|
||||
longValue = (LongValue)arrayValue;
|
||||
} catch (ClassCastException e) {
|
||||
log.complain("debuger FAILURE L1> Cannot cast to "
|
||||
+ "long " + j + " value of field "
|
||||
+ name);
|
||||
log.complain("debuger FAILURE L1> Exception: " + e);
|
||||
testFailed = true;
|
||||
continue;
|
||||
}
|
||||
element = longValue.value();
|
||||
log.display("debuger> " + i + " field has " + j
|
||||
+ " element " + element);
|
||||
|
||||
// Check element's value
|
||||
if (element != LONG[j + i]) {
|
||||
log.complain("debuger FAILURE L2> " + j + " element "
|
||||
+ "of array " + name + " was expected "
|
||||
+ LONG[j + i] + ", but returned "
|
||||
+ element);
|
||||
testFailed = true;
|
||||
continue;
|
||||
}
|
||||
} else if (realType.equals("short")) {
|
||||
|
||||
///////////////////// Check short[] /////////////////////
|
||||
ShortValue shortValue;
|
||||
short element;
|
||||
|
||||
try {
|
||||
shortValue = (ShortValue)arrayValue;
|
||||
} catch (ClassCastException e) {
|
||||
log.complain("debuger FAILURE R1> Cannot cast to "
|
||||
+ "short " + j + " value of field "
|
||||
+ name);
|
||||
log.complain("debuger FAILURE R1> Exception: " + e);
|
||||
testFailed = true;
|
||||
continue;
|
||||
}
|
||||
element = shortValue.value();
|
||||
log.display("debuger> " + i + " field has " + j
|
||||
+ " element " + element);
|
||||
|
||||
// Check element's value
|
||||
if (element != SHORT[j + i]) {
|
||||
log.complain("debuger FAILURE R2> " + j + " element "
|
||||
+ "of array " + name + " was expected "
|
||||
+ SHORT[j + i] + ", but returned "
|
||||
+ element);
|
||||
testFailed = true;
|
||||
continue;
|
||||
}
|
||||
} else if (realType.equals("long_final")) {
|
||||
|
||||
//////////////////// Check final long[] /////////////////
|
||||
LongValue longValue;
|
||||
long element;
|
||||
|
||||
try {
|
||||
longValue = (LongValue)arrayValue;
|
||||
} catch (ClassCastException e) {
|
||||
log.complain("debuger FAILURE LF1> Cannot cast to "
|
||||
+ "long " + j + " value of field "
|
||||
+ name);
|
||||
log.complain("debuger FAILURE LF1> Exception: " + e);
|
||||
testFailed = true;
|
||||
continue;
|
||||
}
|
||||
element = longValue.value();
|
||||
log.display("debuger> " + i + " field has " + j
|
||||
+ " element " + element);
|
||||
|
||||
// Check element's value
|
||||
if (element != LONGF[j + i]) {
|
||||
log.complain("debuger FAILURE LF2> " + j + " element "
|
||||
+ "of array " + name + " was expected "
|
||||
+ LONGF[j + i] + ", but returned "
|
||||
+ element);
|
||||
testFailed = true;
|
||||
continue;
|
||||
}
|
||||
} else if (realType.equals("long_private")) {
|
||||
|
||||
//////////////////// Check private long[] ////////////////
|
||||
LongValue longValue;
|
||||
long element;
|
||||
|
||||
try {
|
||||
longValue = (LongValue)arrayValue;
|
||||
} catch (ClassCastException e) {
|
||||
log.complain("debuger FAILURE LP1> Cannot cast to "
|
||||
+ "long " + j + " value of field "
|
||||
+ name);
|
||||
log.complain("debuger FAILURE LP1> Exception: " + e);
|
||||
testFailed = true;
|
||||
continue;
|
||||
}
|
||||
element = longValue.value();
|
||||
log.display("debuger> " + i + " field has " + j
|
||||
+ " element " + element);
|
||||
|
||||
// Check element's value
|
||||
if (element != LONGP[j + i]) {
|
||||
log.complain("debuger FAILURE LP2> " + j + " element "
|
||||
+ "of array " + name + " was expected "
|
||||
+ LONGP[j + i] + ", but returned "
|
||||
+ element);
|
||||
testFailed = true;
|
||||
continue;
|
||||
}
|
||||
} else if (realType.equals("long_public")) {
|
||||
|
||||
//////////////////// Check public long[] ////////////////
|
||||
LongValue longValue;
|
||||
long element;
|
||||
|
||||
try {
|
||||
longValue = (LongValue)arrayValue;
|
||||
} catch (ClassCastException e) {
|
||||
log.complain("debuger FAILURE LU1> Cannot cast to "
|
||||
+ "long " + j + " value of field "
|
||||
+ name);
|
||||
log.complain("debuger FAILURE LU1> Exception: " + e);
|
||||
testFailed = true;
|
||||
continue;
|
||||
}
|
||||
element = longValue.value();
|
||||
log.display("debuger> " + i + " field has " + j
|
||||
+ " element " + element);
|
||||
|
||||
// Check element's value
|
||||
if (element != LONGU[j + i]) {
|
||||
log.complain("debuger FAILURE LU2> " + j + " element "
|
||||
+ "of array " + name + " was expected "
|
||||
+ LONGU[j + i] + ", but returned "
|
||||
+ element);
|
||||
testFailed = true;
|
||||
continue;
|
||||
}
|
||||
} else if (realType.equals("long_protected")) {
|
||||
|
||||
////////////////// Check protected long[] //////////////
|
||||
LongValue longValue;
|
||||
long element;
|
||||
|
||||
try {
|
||||
longValue = (LongValue)arrayValue;
|
||||
} catch (ClassCastException e) {
|
||||
log.complain("debuger FAILURE LR1> Cannot cast to "
|
||||
+ "long " + j + " value of field "
|
||||
+ name);
|
||||
log.complain("debuger FAILURE LR1> Exception: " + e);
|
||||
testFailed = true;
|
||||
continue;
|
||||
}
|
||||
element = longValue.value();
|
||||
log.display("debuger> " + i + " field has " + j
|
||||
+ " element " + element);
|
||||
|
||||
// Check element's value
|
||||
if (element != LONGR[j + i]) {
|
||||
log.complain("debuger FAILURE LR2> " + j + " element "
|
||||
+ "of array " + name + " was expected "
|
||||
+ LONGR[j + i] + ", but returned "
|
||||
+ element);
|
||||
testFailed = true;
|
||||
continue;
|
||||
}
|
||||
} else if (realType.equals("long_transient")) {
|
||||
|
||||
////////////////// Check transient long[] //////////////
|
||||
LongValue longValue;
|
||||
long element;
|
||||
|
||||
try {
|
||||
longValue = (LongValue)arrayValue;
|
||||
} catch (ClassCastException e) {
|
||||
log.complain("debuger FAILURE LT1> Cannot cast to "
|
||||
+ "long " + j + " value of field "
|
||||
+ name);
|
||||
log.complain("debuger FAILURE LT1> Exception: " + e);
|
||||
testFailed = true;
|
||||
continue;
|
||||
}
|
||||
element = longValue.value();
|
||||
log.display("debuger> " + i + " field has " + j
|
||||
+ " element " + element);
|
||||
|
||||
// Check element's value
|
||||
if (element != LONGT[j + i]) {
|
||||
log.complain("debuger FAILURE LT2> " + j + " element "
|
||||
+ "of array " + name + " was expected "
|
||||
+ LONGT[j + i] + ", but returned "
|
||||
+ element);
|
||||
testFailed = true;
|
||||
continue;
|
||||
}
|
||||
} else if (realType.equals("long_volatile")) {
|
||||
|
||||
////////////////// Check volatile long[] //////////////
|
||||
LongValue longValue;
|
||||
long element;
|
||||
|
||||
try {
|
||||
longValue = (LongValue)arrayValue;
|
||||
} catch (ClassCastException e) {
|
||||
log.complain("debuger FAILURE LV1> Cannot cast to "
|
||||
+ "long " + j + " value of field "
|
||||
+ name);
|
||||
log.complain("debuger FAILURE LV1> Exception: " + e);
|
||||
testFailed = true;
|
||||
continue;
|
||||
}
|
||||
element = longValue.value();
|
||||
log.display("debuger> " + i + " field has " + j
|
||||
+ " element " + element);
|
||||
|
||||
// Check element's value
|
||||
if (element != LONGV[j + i]) {
|
||||
log.complain("debuger FAILURE LV2> " + j + " element "
|
||||
+ "of array " + name + " was expected "
|
||||
+ LONGV[j + i] + ", but returned "
|
||||
+ element);
|
||||
testFailed = true;
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
log.complain("debuger FAILURE 6> Unexpected type: "
|
||||
+ realType);
|
||||
testFailed = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
log.display("debuger> " + i + " field checked.\n");
|
||||
}
|
||||
|
||||
pipe.println("quit");
|
||||
debugee.waitFor();
|
||||
int status = debugee.getStatus();
|
||||
if (testFailed) {
|
||||
log.complain("debuger FAILURE> TEST FAILED");
|
||||
return 2;
|
||||
} else {
|
||||
if (status == 95) {
|
||||
log.display("debuger> expected Debugee's exit "
|
||||
+ "status - " + status);
|
||||
return 0;
|
||||
} else {
|
||||
log.complain("debuger FAILURE> UNEXPECTED Debugee's exit "
|
||||
+ "status (not 95) - " + status);
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,77 @@
|
||||
/*
|
||||
* Copyright (c) 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.
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* @test
|
||||
*
|
||||
* @summary converted from VM Testbase nsk/jdi/ArrayReference/getValues_ii/getvaluesii002.
|
||||
* VM Testbase keywords: [jpda, jdi]
|
||||
* VM Testbase readme:
|
||||
* DESCRIPTION
|
||||
* This test checks the getValues(int, int) method of ArrayReference
|
||||
* interface of com.sun.jdi package.
|
||||
* The method spec:
|
||||
* public List getValues(int index, int length)
|
||||
* Returns a range of array components.
|
||||
* Parameters: index - the index of the first component to retrieve
|
||||
* length - the number of components to retrieve, or -1 to
|
||||
* retrieve all components to the end of this array.
|
||||
* Returns: a list of Value objects, one for each requested array component
|
||||
* ordered by array index.
|
||||
* Throws: java.lang.IndexOutOfBoundsException - if index + length is an
|
||||
* index beyond the end of this array.
|
||||
* ObjectCollectedException - if this object has been garbage
|
||||
* collected.
|
||||
* nsk/jdi/ArrayReference/getValues_ii/getvaluesii002 checks assertion:
|
||||
* public Value getValues(int index, int length)
|
||||
* 1. Returns a range of array components.
|
||||
* Debuggee defines a number of array fields where component type is primitive
|
||||
* types only. Each field has two more components then previous one.
|
||||
* Debugger gets each field from debuggee by name, gets its value and casts
|
||||
* it to ArrayReference. For i field debugger invokes method
|
||||
* getValues(i, i + 1), that gets i + 1 components from index i. The debugger
|
||||
* determines component's type (by field's name), gets each element of the
|
||||
* list, casts it to correspondent PrimitiveType and then gets its primitive
|
||||
* value. Then the test compares returned and expected primitive values.
|
||||
* COMMENTS
|
||||
* The method getValues(int, int) with length == 0 never invokes, because this
|
||||
* situation is not clarified in the spec. One more test should cover this
|
||||
* situation.
|
||||
* 4419982: JDI: two StackFrame methods return incorrect values for double
|
||||
*
|
||||
* @library /vmTestbase
|
||||
* /test/lib
|
||||
* @run driver jdk.test.lib.FileInstaller . .
|
||||
* @build nsk.jdi.ArrayReference.getValues_ii.getvaluesii002
|
||||
* nsk.jdi.ArrayReference.getValues_ii.getvaluesii002a
|
||||
* @run main/othervm PropertyResolvingWrapper
|
||||
* nsk.jdi.ArrayReference.getValues_ii.getvaluesii002
|
||||
* -verbose
|
||||
* -arch=${os.family}-${os.simpleArch}
|
||||
* -waittime=5
|
||||
* -debugee.vmkind=java
|
||||
* -transport.address=dynamic
|
||||
* "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}"
|
||||
*/
|
||||
|
||||
@ -0,0 +1,116 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 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 nsk.jdi.ArrayReference.getValues_ii;
|
||||
|
||||
import nsk.share.*;
|
||||
import nsk.share.jpda.*;
|
||||
import nsk.share.jdi.*;
|
||||
|
||||
|
||||
public class getvaluesii002a {
|
||||
public static void main (String argv[]) {
|
||||
ArgumentHandler argHandler = new ArgumentHandler(argv);
|
||||
Log log = new Log(System.err, argHandler);
|
||||
IOPipe pipe = argHandler.createDebugeeIOPipe(log);
|
||||
getvaluesii002aClassToCheck classToCheck = new getvaluesii002aClassToCheck();
|
||||
|
||||
log.display("DEBUGEE> debugee started.");
|
||||
pipe.println("ready");
|
||||
String instruction = pipe.readln();
|
||||
if (instruction.equals("quit")) {
|
||||
log.display("DEBUGEE> \"quit\" signal recieved.");
|
||||
log.display("DEBUGEE> completed succesfully.");
|
||||
System.exit(95);
|
||||
}
|
||||
log.complain("DEBUGEE FAILURE> unexpected signal "
|
||||
+ "(no \"quit\") - " + instruction);
|
||||
log.complain("DEBUGEE FAILURE> TEST FAILED");
|
||||
System.exit(97);
|
||||
}
|
||||
}
|
||||
|
||||
class getvaluesii002aClassToCheck {
|
||||
|
||||
// Each field has two more components then previous
|
||||
static boolean z1[] = {true};
|
||||
static byte b1[] = {Byte.MIN_VALUE, 0, Byte.MAX_VALUE};
|
||||
static char c1[] = {Character.MIN_VALUE, '\u00ff', '\uff00',
|
||||
Character.MAX_VALUE, Character.MAX_VALUE};
|
||||
static int i1[] = {Integer.MIN_VALUE, -1, 0, 1, Integer.MAX_VALUE,
|
||||
Integer.MIN_VALUE + 1, Integer.MAX_VALUE - 1};
|
||||
static long l1[] = {Long.MIN_VALUE, -1, 0, 1, Long.MAX_VALUE,
|
||||
Long.MIN_VALUE + 2, -2, 2, Long.MAX_VALUE - 2};
|
||||
static short r1[] = {Short.MIN_VALUE, -1, 0, 0, 1, Short.MAX_VALUE,
|
||||
Short.MAX_VALUE - 1, 1, 1, 0, Short.MIN_VALUE};
|
||||
static double d1[] = {Double.NEGATIVE_INFINITY, Double.MIN_VALUE, -1, -0,
|
||||
0, 1, Double.MAX_VALUE, Double.POSITIVE_INFINITY,
|
||||
Double.NaN, Double.NaN, -0, 0, 1};
|
||||
static float f1[] = {Float.NEGATIVE_INFINITY, Float.MIN_VALUE, -1, -0,
|
||||
0, 1, Float.MAX_VALUE, Float.POSITIVE_INFINITY,
|
||||
Float.NaN, Float.NaN, 123456, 0, -123456,
|
||||
Float.NaN, Float.NEGATIVE_INFINITY};
|
||||
|
||||
static final long lF1[] = {Long.MIN_VALUE, -1, 0, 1, Long.MAX_VALUE,
|
||||
Long.MIN_VALUE, -1, 0, 1, Long.MAX_VALUE,
|
||||
Long.MIN_VALUE, -1, 0, 1, Long.MAX_VALUE,
|
||||
Long.MIN_VALUE, -1, 0};
|
||||
static private long lP1[] = {Long.MAX_VALUE, -1, 0, 1, Long.MIN_VALUE,
|
||||
Long.MAX_VALUE, -1, 0, 1, Long.MIN_VALUE,
|
||||
Long.MAX_VALUE, -1, 0, 1, Long.MIN_VALUE,
|
||||
Long.MAX_VALUE, -1, 0, 1, Long.MIN_VALUE};
|
||||
static public long lU1[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
|
||||
-1, -2, -3, -4, -5, -6, -7, -8, -9, -10,
|
||||
Long.MAX_VALUE, Long.MIN_VALUE};
|
||||
static protected long lR1[] = {-1, -2, -3, -4, -5, -6, -7, -8, -9, -10,
|
||||
1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
|
||||
Long.MAX_VALUE, Long.MIN_VALUE, 0, 0};
|
||||
static transient long lT1[] = {Long.MIN_VALUE, Long.MIN_VALUE,
|
||||
Long.MIN_VALUE, Long.MIN_VALUE,
|
||||
Long.MIN_VALUE, Long.MIN_VALUE,
|
||||
Long.MIN_VALUE, Long.MIN_VALUE,
|
||||
Long.MIN_VALUE, Long.MIN_VALUE,
|
||||
Long.MIN_VALUE, Long.MIN_VALUE,
|
||||
Long.MIN_VALUE, Long.MIN_VALUE,
|
||||
Long.MIN_VALUE, Long.MIN_VALUE,
|
||||
Long.MIN_VALUE, Long.MIN_VALUE,
|
||||
Long.MIN_VALUE, Long.MIN_VALUE,
|
||||
Long.MIN_VALUE, Long.MIN_VALUE,
|
||||
Long.MIN_VALUE, Long.MIN_VALUE,
|
||||
Long.MAX_VALUE, Long.MAX_VALUE - 1};
|
||||
static volatile long lV1[] = {Long.MAX_VALUE, Long.MAX_VALUE,
|
||||
Long.MAX_VALUE, Long.MAX_VALUE,
|
||||
Long.MAX_VALUE, Long.MAX_VALUE,
|
||||
Long.MAX_VALUE, Long.MAX_VALUE,
|
||||
Long.MAX_VALUE, Long.MAX_VALUE,
|
||||
Long.MAX_VALUE, Long.MAX_VALUE,
|
||||
Long.MAX_VALUE, Long.MAX_VALUE,
|
||||
Long.MAX_VALUE, Long.MAX_VALUE,
|
||||
Long.MAX_VALUE, Long.MAX_VALUE,
|
||||
Long.MAX_VALUE, Long.MAX_VALUE,
|
||||
Long.MAX_VALUE, Long.MAX_VALUE,
|
||||
Long.MAX_VALUE, Long.MAX_VALUE,
|
||||
Long.MAX_VALUE, Long.MAX_VALUE,
|
||||
Long.MIN_VALUE};
|
||||
}
|
||||
@ -0,0 +1,209 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 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 nsk.jdi.ArrayReference.getValues_ii;
|
||||
|
||||
import nsk.share.*;
|
||||
import nsk.share.jpda.*;
|
||||
import nsk.share.jdi.*;
|
||||
|
||||
import com.sun.jdi.*;
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
|
||||
public class getvaluesii003 {
|
||||
final static int MIN_INDEX = -50;
|
||||
final static int MAX_INDEX = 51;
|
||||
final static String FIELD_NAME[][] = {
|
||||
{"z1", "5"},
|
||||
{"b1", "5"},
|
||||
{"c1", "6"},
|
||||
{"d1", "1"},
|
||||
{"f1", "1"},
|
||||
{"i1", "10"},
|
||||
{"l1", "2"},
|
||||
{"r1", "5"},
|
||||
|
||||
{"lF1", "1"},
|
||||
{"lP1", "1"},
|
||||
{"lU1", "2"},
|
||||
{"lR1", "3"},
|
||||
{"lT1", "4"},
|
||||
{"lV1", "5"}
|
||||
};
|
||||
|
||||
private static Log log;
|
||||
private final static String prefix = "nsk.jdi.ArrayReference.getValues_ii.";
|
||||
private final static String className = "getvaluesii003";
|
||||
private final static String debugerName = prefix + className;
|
||||
private final static String debugeeName = debugerName + "a";
|
||||
private final static String classToCheckName = prefix + "getvaluesii003aClassToCheck";
|
||||
|
||||
public static void main(String argv[]) {
|
||||
System.exit(95 + run(argv, System.out));
|
||||
}
|
||||
|
||||
public static int run(String argv[], PrintStream out) {
|
||||
ArgumentHandler argHandler = new ArgumentHandler(argv);
|
||||
log = new Log(out, argHandler);
|
||||
Binder binder = new Binder(argHandler, log);
|
||||
Debugee debugee = binder.bindToDebugee(debugeeName
|
||||
+ (argHandler.verbose() ? " -verbose" : ""));
|
||||
IOPipe pipe = debugee.createIOPipe();
|
||||
boolean testFailed = false;
|
||||
|
||||
// Connect with debugee and resume it
|
||||
debugee.redirectStderr(out);
|
||||
debugee.resume();
|
||||
String line = pipe.readln();
|
||||
if (line == null) {
|
||||
log.complain("debuger FAILURE> UNEXPECTED debugee's signal - null");
|
||||
return 2;
|
||||
}
|
||||
if (!line.equals("ready")) {
|
||||
log.complain("debuger FAILURE> UNEXPECTED debugee's signal - "
|
||||
+ line);
|
||||
return 2;
|
||||
}
|
||||
else {
|
||||
log.display("debuger> debugee's \"ready\" signal recieved.");
|
||||
}
|
||||
|
||||
ReferenceType refType = debugee.classByName(classToCheckName);
|
||||
if (refType == null) {
|
||||
log.complain("debuger FAILURE> Class " + classToCheckName
|
||||
+ " not found.");
|
||||
return 2;
|
||||
}
|
||||
|
||||
log.display("debuger> Total fields in debugee read: "
|
||||
+ refType.allFields().size() + " total fields in debuger: "
|
||||
+ FIELD_NAME.length + "\n");
|
||||
|
||||
// Check all array fields from debugee
|
||||
for (int i = 0; i < FIELD_NAME.length; i++) {
|
||||
Field field;
|
||||
String name = FIELD_NAME[i][0];
|
||||
Integer totalElements = new Integer(FIELD_NAME[i][1]);
|
||||
int lastElementIndex = totalElements.intValue() - 1;
|
||||
Value value;
|
||||
ArrayReference arrayRef;
|
||||
|
||||
// Get field from debuggee by name
|
||||
try {
|
||||
field = refType.fieldByName(name);
|
||||
} catch (ClassNotPreparedException e) {
|
||||
log.complain("debuger FAILURE 1> Can't get field by name "
|
||||
+ name);
|
||||
log.complain("debuger FAILURE 1> Exception: " + e);
|
||||
testFailed = true;
|
||||
continue;
|
||||
} catch (ObjectCollectedException e) {
|
||||
log.complain("debuger FAILURE 1> Can't get field by name "
|
||||
+ name);
|
||||
log.complain("debuger FAILURE 1> Exception: " + e);
|
||||
testFailed = true;
|
||||
continue;
|
||||
}
|
||||
log.display("debuger> " + i + " field " + field + " read.");
|
||||
|
||||
// Get field's value
|
||||
try {
|
||||
value = refType.getValue(field);
|
||||
} catch (IllegalArgumentException e) {
|
||||
log.complain("debuger FAILURE 2> Cannot get value for field "
|
||||
+ name);
|
||||
log.complain("debuger FAILURE 2> Exception: " + e);
|
||||
testFailed = true;
|
||||
continue;
|
||||
} catch (ObjectCollectedException e) {
|
||||
log.complain("debuger FAILURE 2> Cannot get value for field "
|
||||
+ name);
|
||||
log.complain("debuger FAILURE 2> Exception: " + e);
|
||||
testFailed = true;
|
||||
continue;
|
||||
}
|
||||
log.display("debuger> " + i + " field value is " + value);
|
||||
|
||||
// Cast to ArrayReference. All fields in debugee are
|
||||
// arrays, so ClassCastException should not be thrown
|
||||
try {
|
||||
arrayRef = (ArrayReference)value;
|
||||
} catch (ClassCastException e) {
|
||||
log.complain("debuger FAILURE 3> Cannot cast value for field "
|
||||
+ name + " to ArrayReference.");
|
||||
log.complain("debuger FAILURE 3> Exception: " + e);
|
||||
testFailed = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
// Try to get values by index from MIN_INDEX to -1 and from
|
||||
// arrayRef.length() to MAX_INDEX, while length is 1
|
||||
for (int j = MIN_INDEX; j < MAX_INDEX; j++) {
|
||||
if ( (j < 0) || (j > lastElementIndex) ) {
|
||||
List listOfValues;
|
||||
|
||||
try {
|
||||
listOfValues = arrayRef.getValues(j, 1);
|
||||
log.complain("debuger FAILURE 4> Values for " + j
|
||||
+ " element of field " + name + " is "
|
||||
+ listOfValues + ", but "
|
||||
+ "IndexOutOfBoundsException expected.");
|
||||
testFailed = true;
|
||||
} catch (ObjectCollectedException e) {
|
||||
log.display("debuger> Cannot get " + j + " value from "
|
||||
+ "field " + name);
|
||||
log.display("debuger> Exception: " + e);
|
||||
testFailed = true;
|
||||
} catch (IndexOutOfBoundsException e) {
|
||||
// Index is always out of bounds, so
|
||||
// IndexOutOfBoundsException is expected
|
||||
log.display("debuger> " + i + " field: cannot get "
|
||||
+ "list of components from index " + j
|
||||
+ " with length 1. Expected exception: " + e);
|
||||
}
|
||||
}
|
||||
}
|
||||
log.display("debuger> " + i + " field checked.\n");
|
||||
}
|
||||
|
||||
pipe.println("quit");
|
||||
debugee.waitFor();
|
||||
int status = debugee.getStatus();
|
||||
if (testFailed) {
|
||||
log.complain("debuger FAILURE> TEST FAILED");
|
||||
return 2;
|
||||
} else {
|
||||
if (status == 95) {
|
||||
log.display("debuger> expected Debugee's exit "
|
||||
+ "status - " + status);
|
||||
return 0;
|
||||
} else {
|
||||
log.complain("debuger FAILURE> UNEXPECTED Debugee's exit "
|
||||
+ "status (not 95) - " + status);
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,73 @@
|
||||
/*
|
||||
* Copyright (c) 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.
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* @test
|
||||
*
|
||||
* @summary converted from VM Testbase nsk/jdi/ArrayReference/getValues_ii/getvaluesii003.
|
||||
* VM Testbase keywords: [jpda, jdi]
|
||||
* VM Testbase readme:
|
||||
* DESCRIPTION
|
||||
* This test checks the getValues(int, int) method of ArrayReference
|
||||
* interface of com.sun.jdi package.
|
||||
* The method spec:
|
||||
* public List getValues(int index, int length)
|
||||
* Returns a range of array components.
|
||||
* Parameters: index - the index of the first component to retrieve
|
||||
* length - the number of components to retrieve, or -1 to
|
||||
* retrieve all components to the end of this array.
|
||||
* Returns: a list of Value objects, one for each requested array component
|
||||
* ordered by array index.
|
||||
* Throws: java.lang.IndexOutOfBoundsException - if index + length is an
|
||||
* index beyond the end of this array.
|
||||
* ObjectCollectedException - if this object has been garbage
|
||||
* collected.
|
||||
* nsk/jdi/ArrayReference/getValues_ii/getvaluesii003 checks assertion:
|
||||
* public Value getValues(int index, int length)
|
||||
* 1. IndexOutOfBoundsException is thrown, if the index is out of range of
|
||||
* ArrayReference. Array has components of primitive types only.
|
||||
* Debuggee defines a number of array fields which component type is primitive
|
||||
* type only. Each array has at least one element.
|
||||
* Debugger gets each field from debuggee by name, gets its value and casts it
|
||||
* to ArrayReference. Then debugger tries to invoke the method getValues(j, 1)
|
||||
* that gets one element forn index j. Index j is form MIN_INDEX to -1 and
|
||||
* from last index to MAX_INDEX. For each index IndexOutOfBoundsException is
|
||||
* expected.
|
||||
* COMMENTS
|
||||
*
|
||||
* @library /vmTestbase
|
||||
* /test/lib
|
||||
* @run driver jdk.test.lib.FileInstaller . .
|
||||
* @build nsk.jdi.ArrayReference.getValues_ii.getvaluesii003
|
||||
* nsk.jdi.ArrayReference.getValues_ii.getvaluesii003a
|
||||
* @run main/othervm PropertyResolvingWrapper
|
||||
* nsk.jdi.ArrayReference.getValues_ii.getvaluesii003
|
||||
* -verbose
|
||||
* -arch=${os.family}-${os.simpleArch}
|
||||
* -waittime=5
|
||||
* -debugee.vmkind=java
|
||||
* -transport.address=dynamic
|
||||
* "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}"
|
||||
*/
|
||||
|
||||
@ -0,0 +1,71 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 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 nsk.jdi.ArrayReference.getValues_ii;
|
||||
|
||||
import nsk.share.*;
|
||||
import nsk.share.jpda.*;
|
||||
import nsk.share.jdi.*;
|
||||
|
||||
|
||||
public class getvaluesii003a {
|
||||
public static void main (String argv[]) {
|
||||
ArgumentHandler argHandler = new ArgumentHandler(argv);
|
||||
Log log = new Log(System.err, argHandler);
|
||||
IOPipe pipe = argHandler.createDebugeeIOPipe(log);
|
||||
getvaluesii003aClassToCheck classToCheck = new getvaluesii003aClassToCheck();
|
||||
|
||||
log.display("DEBUGEE> debugee started.");
|
||||
pipe.println("ready");
|
||||
String instruction = pipe.readln();
|
||||
if (instruction.equals("quit")) {
|
||||
log.display("DEBUGEE> \"quit\" signal recieved.");
|
||||
log.display("DEBUGEE> completed succesfully.");
|
||||
System.exit(95);
|
||||
}
|
||||
log.complain("DEBUGEE FAILURE> unexpected signal "
|
||||
+ "(no \"quit\") - " + instruction);
|
||||
log.complain("DEBUGEE FAILURE> TEST FAILED");
|
||||
System.exit(97);
|
||||
}
|
||||
}
|
||||
|
||||
class getvaluesii003aClassToCheck {
|
||||
static boolean z1[] = {true, false, false, true, true};
|
||||
static byte b1[] = {Byte.MIN_VALUE, -1, 0, 1, Byte.MAX_VALUE};
|
||||
static char c1[] = {Character.MIN_VALUE, '\u00ff', '\uff00',
|
||||
'\u1234', '\u4321', Character.MAX_VALUE};
|
||||
static double d1[] = {Double.NEGATIVE_INFINITY};
|
||||
static float f1[] = {Float.POSITIVE_INFINITY};
|
||||
static int i1[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 0};
|
||||
static long l1[] = {Long.MIN_VALUE, Long.MAX_VALUE};
|
||||
static short r1[] = {-2, -1, 0, 1, 2};
|
||||
|
||||
static final long lF1[] = {Long.MAX_VALUE};
|
||||
static private long lP1[] = {0};
|
||||
static public long lU1[] = {1, 2};
|
||||
static protected long lR1[] = {1, 2, 3};
|
||||
static transient long lT1[] = {2, 3, 4, 5};
|
||||
static volatile long lV1[] = {2, 3, 4, 5, 6};
|
||||
}
|
||||
@ -0,0 +1,211 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 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 nsk.jdi.ArrayReference.getValues_ii;
|
||||
|
||||
import nsk.share.*;
|
||||
import nsk.share.jpda.*;
|
||||
import nsk.share.jdi.*;
|
||||
|
||||
import com.sun.jdi.*;
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
|
||||
public class getvaluesii004 {
|
||||
final static int MIN_LENGTH = -50;
|
||||
final static int MAX_LENGTH = 51;
|
||||
final static String FIELD_NAME[][] = {
|
||||
{"z1", "5"},
|
||||
{"b1", "5"},
|
||||
{"c1", "6"},
|
||||
{"d1", "1"},
|
||||
{"f1", "1"},
|
||||
{"i1", "10"},
|
||||
{"l1", "2"},
|
||||
{"r1", "5"},
|
||||
|
||||
{"lF1", "1"},
|
||||
{"lP1", "1"},
|
||||
{"lU1", "2"},
|
||||
{"lR1", "3"},
|
||||
{"lT1", "4"},
|
||||
{"lV1", "5"}
|
||||
};
|
||||
|
||||
private static Log log;
|
||||
private final static String prefix = "nsk.jdi.ArrayReference.getValues_ii.";
|
||||
private final static String className = "getvaluesii004";
|
||||
private final static String debugerName = prefix + className;
|
||||
private final static String debugeeName = debugerName + "a";
|
||||
private final static String classToCheckName = prefix + "getvaluesii004aClassToCheck";
|
||||
|
||||
public static void main(String argv[]) {
|
||||
System.exit(95 + run(argv, System.out));
|
||||
}
|
||||
|
||||
public static int run(String argv[], PrintStream out) {
|
||||
ArgumentHandler argHandler = new ArgumentHandler(argv);
|
||||
log = new Log(out, argHandler);
|
||||
Binder binder = new Binder(argHandler, log);
|
||||
Debugee debugee = binder.bindToDebugee(debugeeName
|
||||
+ (argHandler.verbose() ? " -verbose" : ""));
|
||||
IOPipe pipe = debugee.createIOPipe();
|
||||
boolean testFailed = false;
|
||||
|
||||
// Connect with debugee and resume it
|
||||
debugee.redirectStderr(out);
|
||||
debugee.resume();
|
||||
String line = pipe.readln();
|
||||
if (line == null) {
|
||||
log.complain("debuger FAILURE> UNEXPECTED debugee's signal - null");
|
||||
return 2;
|
||||
}
|
||||
if (!line.equals("ready")) {
|
||||
log.complain("debuger FAILURE> UNEXPECTED debugee's signal - "
|
||||
+ line);
|
||||
return 2;
|
||||
}
|
||||
else {
|
||||
log.display("debuger> debugee's \"ready\" signal recieved.");
|
||||
}
|
||||
|
||||
ReferenceType refType = debugee.classByName(classToCheckName);
|
||||
if (refType == null) {
|
||||
log.complain("debuger FAILURE> Class " + classToCheckName
|
||||
+ " not found.");
|
||||
return 2;
|
||||
}
|
||||
|
||||
log.display("debuger> Total fields in debugee read: "
|
||||
+ refType.allFields().size() + " total fields in debuger: "
|
||||
+ FIELD_NAME.length + "\n");
|
||||
|
||||
// Check all array fields from debugee
|
||||
for (int i = 0; i < FIELD_NAME.length; i++) {
|
||||
Field field;
|
||||
String name = FIELD_NAME[i][0];
|
||||
Integer lengthOfArray = new Integer(FIELD_NAME[i][1]);
|
||||
int length = lengthOfArray.intValue();
|
||||
Value value;
|
||||
ArrayReference arrayRef;
|
||||
|
||||
// Get field from debuggee by name
|
||||
try {
|
||||
field = refType.fieldByName(name);
|
||||
} catch (ClassNotPreparedException e) {
|
||||
log.complain("debuger FAILURE 1> Can't get field by name "
|
||||
+ name);
|
||||
log.complain("debuger FAILURE 1> Exception: " + e);
|
||||
testFailed = true;
|
||||
continue;
|
||||
} catch (ObjectCollectedException e) {
|
||||
log.complain("debuger FAILURE 1> Can't get field by name "
|
||||
+ name);
|
||||
log.complain("debuger FAILURE 1> Exception: " + e);
|
||||
testFailed = true;
|
||||
continue;
|
||||
}
|
||||
log.display("debuger> " + i + " field " + field + " read.");
|
||||
|
||||
// Get field's value
|
||||
try {
|
||||
value = refType.getValue(field);
|
||||
} catch (IllegalArgumentException e) {
|
||||
log.complain("debuger FAILURE 2> Cannot get value for field "
|
||||
+ name);
|
||||
log.complain("debuger FAILURE 2> Exception: " + e);
|
||||
testFailed = true;
|
||||
continue;
|
||||
} catch (ObjectCollectedException e) {
|
||||
log.complain("debuger FAILURE 2> Cannot get value for field "
|
||||
+ name);
|
||||
log.complain("debuger FAILURE 2> Exception: " + e);
|
||||
testFailed = true;
|
||||
continue;
|
||||
}
|
||||
log.display("debuger> " + i + " field value is " + value);
|
||||
|
||||
// Cast to ArrayReference. All fields in debugee are
|
||||
// arrays, so ClassCastException should not be thrown
|
||||
try {
|
||||
arrayRef = (ArrayReference)value;
|
||||
} catch (ClassCastException e) {
|
||||
log.complain("debuger FAILURE 3> Cannot cast value for field "
|
||||
+ name + " to ArrayReference.");
|
||||
log.complain("debuger FAILURE 3> Exception: " + e);
|
||||
testFailed = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
// Try to get values from the first element with length
|
||||
// from MIN_LENGTH to -2 (-1 is legal) and from arrayRef.length()
|
||||
// to MAX_LENGTH
|
||||
for (int j = MIN_LENGTH; j < MAX_LENGTH; j++) {
|
||||
if ( (j < -1) || (j > length) ) {
|
||||
List listOfValues;
|
||||
|
||||
try {
|
||||
listOfValues = arrayRef.getValues(0, j);
|
||||
log.complain("debuger FAILURE 4> List of values of "
|
||||
+ "field " + name + " with length " + j
|
||||
+ " is " + listOfValues + ", but "
|
||||
+ "IndexOutOfBoundsException expected.");
|
||||
testFailed = true;
|
||||
} catch (ObjectCollectedException e) {
|
||||
log.display("debuger FAILURE 5> Cannot get list of "
|
||||
+ "values with length " + j + " from field "
|
||||
+ name);
|
||||
log.display("debuger FAILURE 5> Exception: " + e);
|
||||
testFailed = true;
|
||||
} catch (IndexOutOfBoundsException e) {
|
||||
// Length is negative or too large, so
|
||||
// IndexOutOfBoundsException is expected
|
||||
log.display("debuger> " + i + " field: cannot get "
|
||||
+ "list of components with length " + j
|
||||
+ ". Expected exception: " + e);
|
||||
}
|
||||
}
|
||||
}
|
||||
log.display("debuger> " + i + " field checked.\n");
|
||||
}
|
||||
|
||||
pipe.println("quit");
|
||||
debugee.waitFor();
|
||||
int status = debugee.getStatus();
|
||||
if (testFailed) {
|
||||
log.complain("debuger FAILURE> TEST FAILED");
|
||||
return 2;
|
||||
} else {
|
||||
if (status == 95) {
|
||||
log.display("debuger> expected Debugee's exit "
|
||||
+ "status - " + status);
|
||||
return 0;
|
||||
} else {
|
||||
log.complain("debuger FAILURE> UNEXPECTED Debugee's exit "
|
||||
+ "status (not 95) - " + status);
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user